SetPlayerArmor: Difference between revisions
Jump to navigation
Jump to search
Black Dragon (talk | contribs) No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function allows you to set the armor value of a player | This function allows you to set the armor value of a [[player]]. | ||
==Syntax== | ==Syntax== | ||
Line 6: | Line 6: | ||
===Required Arguments=== | ===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=== | ||
Returns false if an invalid player is specified, or the armor value specified is out of acceptable range. | 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== | ==Example== | ||
<syntaxhighlight lang="lua"> | This example removes the armor of a player called someguy and tells them that it has. | ||
<syntaxhighlight lang="lua"> | |||
end</syntaxhighlight> | -- Find a player called 'someguy' | ||
someguy = findPlayer ( "someguy" ) | |||
-- If the player was found then | |||
if ( someguy ) then | |||
-- Set the player's armor to 0 | |||
if ( setPlayerArmor ( someguy, 0 ) ) then | |||
-- Tell the player you've removed their armor | |||
outputChatBox ( "Sorry someguy, no armor for you!", someguy ) | |||
end | |||
end | |||
</syntaxhighlight> |
Revision as of 17:15, 18 May 2006
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
This example removes the armor of a player called someguy and tells them that it has.
-- Find a player called 'someguy' someguy = findPlayer ( "someguy" ) -- If the player was found then if ( someguy ) then -- Set the player's armor to 0 if ( setPlayerArmor ( someguy, 0 ) ) then -- Tell the player you've removed their armor outputChatBox ( "Sorry someguy, no armor for you!", someguy ) end end