Run time error 4: "Array index out of bounds"
#5

What the others meant was, on the Line number:> 13966 inside gtrg.pwn, you are trying to access an Array Slot (65535) which exceed the mentioned array size..
If a player dies due to his carelessness / fault(Suicide), the killerid in OnPlayerDeath(playerid, killerid, reason), will be INVALID_PLAYER_ID(65535)..
For instance when you have a script to increase the kill count of a player, you must do
PHP Code:
public OnPlayerDeath(playeridkilleridreason)
{
    if(
killerid != INVALID_PLAYER_ID) { //This will make sure there is no array out of bound due to INVALID_PLAYER_ID
        
Player_Stats[killerid]++;
    }
    
Player_Stats[playerid]++;

Rep+ goes to the above guys who helped. I just rephrased their words.
Reply


Messages In This Thread
Run time error 4: "Array index out of bounds" - by t9ndep - 13.02.2017, 11:17
Re: Run time error 4: "Array index out of bounds" - by SyS - 13.02.2017, 11:21
Re: Run time error 4: "Array index out of bounds" - by JesterlJoker - 13.02.2017, 14:49
Re: Run time error 4: "Array index out of bounds" - by Dayrion - 13.02.2017, 14:51
Re: Run time error 4: "Array index out of bounds" - by Mic_H - 13.02.2017, 15:00
Re: Run time error 4: "Array index out of bounds" - by ISmokezU - 13.02.2017, 15:03
Re: Run time error 4: "Array index out of bounds" - by JesterlJoker - 13.02.2017, 15:34
Re: Run time error 4: "Array index out of bounds" - by t9ndep - 14.02.2017, 12:19

Forum Jump:


Users browsing this thread: 1 Guest(s)