SetPlayerArmor: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
==Description==
This function allows you to set the armor value of a player. This function will return false if an invalid player is specified, or the armor value specified is out of acceptable range.
This function allows you to set the armor value of a player. This function will return false if an invalid player is specified, or the armor value specified is out of acceptable range.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">bool setPlayerArmor ( player thePlayer, float playerArmor )</syntaxhighlight>


bool [[setPlayerArmor]] ( [[player]] player, float armor )
===Required Arguments===
*'''player''': the [[player]] whose armor you want to modify.
*'''armor''': the amount of armor you want to set on the player. Valid values are from 0 to 100.


===Required Arguments===
===Returns===
*'''player''': the [[player]] whose armor you want to modify
Returns false if an invalid player is specified, or the armor value specified is out of acceptable range.
*'''armor''': the amount of armor you want to set on the player. Valid values are from 0 to 100


==Example==
==Example==
if ( [[setPlayerArmor]] ( [[findPlayer]] ( "SomeGuy" ), 0 ) ) then
<syntaxhighlight lang="lua">if ( setPlayerArmor ( findPlayer ( "SomeGuy" ), 0 ) ) then
  [[serverChat]] ( "Sorry Someguy, no armor for you! " )
    outputChatBox ( "Sorry Someguy, no armor for you! ", player )
end
end</syntaxhighlight>

Revision as of 17:09, 18 May 2006

This function allows you to set the armor value of a player. This function will return false if an invalid player is specified, or the armor value specified is out of acceptable range.

Syntax

bool setPlayerArmor ( player thePlayer, float playerArmor )

Required Arguments

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

Returns

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

Example

if ( setPlayerArmor ( findPlayer ( "SomeGuy" ), 0 ) ) then
    outputChatBox ( "Sorry Someguy, no armor for you! ", player )
end