Garry's Mod Wiki

Player:SetArmor

  Player:SetArmor( number amount )

Description

Sets the player armor value.

See GM:HandlePlayerArmorReduction for a hook that allows manipulating what armor does.

Arguments

1 number amount
The amount to set the armor value of the player to.

Example

Sets the player armor to 100 when they types "SetArmor" at the console.

concommand.Add( "SetArmor", function( ply ) ply:SetArmor( 100 ) end )
Output: Sets the player armor to 100

Example

Gives the player armor to first vararg when they types "AddArmor" at the console.

concommand.Add( "AddArmor", function( ply, cmd, args ) local Armor = args[1] or 100 ply:SetArmor( ply:Armor() + Armor ) end )
Output: Adds the player armor to first vararg