Jump to content
  • 0

Eroare BURNED AndreiGB


Question

Posted

[17:23:00] [debug] Run time error 4: "Array index out of bounds"
[17:23:00] [debug]  Accessing element at negative index -400
[17:23:00] [debug] AMX backtrace:
[17:23:00] [debug] #0 0014a628 in ?? (0) from GM.amx
[17:23:00] [debug] #1 00143e98 in public @_yCv (0, 60232712, 0) from GM.amx
[17:23:00] [debug] #2 00143e44 in public @yC_v (0, 60232712, 0, 0) from GM.amx
[17:23:00] [debug] #3 native CallRemoteFunction () from samp-server.exe
[17:23:00] [debug] #4 00036ecc in ?? (0, 60232700, 0) from GM.amx
[17:23:00] [debug] #5 00036710 in ?? (0, 60232700) from GM.amx
[17:23:00] [debug] #6 000290dc in public OnPlayerCommandText (0, 60232700) from GM.amx

COMUNITATEA MEA DE RESURSE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spacer.png
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
www.codeup.ro / www.codeup.ro/forum

7 answers to this question

Recommended Posts

  • 0
Posted (edited)
Quote

[17:23:00] [debug] Run time error 4: "Array index out of bounds"
 [17:23:00] [debug]  Accessing element at negative index -400

gm-ul incearca sa acceseze element-ul -400 dintr-un array, si iti da eroare pentru ca array-urile incep de la 0. Cel mai probabil e din cauza functiei care iti arata numele masinii. uitate dupa "vehicleid - 400" or something

Edited by CritteR
  • 0
Posted
Chiar acum, CritteR a spus:

si in comanda ta /v nu accesezi o functie, sau un cod care cauta numele masinii intr-un array?

YCMD:v(playerid, params[], help) return ShowPlayerVehicle(playerid);

 

 

Spoiler

stock ShowPlayerVehicle(playerid) {
    new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
    if(GetVehicles(playerid) == 0) return SCM(playerid, COLOR_LGREEN, "Eroare: Nu ai un vehicul personal!");
    format(szTitle, sizeof(szTitle), "Vehicles (%d/%d)", GetVehicles(playerid), TotalSlots(playerid));            
    for(new i = 0; i < 10; i++) {
        if(i < 5) {
            if(i < 3) {
                if(PlayerInfo[playerid][pCarKey] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey];
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[playerid] = 0;
            }
            else {
                if(PlayerInfo[playerid][pCarKey] != 0) {
                    new car =  PlayerInfo[playerid][pCarKey];
                    if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                    format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                    strcat(szDialog2, szDialog);
                }
                else if(PlayerInfo[playerid][pPremiumAccount] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[playerid] = 0;            
            }
        }
        else {
            if(PlayerInfo[playerid][pCarKey] != 0) {
                new car =  PlayerInfo[playerid][pCarKey];
                if(IsVehicleOccupied(CarInfo[car][Spawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else if(CarInfo[car][Spawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                else format(vstatus, sizeof(vstatus), "{FF0000}(Despawnat){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
                format(szDialog, sizeof(szDialog), "%s\n", vstatus);
                strcat(szDialog2, szDialog);
            }
            else if(PlayerInfo[playerid][pSlot][i-5] == 1) strcat(szDialog2, "{F3FF73}[ empty ]\n"), sVehicle[playerid] = 0;        
        }
    }
    ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
    return 1;
}

 

COMUNITATEA MEA DE RESURSE
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spacer.png
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
www.codeup.ro / www.codeup.ro/forum

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.