GetPlayerArmor: Difference between revisions
From Onset Developer Wiki
X7airworker (talk | contribs) Documented parameters, return value and added realtedFunction |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server & Client|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|Get the armor health of the specified player.}} | ||
{{FuncSyntax|GetPlayerArmor(player)}} | {{FuncSyntax|GetPlayerArmor(player)}} | ||
{{FuncSyntaxClient|GetPlayerArmor()}} | |||
{{FuncParameters}} | {{FuncParameters}} | ||
Line 11: | Line 12: | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua> | |||
AddCommand("armor", function(playerid) | |||
if GetPlayerArmor(playerid) < 30.0 then | |||
SetPlayerArmor(playerid, 100.0) | |||
else | |||
AddPlayerChat(playerid, "You have enough armor.") | |||
end | |||
end) | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
[[SetPlayerArmor]] | * [[SetPlayerArmor]] |
Latest revision as of 15:50, 19 November 2019
Description
Get the armor health of the specified player.
Syntax
GetPlayerArmor(player)
Client Syntax
GetPlayerArmor()
Parameters
- player
The player identifier.
Return Value
- The armor value.
Example
AddCommand("armor", function(playerid)
if GetPlayerArmor(playerid) < 30.0 then
SetPlayerArmor(playerid, 100.0)
else
AddPlayerChat(playerid, "You have enough armor.")
end
end)