GetPlayerHealth

From Onset Developer Wiki
Revision as of 10:06, 19 November 2019 by 28days (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
GetPlayerHealth

Type: Function
Context: Server & Client
Introduced: v1.0

Description

Get the specified player's health.

Syntax

GetPlayerHealth(player)
Client Syntax
GetPlayerHealth()

Parameters

  • player
    The player identifier.

Return Value

  • Returns the player's health in floating point number.

Example

AddCommand("heal", function(playerid)
	if GetPlayerHealth(playerid) < 30.0 then
		SetPlayerHealth(playerid, 100.0)
	else
		AddPlayerChat(playerid, "You have enough health.")
	end
end)

See also