OnPlayerDeath shows something with crashdetect
#1

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(killerid == playerid)
    {
        pInfo[playerid][Deaths]++;
    }
    else if(killerid == INVALID_PLAYER_ID)
    {
        pInfo[playerid][Deaths]++;
    }
    else
   
    GivePlayerMoney(killerid, 500);
    SetPlayerScore(killerid, GetPlayerScore(killerid)+10);

    SetPlayerScore(playerid, GetPlayerScore(playerid)-10);

    SendDeathMessage(killerid, playerid, reason);

    pInfo[killerid][Kills]++;
    pInfo[playerid][Deaths]++;
   
    return 1;
}
Код:
[19:33:48] [debug] Run time error 4: "Array index out of bounds"
[19:33:48] [debug]  Accessing element at index 65535 past array upper bound 499
[19:33:48] [debug] AMX backtrace:
[19:33:48] [debug] #0 000212b8 in public OnPlayerDeath () from gangwars.amx
[19:33:48] [death] MarkoN died 255
Reply
#2

This seems wrong
pawn Код:
if(killerid == playerid)
    {
        pInfo[playerid][Deaths]++;
    }
    else if(killerid == INVALID_PLAYER_ID)
    {
        pInfo[playerid][Deaths]++;
    }
}
Reply
#3

Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid)
    {
        pInfo[playerid][Deaths]++;
    }
Reply
#4

Quote:
Originally Posted by [Lexi]
Посмотреть сообщение
Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid)
    {
        pInfo[playerid][Deaths]++;
    }
Eh, that checks if a killer is the same person as the player who died, so it doesnt give the killer(player) +1 in kills

that couldove been done with killerid == INVALID_PLAYER_ID too
Reply
#5

Quote:
Originally Posted by [Lexi]
Посмотреть сообщение
Sorry to ask but what does this do ?
pawn Код:
if(killerid == playerid)
    {
        pInfo[playerid][Deaths]++;
    }
The script code looks like that when a player kills, that player's death rate also increases.

OT:
pawn Код:
public OnPlayerSpawn(playerid)
{
   GivePlayerMoney(playerid,-100);
   return 1;
} //Try this.
Reply
#6

Ok guys thanks i just wanted to know.
Reply
#7

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);

    if(killerid != INVALID_PLAYER_ID)
    {
        GivePlayerMoney(killerid, 500);
        SetPlayerScore(killerid, GetPlayerScore(killerid)+10);
        pInfo[killerid][Kills]++;
    }

    SetPlayerScore(playerid, GetPlayerScore(playerid)-10);
    pInfo[playerid][Deaths]++;
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)