GetPlayerHealth
Description:
Function GetPlayerHealth allows you to retrieve the health of a player. Useful for cheat detection, among other things.
|
Parameters:
(playerid, &Float:health)
int | playerid | The ID of the player. |
float | health | Float to store health, passed by reference. |
Return Values:
- 1 - success
- 0 - failure (i.e. player not connected).
Examples:
// Sets players health to 50 if it was lower than // 50 before, as soon as he typed /doctor if(strcmp(cmdtext, "/doctor", true) == 0) { new Float:health; GetPlayerHealth(playerid,health); if (health < 50.0) { SetPlayerHealth(playerid, 50.0); } return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- SetPlayerHealth: Set a player's health.
- GetVehicleHealth: Check the health of a vehicle.
- GetPlayerArmour: Find out how much armour a player has.