[HELP] Run time error 4
#1

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.
Reply
#2

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

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.
Reply
#4

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
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)