Entity.IsWeapon

From GMod Wiki

(Redirected from Player.IsWeapon)
Jump to: navigation, search
Function
Syntax Entity:IsWeapon( )
Description:
Returns true if the entity is a weapon.
Returns: Boolean
In Object: Entity
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.IsWeapon]Entity.IsWeapon [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCheck if a player has a weapon out by using entity:IsWeapon.
Used onNewerShared.png
Code
function WeaponCheck( player )
      // returns true if the player has a weapon out
	return ( player:GetActiveWeapon():IsValid() && player:GetActiveWeapon():IsWeapon() )
end
OutputBoolean value: true if player has a weapon out, false if they don't.


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox