Help me with the error please
#1

When I type /v to view my vehicle garage I get this error:
Код HTML:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Attempted to read/write array element at negative index -400
[debug] AMX backtrace:
[debug] #0 0009fbb0 in ?? (0) from gm.amx
[debug] #1 0007c93c in public cmd_v (0, 24069752) from gm.amx
[debug] #2 native CallLocalFunction () from samp-server.exe
[debug] #3 000006b8 in public OnPlayerCommandText (0, 24069740) from gm.amx
I think I know the cause, and it's part
PHP код:
aVehicleNames[CarInfo[car][cModel]-400
And this is the command:
PHP код:
CMD:v(playeridparams[]) { 
    
ShowPlayerVehicle(playerid);
    return 
1;
}
stock ShowPlayerVehicle(playerid) {
    new 
szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
    if(
GetVehicles(playerid) == 0) return SendClientMessage(playeridCOLOR_GREY"You don't own any vehicles.");    
    
format(szTitlesizeof(szTitle), "Vehicles (%d/4)"GetVehicles(playerid));            
    for(new 
03i++) {
        if(
PlayerInfo[playerid][pCarKey][i] > 0) {
            new 
car =  PlayerInfo[playerid][pCarKey][i];
            if(
IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatussizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s"aVehicleNames[CarInfo[car][cModel]-400]);
            else if(
CarInfo[car][cSpawned] > 0format(vstatussizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s"aVehicleNames[CarInfo[car][cModel]-400]);
            else 
format(vstatussizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s"aVehicleNames[CarInfo[car][cModel]-400]);
            
format(szDialogsizeof(szDialog), "%s\n"vstatus);
            
strcat(szDialog2szDialog);
        }
        
ShowPlayerDialog(playeridDIALOG_GARAGEDIALOG_STYLE_LISTszTitleszDialog2"Ok""Exit");
    }
    return 
1;

Have a nice day!
Reply


Messages In This Thread
Help me with the error please - by Yuri8 - 03.07.2018, 09:36
Re: Help me with the error please - by Calisthenics - 03.07.2018, 09:50
Re: Help me with the error please - by Sew_Sumi - 03.07.2018, 11:44

Forum Jump:


Users browsing this thread: 1 Guest(s)