03.07.2018, 09:36
When I type /v to view my vehicle garage I get this error:
I think I know the cause, and it's part
And this is the command:
Have a nice day!
Код 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
PHP код:
aVehicleNames[CarInfo[car][cModel]-400]
PHP код:
CMD:v(playerid, params[]) {
ShowPlayerVehicle(playerid);
return 1;
}
stock ShowPlayerVehicle(playerid) {
new szTitle[180], szDialog[1300], szDialog2[1300], vstatus[1024];
if(GetVehicles(playerid) == 0) return SendClientMessage(playerid, COLOR_GREY, "You don't own any vehicles.");
format(szTitle, sizeof(szTitle), "Vehicles (%d/4)", GetVehicles(playerid));
for(new i = 0; i < 3; i++) {
if(PlayerInfo[playerid][pCarKey][i] > 0) {
new car = PlayerInfo[playerid][pCarKey][i];
if(IsVehicleOccupied(CarInfo[car][cSpawned])) format(vstatus, sizeof(vstatus), "{FFFF00}(Occupied){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
else if(CarInfo[car][cSpawned] > 0) format(vstatus, sizeof(vstatus), "{26B309}(Spawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
else format(vstatus, sizeof(vstatus), "{FF0000}(Despawned){FFFFFF} %s", aVehicleNames[CarInfo[car][cModel]-400]);
format(szDialog, sizeof(szDialog), "%s\n", vstatus);
strcat(szDialog2, szDialog);
}
ShowPlayerDialog(playerid, DIALOG_GARAGE, DIALOG_STYLE_LIST, szTitle, szDialog2, "Ok", "Exit");
}
return 1;
}