Fall Damage not calling OnPlayerDeath
#1

As the title says, fall damage isnt calling the OnPlayerDeath function. I think it has something to do with OnPlayerTakeDamage, but I can't figure it out.

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    //Reseting hunger/thirst values.
    pInfo[playerid][pHunger] = 100;
    pInfo[playerid][pThirst] = 100;

    UpdateBars(playerid);
    KillTimer(TIMER_HUNGER[playerid]);
    KillTimer(TIMER_THIRST[playerid]);

    //Kills/deaths.
    pInfo[killerid][pKills] ++;
    pInfo[playerid][pDeaths] ++;

    //Re-attaching their backpack.
    TIMER_BACKPACKEQUIP[playerid] = SetTimerEx("BackpackEquip", 5000, false, "i", playerid);

    PlayerSpawned[playerid] = false;

    if(PlayerIsInLobby[playerid] == false && GameJoin == false ) //in a game.
    {
        PlayersLeft --; //Decrement by one.
        new string[128];
        format(string,sizeof(string), "%s has been eliminated from the Hunger Games. Players remaining: %d", GetName(playerid), PlayersLeft);
        SCMA(COLOR_GREY, string);
        if(PlayersLeft == 1) //If they are the last player remaining.
        {
            TIMER_WIN = SetTimer("WinRound", WIN_TIME, false);
            return 1;
        }
        if(PlayersLeft == 0)
        {
            KillTimer(TIMER_WIN);
            SCMA(COLOR_GREEN, "There are no remaining tributes to recieve a reward.");
            TIMER_ENDTIMER = SetTimer("EndRound", 5000, false);
            return 1;
        }
    }
    return 1;
}


public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid)
{
    if(PlayerIsInLobby[playerid] == true) //in lobby
    {
        if(TDMTeam[issuerid] == TDMTeam[playerid] && playerid != issuerid) return 0; //cant shoot team mates
    }
    return 1;
}
Reply
#2

You have written "fall damage" not "fall death"
OnPlayerDeath is only for when player dies not for player damage...
And if mean player death on fall then put this in OnPlayerDeath to see if it really called or not..
printf("[DEBUG] OnPlayerDeath Called || PlayerId : %i Reason ; %i", playerid, reason);
Reply
#3

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
You have written "fall damage" not "fall death"
OnPlayerDeath is only for when player dies not for player damage...
And if mean player death on fall then put this in OnPlayerDeath to see if it really called or not..
printf("[DEBUG] OnPlayerDeath Called || PlayerId : %i Reason ; %i", playerid, reason);
Yup, it was calling, but getting stuck when it tried to pass INVALID_PLAYER_ID in pInfo[killerid][pKills]. Fixed, +rep.

EDIT: given rep recently.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)