SA-MP Forums Archive
[Debug] Amx BackTrace - 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: [Debug] Amx BackTrace (/showthread.php?tid=379430)



[Debug] Amx BackTrace - PryX0G3n - 21.09.2012

Hey guys!
What's this errors ?

Код:
[22:41:30] [debug] Run time error 4: "Array index out of bounds"
[22:41:30] [debug]  Accessing element at index 65535 past array upper bound 199
[22:41:30] [debug] AMX backtrace:
[22:41:31] [debug] #0 0014b6ec in public OnPlayerDeath () from Gamemode2.amx
[22:41:31] [death] Admin died 54
[22:41:53] [debug] Run time error 4: "Array index out of bounds"
[22:41:53] [debug]  Accessing element at index 65535 past array upper bound 199
[22:41:53] [debug] AMX backtrace:
[22:41:53] [debug] #0 0014b6ec in public OnPlayerDeath () from Gamemode2.amx
[22:41:53] [death] Admin died 255
[22:48:39] [debug] Run time error 4: "Array index out of bounds"
[22:48:40] [debug]  Accessing element at negative index -400
[22:48:40] [debug] AMX backtrace:
[22:48:41] [debug] #0 00160a74 in ?? () from Gamemode2.amx
[22:48:41] [debug] #1 0016098c in public CheckForChange () from Gamemode2.amx
[22:49:31] [debug] Run time error 4: "Array index out of bounds"
[22:49:31] [debug]  Accessing element at negative index -400
[22:49:31] [debug] AMX backtrace:
[22:49:31] [debug] #0 00160a74 in ?? () from Gamemode2.amx
[22:49:31] [debug] #1 0016098c in public CheckForChange () from Gamemode2.amx
Thanks in advance


Re: [Debug] Amx BackTrace - Jefff - 21.09.2012

http://forum.sa-mp.com/showthread.ph...ighlight=65535

and for -400 must be something array[GetVehicleModel(GetPlayerVehicleID(playerid))-400]

GetPlayerVehicleID = 0
GetVehicleModel = 0

0 - 400 = -400;

max array is more than -1

new array[MAX_VEHICLES]; // 0 - 1999


Re: [Debug] Amx BackTrace - CoDeZ - 21.09.2012

Well since you mentioned my topic
Instead of using a variable, use this:
pawn Код:
//under on player death
if(killerid!=INVALID_PLAYER_ID)
https://sampwiki.blast.hk/wiki/OnPlayerDeath
Important Note: You MUST check whether killerid equals INVALID_PLAYER_ID before using it in an array, as it will cause the script to stop. See example above.


Re: [Debug] Amx BackTrace - PryX0G3n - 22.09.2012

Thanks for reply!

But , this is my callback checkforchange, how to fix ?
Код:
public CheckForChange(playerid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != VehicleModel[playerid])
{
VehicleModel[playerid] = GetVehicleModel(GetPlayerVehicleID(playerid));
ShowGameTextForPlayer(playerid);
}

return 1;
}
edit: hmm, the problem disappeared, perhaps with onplayerdeath fixed.
however, the callback is right?