GetPlayerArmor: Difference between revisions

From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|__EDIT_ME__}} {{FuncSyntax|GetPlayerArmor(player)}} {{FuncParameters}} {{FuncParam|player|__EDIT_ME__}} {{FuncReturnValue|__..."
 
28days (talk | contribs)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Info|Function|Server|1.0}}
{{Info|Function|Server & Client|1.0}}


{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|Get the armor health of the specified player.}}


{{FuncSyntax|GetPlayerArmor(player)}}
{{FuncSyntax|GetPlayerArmor(player)}}
{{FuncSyntaxClient|GetPlayerArmor()}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|player|__EDIT_ME__}}
{{FuncParam|player|The player identifier.}}


{{FuncReturnValue|__EDIT_ME__}}
{{FuncReturnValue|The armor value.}}


== Example ==
== Example ==
__EDIT_ME__
<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}}
__EDIT_ME__
* [[SetPlayerArmor]]

Latest revision as of 15:50, 19 November 2019

GetPlayerArmor

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

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)

See also