WEAPON:CanPrimaryAttack

From Garry's Mod
Jump to: navigation, search
 WEAPON:CanPrimaryAttack( )

Contents

Description

Helper function for checking for no ammo.

Returns

boolean

Can use primary attack

Examples

Example

As defined in weapon_base

function SWEP:CanPrimaryAttack()

	if ( self.Weapon:Clip1() <= 0 ) then
	
		self:EmitSound( "Weapon_Pistol.Empty" )
		self:SetNextPrimaryFire( CurTime() + 0.2 )
		self:Reload()
		return false
		
	end

	return true

end


Personal tools
Navigation