SetPedArmor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(New page: __NOTOC__ This function allows you to set the armor value of a ped. ==Syntax== <syntaxhighlight lang="lua">bool setPedArmor ( ped thePed, float armor )</syntaxhighlight> ===Required Arguments=== *'''thePed'''...)
 
mNo edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server function}}
This function allows you to set the armor value of a [[ped]].
This function allows you to set the armor value of a [[ped]].


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setPedArmor ( ped thePed, float armor )</syntaxhighlight>
<syntaxhighlight lang="lua">
bool setPedArmor ( ped thePed, float armor )
</syntaxhighlight>


===Required Arguments===
===Required Arguments===
Line 14: Line 17:
==Example==
==Example==
This example removes the armor of a player.
This example removes the armor of a player.
<syntaxhighlight lang="lua">function givePlayerArmor ( player, command )
<syntaxhighlight lang="lua">
function givePlayerArmor ( player, command )
setPedArmor ( player, 100 )    -- Set player's armor to 100 when he types the command 'addarmor'
setPedArmor ( player, 100 )    -- Set player's armor to 100 when he types the command 'addarmor'
end
end

Revision as of 20:32, 25 May 2008

This function allows you to set the armor value of a ped.

Syntax

bool setPedArmor ( ped thePed, float armor )

Required Arguments

  • thePed: the ped whose armor you want to modify.
  • armor: the amount of armor you want to set on the ped. Valid values are from 0 to 100.

Returns

Returns true if the armor was changed succesfully. Returns false if an invalid ped was specified, or the armor value specified is out of acceptable range.

Example

This example removes the armor of a player.

function givePlayerArmor ( player, command )
	setPedArmor ( player, 100 )    -- Set player's armor to 100 when he types the command 'addarmor'
end
addCommandHandler ( "addarmor", givePlayerArmor )

function removePlayerArmor ( player, command )
	setPedArmor ( player, 0 )      -- Set player's armor to 0 when he types the command 'removearmor'
end
addCommandHandler ( "removearmor", removePlayerArmor )

See Also