Player.GetWeapons

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:GetWeapons( )
Description:
Returns a table of weapons that the player is holding.
Returns: Table :Weapon
In Object: Player
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.GetWeapons]Player.GetWeapons [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionLoop through a player's weapons and print the name of each weapon.
Used onNewerShared.png
Code
for k, v in pairs(ply:GetWeapons()) do
       ply:PrintMessage( HUD_PRINTTALK, v:GetPrintName( ) )
end
OutputPrints a list of all the weapons ply has.


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox