OnPlayerDeath
From SA-MP Wiki
OnPlayerDeath
This callback is called when a player dies.
(playerid, killerid, reason)
| playerid | ID of the player who died. |
| killerid | ID of the player who killed the player who died, or INVALID_PLAYER_ID if there was none. |
| reason | ID 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.
- OnPlayerSpawn: Called when a player spawns.
Related Functions
The following functions might be useful, as they're related to this callback in one way or another.
- SendDeathMessage: Add a kill to the death list.
