Garry's Mod Wiki

Revision Difference

Player:SetArmor#562765

<function name="SetArmor" parent="Player" type="classfunc"> <description>Sets the player armor to the argument. (Not working as intended, when calling the pl:Armor() function seems to return health)</description>⤶ <description>Sets the player armor to the argument.⤶ <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 they types "SetArmor" at the console.</description> <code> concommand.Add( "SetArmor", function( ply ) ply:SetArmor( 100 ) end ) </code> <output>Sets the player armor to 100</output> </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>