SetPlayerHealth
From SA-MP Wiki
Set the health level of a player.
(playerid, health)
| playerid | The ID of the player to set the health of. |
| health | The value to set the player's health to. |
| Returns | This function doesn't return a specific value |
//Sets the players health to full public OnPlayerCommandText(playerid, cmdtext[]) { if(!strcmp("/heal", cmdtext, true)) { SetPlayerHealth(playerid, 100); return 1; } if(!strcmp("/kill", cmdtext, true)) { SetPlayerHealth(playerid, 0); return 1; } return 0; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerHealth: Find out how much health a player has.
- GetPlayerArmour: Find out how much armour a player has.
- SetPlayerArmour: Set the armour of a player.
