GetPlayerArmor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Changed "DeprecatedWithAlt" template to "Deprecated")
 
(7 intermediate revisions by 7 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
{{Server client function}}
{{Deprecated|getPedArmor|}}
 
This function returns a float that contains the current armor for the specified [[player]].
This function returns a float that contains the current armor for the specified [[player]].


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">float getPlayerArmor ( player player )</syntaxhighlight>
<syntaxhighlight lang="lua">float getPlayerArmor ( player thePlayer )</syntaxhighlight>


===Required Arguments===
===Required Arguments===
*'''player''': The [[player]] whose armor you want to check
*'''thePlayer:''' The [[player]] whose armor you want to check
 
===Returns===
A ''float'' with the armor, ''false'' if an invalid player was given.


==Example==
==Example==
<syntaxhighlight lang="lua">-- get health of 'someguy' and show it in the chat
This example defines a "showarmor" console command that shows the player that executes it how much armor he has.
tmpplayer = getPlayerFromNick ( "someguy" )
<section name="Client" class="client" show="true">
armor = getPlayerArmor ( tmpplayer )
<syntaxhighlight lang="lua">
outputChatBox ( "The player's armor is: " .. armor )</syntaxhighlight>
function showArmor ( )
local me = getLocalPlayer ( )
local armor = getPlayerArmor ( me )
outputChatBox( "Your armor: " .. armor, me )
end
addCommandHandler ( "showarmor", showArmor )
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}

Latest revision as of 16:14, 13 February 2015

Emblem-important.png This function is deprecated. This means that its use is discouraged and that it might not exist in future versions.

Please use getPedArmor instead.


This function returns a float that contains the current armor for the specified player.

Syntax

float getPlayerArmor ( player thePlayer )

Required Arguments

  • thePlayer: The player whose armor you want to check

Returns

A float with the armor, false if an invalid player was given.

Example

This example defines a "showarmor" console command that shows the player that executes it how much armor he has.

Click to collapse [-]
Client
function showArmor ( )
	local me = getLocalPlayer ( )
	local armor = getPlayerArmor ( me )
	outputChatBox( "Your armor: " .. armor, me )
end
addCommandHandler ( "showarmor", showArmor )

See Also