Player.GetWeapon
From GMod Wiki
| Function | |
| Syntax | Player:GetWeapon( String Weaponclassname ) |
| Description: | |
| Returns the Entity of the specified Weaponclass the player is carrying. | |
| Returns: | Weapon |
| In Object: | Player |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.GetWeapon]Player.GetWeapon [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Example
| Description | This will return the Entity object of the crowbar of player 1. |
|---|---|
| Used on | |
| Code | Msg( player.GetByID(1):GetWeapon("weapon_crowbar") ) |
| Output | [NULL Entity] |
Additional Notes
- Returns a NULL Entity if the player doesn't have the weapon specified.