How to know which line? -
ATGOggy - 26.01.2015
[quote][19:14:01] [debug] Run time error 4: "Array index out of bounds"
[19:14:01] [debug] Accessing element at index 65535 past array upper bound 499
[19:14:01] [debug] AMX backtrace:
[19:14:01] [debug] #0 0003e1d4 in ?? (0, 65535, 255) from SARCR.amx
[19:14:01] [debug] #1 00007910 in public OnPlayerDeath (0, 65535, 255) from SARCR.amx[/php]
This is the code that was print in in my console, server didn't crash.
How to know which line is having this error, because I have so much code in OnPlayerDeath
Re: How to know which line? -
vassilis - 26.01.2015
go on your script and check line 255
Re: How to know which line? -
Lordzy - 26.01.2015
Quote:
Originally Posted by vassilis
go on your script and check line 255
|
255 was the death reason, not the line.
OT:
The crash is caused due to an index higher than 499 used under OnPlayerDeath. This frequently occurs when "killerid" is used as any array index without checking if it's equal to INVALID_PLAYER_ID or not. Ensure that "killerid" is checked before letting it access an array.
pawn Код:
//Example
if(killerid != INVALID_PLAYER_ID) //If killerid is not equal to INVALID_PLAYER_ID(65535)
{
p_Kills[killerid]++;
}
Re: How to know which line? -
ATGOggy - 26.01.2015
I have this line:
PHP код:
SendDeathMessage(killerid,playerid,reason);
without checking if killerid is invalid or not.
Re: How to know which line? -
muzammilfreeman - 26.01.2015
Why you guys do those thing, when u even don't know basics...
Re: How to know which line? -
Lordzy - 26.01.2015
Quote:
Originally Posted by ATGOggy
I have this line:
PHP код:
SendDeathMessage(killerid,playerid,reason);
without checking if killerid is invalid or not.
|
It's okay to use this function with killerid being INVALID_PLAYER_ID. That's not what the cause of crash is though, it says that an array's index has gone higher than 499 somewhere under your OnPlayerDeath.
Re: How to know which line? -
ATGOggy - 26.01.2015
Quote:
Originally Posted by Lordzy
It's okay to use this function with killerid being INVALID_PLAYER_ID. That's not what the cause of crash is though, it says that an array's index has gone higher than 499 somewhere under your OnPlayerDeath.
|
This shows in console only when players suicide
Re: How to know which line? -
Lordzy - 26.01.2015
Post your OnPlayerDeath codes then.
Re: How to know which line? -
ATGOggy - 26.01.2015
Quote:
Originally Posted by Lordzy
Post your OnPlayerDeath codes then.
|
It's too long and contains some secret stuffs.
Re: How to know which line? -
ATGOggy - 26.01.2015
FIXED, thank you for your help.