Player.Armor

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:Armor( )
Description:
Retrieves the amount of armor the player has
Returns: Number
In Object: Player
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.Armor]Player.Armor [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionDraw the armor amount on the top of the HUD.
Used onNewerClient.png
Code
 
function DrawPlayerArmor()
          if (LocalPlayer():Armor() > 0) then
             draw.RoundedBox( 8, 32, 16, ScrW() - 64, 16, Color(200, 200, 200, 200));
             draw.RoundedBox( 8, 34, 18, (ScrW() - 68)*(LocalPlayer():Armor() / 1000), 12, Color(0, 0, 200, 200));
          end
end
hook.Add("HUDPaint","drawplayerarmor",DrawPlayerArmor);
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox