GetPlayerHealth
From SA-MP
[edit]
GetPlayerHealth
The function GetPlayerHealth allows you to retrieve the health of a player. Useful for cheat detection, among other things.
[edit]
Parameters:
(playerid, health)
| playerid | The ID of the player. |
| health | Value where the health is retrieved. |
// Sets players health to 50 if it was lower then // 50 before, as soon as he typed /doctor public OnPlayerCommandText(playerid,text[]) { if(strcmp(text, "/doctor", true) { new Float:health; GetPlayerHealth(playerid,health); if (health < 50.0) { SetPlayerHealth(playerid, 50.0); } } }
[edit]
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- SetPlayerHealth: Sets the amount of health of a player.
