Garry's Mod Wiki

Revision Difference

Player:SetArmor#527151

<function name="SetArmor" parent="Player" type="classfunc"> <description>Sets the player armor to the argument.</description> <realm>Server</realm> <args> <arg name="Amount" type="number">The amount that the player armor is going to be set to.</arg> </args> </function> <example> <description>Sets the player armor to 100 when he types "GiveArmor" at the console.</description> <description>Sets the player armor to 100 when they types "SetArmor" at the console.</description> <code> concommand.Add( "GiveArmor", function( ply ) concommand.Add( "SetArmor", function( ply ) ply:SetArmor( 100 ) end ) </code> <output>Sets the player armor to 100</output> ⤶ </example></example>⤶ ⤶ <example>⤶ <description>Gives the player armor to first vararg when they types "AddArmor" at the console.</description>⤶ <code>⤶ concommand.Add( "GiveArmor", function( ply, cmd, args )⤶ local Armor = args[1] or 100⤶ ply:SetArmor( ply:Armor() + Armor )⤶ end )⤶ </code>⤶ <output>Adds the player armor to first vararg</output>⤶ </example>