SetPlayerHealth

From SA-MP Wiki

Jump to: navigation, search

SetPlayerHealth


The function SetPlayerHealth allows you to set the health level of a player.


Parameters:
(playerid, health)
playeridThe ID of the player.
healthNew amount of health the player will have.


This function does not 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 might be useful as well, as they're related to this function in one way or another.

Personal tools
In other languages