SA-MP Forums Archive
[HELP] Run time error 4 - 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: [HELP] Run time error 4 (/showthread.php?tid=334887)



[HELP] Run time error 4 - sidney123 - 16.04.2012

Hello guys,

I made a DM server and my scripting basics are good, but I'm not a professional.
Okay, so I made my server and I use Zadmin4.0 FS from [ZFM]Zuc.

Now when I die or someone else die, the server crashes and it leaves me the following error:
Код:
[15:44:23] [debug] [Zadmin4.0.amx]: During execution of OnPlayerDeath():
[15:44:23] [debug] [Zadmin4.0.amx]: Run time error 4: "Array index out of bounds"
[15:44:23] [debug] [Zadmin4.0.amx]:   Array max. index is 31 but accessing an element at 65535
[15:44:23] [debug] [Zadmin4.0.amx]: Call stack (most recent call first):
[15:44:23] [debug] The server has crashed executing 'Zadmin4.0.amx'
[15:44:23] [debug] [Zadmin4.0.amx]: Call stack (most recent call first):
[15:44:23] [debug] The server has crashed executing 'Zadmin4.0.amx'
[15:44:23] [debug] [Zadmin4.0.amx]: Call stack (most recent call first):
This is my OnPlayerDeath() function in Zadmin4.0:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason){
  Account[killerid][pKills]++;
  Account[playerid][pDeaths]++;
  return 1;}
This is my OnPlayerDeath() function in my gamemode:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    ResetPlayerWeapons(playerid);
    SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
    SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
    return 1;
}
I can't find the problem or anything what causes the bug.


Re: [HELP] Run time error 4 - sidney123 - 19.04.2012

No-one who can helps me? I have WORLD BOUNDS in my server, maybe that causes this error?


Re: [HELP] Run time error 4 - Jonny5 - 19.04.2012

it means your accessing an array that is out of bounds

Array max. index is 31 but accessing an element at 65535

your Array is defined like so Array[31]
but your trying to access it like Array[65535]


now why its doing that I dont know without seeing more code,
but it has nothing todo with world bounds, atleast not that i can see.


Re: [HELP] Run time error 4 - legodude - 19.04.2012

killerid can be INVALID PLAYERID wich is 0xFFFF wich is 65535
and your maxplayers is 31 probably..
you need to add a check for invalid playerid's


Re: [HELP] Run time error 4 - sidney123 - 20.04.2012

Quote:
Originally Posted by legodude
Посмотреть сообщение
killerid can be INVALID PLAYERID wich is 0xFFFF wich is 65535
and your maxplayers is 31 probably..
you need to add a check for invalid playerid's
That must be the problem, I am going to search on the forum how to make that.
Thanks for your answers guys!