OnPlayerDeath

From SA-MP Wiki

Jump to: navigation, search

OnPlayerDeath


This callback is called when a player dies.


Parameters:
(playerid, killerid, reason)
playeridID of the player who died.
killeridID of the player who killed the player who died, or INVALID_PLAYER_ID if there was none.
reasonID of the reason for the player's death.


This function does not return a specific value, it's best to simply ignore it.


To use the standard death messages simply do:

public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason);
    return 1;
}
Important note: Contrary to popular belief you do not need the check to see if killerid is INVALID_PLAYER_ID before sending the message as if it is you just send INVALID_PLAYER_ID anyway, making the entire check pointless and redundant. However you will require this check before doing other things such as awarding money.


Related Callbacks

The following callbacks might be useful as well, as they're related to this callback in one way or another.


Related Functions

The following functions might be useful, as they're related to this callback in one way or another.

Personal tools