Player.GetWeapon

From GMod Wiki

Jump to: navigation, search
Function
Syntax Player:GetWeapon( String Weaponclassname )
Description:
Returns the Entity of the specified Weaponclass the player is carrying.
Returns: Weapon
In Object: Player
Realm: NewerServer.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Player.GetWeapon]Player.GetWeapon [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionThis will return the Entity object of the crowbar of player 1.
Used onNewerServer.png
Code
 
  Msg( player.GetByID(1):GetWeapon("weapon_crowbar") )
 
 
Output[NULL Entity]


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox