help with OnPlayerDeath
#7

Well, I do believe that you got these debug errors when you tested this code with only yourself (No killerid. You just died without being killed by anyone) so your check was like this:

pawn Код:
// the killerid is not connected. playerid died without being killed by anyone
if(NormalKill[INVALID_PLAYER_ID] == 1) // INVALID_PLAYER_ID = 0xFFFF which are the same as 65535
// and 65535 is obviously out of bounds since your MAX_PLAYERS is defined as 500 (or less)
{

}
Thus the debug errors came up.
Код:
[16:53:47] [debug] Run time error 4: "Array index out of bounds"
[16:53:47] [debug]  Accessing element at index 65535 past array upper bound 499
Here's a tip: When you deal with OnPlayerDeath, remember to always check whether killerid is connected or not before doing ANYTHING to it because a player can die without being killed and OnPlayerDeath gets called.

Works:
pawn Код:
if(IsPlayerConnected(killerid))
{
    if(NormalKill[killerid] == 1)
    {
        // Code
    }
}
Reply


Messages In This Thread
help with OnPlayerDeath - by CoDeZ - 28.07.2012, 14:47
Re: help with OnPlayerDeath - by BlackWolf120 - 28.07.2012, 15:18
Re: help with OnPlayerDeath - by CoDeZ - 28.07.2012, 15:22
Re: help with OnPlayerDeath - by Rudy_ - 28.07.2012, 15:51
Re : help with OnPlayerDeath - by lelemaster - 28.07.2012, 15:54
Re: help with OnPlayerDeath - by CoDeZ - 28.07.2012, 15:54
Re: help with OnPlayerDeath - by [KHK]Khalid - 28.07.2012, 18:50
Re: help with OnPlayerDeath - by CoDeZ - 28.07.2012, 18:51
Re: help with OnPlayerDeath - by SuperViper - 28.07.2012, 19:41

Forum Jump:


Users browsing this thread: 3 Guest(s)