crash problem fix - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: crash problem fix (
/showthread.php?tid=324955)
crash problem fix -
speed258 - 11.03.2012
how fix that? [15:27:29]: Script[gamemodes\Life.amx]: During execution of removcar():
[15:27:29]: Script[gamemodes\Life.amx]: Run time error 4: "Array index out of bounds"
[15:27:29]: Additional information:
[15:27:29]: Array max index is 79 but accessing an element at -1
script
Код:
forward removcar(playerid);
public removcar(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
TogglePlayerControllable(playerid,1);
SetVehicleParamsForAll(Buylist[Spectating[playerid][0]][Carid],0,0);
Spectating[playerid][0]=90;
SetVehicleToRespawn(vehicleid);
RemovePlayerFromVehicle(playerid);
return 1;
}
and one this script system
Код:
SetTimerEx("removcar",10000,0,"i",playerid);
so how fix that?
Re: crash problem fix -
speed258 - 11.03.2012
any ideas?
Re: crash problem fix -
eesh - 11.03.2012
pawn Код:
forward removcar(playerid);
public removcar(playerid)
{
new vehicleid = GetPlayerVehicleID(playerid);
TogglePlayerControllable(playerid,1);
if(Spectating[playerid][0] < 0) return 1;
if(Carid < 0) return 1;
SetVehicleParamsForAll(Buylist[Spectating[playerid][0]][Carid],0,0);
Spectating[playerid][0]=90;
SetVehicleToRespawn(vehicleid);
RemovePlayerFromVehicle(playerid);
return 1;
}
I dont know which var of yours has size 80 so i just placed 2 checks.