SetPlayerArmor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 13: Line 13:


==Example==
==Example==
<section name="Server" class="server" show="true">
This example removes the armor of a player.
This example removes the armor of a player.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
Line 20: Line 21:


addCommandHandler ( "armoroff", armoroff )
addCommandHandler ( "armoroff", armoroff )
</syntaxhighlight>
</syntaxhighlight> </section>


==See Also==
==See Also==
{{Player functions}}
{{Player functions}}
{{Server function}}

Revision as of 23:11, 14 August 2007

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

Syntax

bool setPlayerArmor ( player thePlayer, float playerArmor )

Required Arguments

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

Returns

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

Example

Click to collapse [-]
Server

This example removes the armor of a player.

function armoroff ( player, command )
setPlayerArmor ( player, getPlayerArmor(player) - 100 )
 end

addCommandHandler ( "armoroff", armoroff )

See Also