GetPedArmor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ {{Client function}} This function returns the current armor of the specified ped. ==Syntax== <syntaxhighlight lang="lua">float getPedArmor ( ped thePed )</syntaxhighlight> ===Required Arguments=== *...)
 
No edit summary
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Server client function}}
This function returns the current armor of the specified [[ped]].
This function returns the current armor of the specified [[ped]].


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">float getPedArmor ( ped thePed )</syntaxhighlight>
<syntaxhighlight lang="lua">float getPedArmor ( ped thePed )</syntaxhighlight>
{{OOP||[[ped]]:getArmor|armor|setPedArmor}}


===Required Arguments===
===Required Arguments===
Line 13: Line 14:


==Example==
==Example==
<section name="Client" class="client" show="true">
This example defines a "showarmor" console command that shows the player that executes it how much armor he has.
This example defines a "showarmor" console command that shows the player that executes it how much armor he has.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function showArmor ( )
function showArmor ( )
local me = getLocalPlayer ( )
local armor = getPedArmor ( localPlayer )
local armor = getPedArmor ( me )
outputChatBox( "Your armor: " .. armor )
outputChatBox( "Your armor: " .. armor )
end
end
addCommandHandler ( "showarmor", showArmor )
addCommandHandler ( "showarmor", showArmor )
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Client_ped_functions}}
{{Ped functions}}
 
[[hu:getPedArmor]]

Latest revision as of 16:33, 3 August 2020

This function returns the current armor of the specified ped.

Syntax

float getPedArmor ( ped thePed )

OOP Syntax Help! I don't understand this!

Method: ped:getArmor(...)
Variable: .armor
Counterpart: setPedArmor


Required Arguments

  • thePed: The ped whose armor you want to check

Returns

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

Example

Click to collapse [-]
Client

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

function showArmor ( )
	local armor = getPedArmor ( localPlayer )
	outputChatBox( "Your armor: " .. armor )
end
addCommandHandler ( "showarmor", showArmor )

See Also