How to know which line?
#1

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

go on your script and check line 255
Reply
#3

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]++;
}
Reply
#4

I have this line:
PHP код:
SendDeathMessage(killerid,playerid,reason); 
without checking if killerid is invalid or not.
Reply
#5

Why you guys do those thing, when u even don't know basics...
Reply
#6

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

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

Post your OnPlayerDeath codes then.
Reply
#9

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
Post your OnPlayerDeath codes then.
It's too long and contains some secret stuffs.
Reply
#10

FIXED, thank you for your help.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)