17.01.2015, 14:39
[18:14:40] [debug] Run time error 4: "Array index out of bounds"
[18:14:40] [debug] Accessing element at index 500 past array upper bound 499
[18:14:40] [debug] AMX backtrace:
[18:14:40] [debug] #0 00063278 in public cmd_respawncars (4, 18271080) from usf.amx
[18:14:40] [debug] #1 native CallLocalFunction () from samp03svr
[18:14:40] [debug] #2 0000622c in public OnPlayerCommandText (4, 1827102 from usf.amx
and the code is
Please help me
Thanks in advance
[18:14:40] [debug] Accessing element at index 500 past array upper bound 499
[18:14:40] [debug] AMX backtrace:
[18:14:40] [debug] #0 00063278 in public cmd_respawncars (4, 18271080) from usf.amx
[18:14:40] [debug] #1 native CallLocalFunction () from samp03svr
[18:14:40] [debug] #2 0000622c in public OnPlayerCommandText (4, 1827102 from usf.amx
and the code is
pawn Code:
CMD:respawncars(playerid,params[])
{
new string[145];
if (PlayerInfo[playerid][Admin] < 2) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!");
for(new i=0;i<MAX_VEHICLES;i++)
{
if(IsVehicleOccupied(i) == 0)
{
DestroyVehicle(PlayerInfo[i][pSpawnVehicle]);
SetVehicleToRespawn(i);
}
}
if(AdminHide[playerid] == 0)
{
format(string, sizeof(string), ""ADMINPINK"- USF - Administrator {%06x}%s(%d) "ADMINPINK"has respawned Unoccupied vehicles",(GetPlayerColor(playerid) >>> 8),GetName(playerid),playerid);
}
if(AdminHide[playerid] == 1)
{
format(string, sizeof(string), ""ADMINPINK"- USF - An Administrator "ADMINPINK"has respawned Unoccupied vehicles");
}
SendClientMessageToAll(-1, string);
return 1;
}
stock IsVehicleOccupied(vehicleid)
{
for(new i =0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i,vehicleid))
{
return 1;
}
}
return 0;
}
Thanks in advance