Run time error 4 " array index out of bounds "
#4

Try this:

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        ZombieTeam(playerid);
        pInfo[killerid][Kills]++;
        
        if(pInfo[killerid][Human] == 1)
        {
            if(pInfo[playerid][Human] == 1)
            {
                new str[100];
                format(str, sizeof(str),"[LOG]: %s has been killed by %s",GetName(playerid), GetName(killerid));
                ResetPlayerWeapons(playerid);
                SendAdminsMessage(1, -1, str);
                ZombieTeam(playerid);
                printf("[LOG]: %s has been killed by %s",GetName(playerid), GetName(killerid));
            }
            else if(pInfo[playerid][Zombie] == 1)
            {
                pInfo[killerid][Tokens] += 250;
            }
        }
    }
    return 1;
}
P.S:

- You were adding the kills to the one died not the killer.
- You don't need to check if the one died is connected, should do for the killer only.
Reply


Messages In This Thread
Run time error 4 " array index out of bounds " - by Stones - 02.06.2017, 22:22
Re: Run time error 4 " array index out of bounds " - by Variable™ - 02.06.2017, 22:25
Re: Run time error 4 " array index out of bounds " - by Stones - 02.06.2017, 22:31
Re: Run time error 4 " array index out of bounds " - by Variable™ - 02.06.2017, 22:33

Forum Jump:


Users browsing this thread: 1 Guest(s)