SetPlayerHealth

From SA-MP Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 16:26, 9 July 2013
Drebin (Talk | contribs)
(These are not tips, they are notes.)
← Previous diff
Revision as of 21:36, 1 February 2014
Connor Mead (Talk | contribs)

Next diff →
Line 1: Line 1:
{{Scripting}} {{Scripting}}
-{{Title}} 
{{Description|Set the health level of a player.}} {{Description|Set the health level of a player.}}
Line 40: Line 39:
[[Category:Scripting_Functions]] [[Category:Scripting_Functions]]
-[[ru:SetPlayerHealth]] 
[[de:SetPlayerHealth]] [[de:SetPlayerHealth]]
 +[[fr:SetPlayerHealth]]
 +[[ru:SetPlayerHealth]]

Revision as of 21:36, 1 February 2014



Description:

Set the health level of a player.


Parameters:
(playerid, health)
playeridThe ID of the player to set the health of.
healthThe value to set the player's health to.


Return Values:

This function does not return any specific values.


//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;
}
Image:32px-Ambox_warning_orange.png

Notes

  • If a player's health is set to 0, or a minus value, they will die instantly.
  • If a player's health is below 10 or above 98303, their health bar will flash.


Related Functions

The following functions may be useful, as they are related to this function in one way or another.

In other languages