SWEP.TakeSecondaryAmmo

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameTakeSecondaryAmmo
SyntaxSWEP:TakeSecondaryAmmo( Integer num )
DescriptionTakes desired ammo from player's secondary ammo.
ReturnsNil
Lua StateNewerShared.png
BBCode[b][url=wiki.garrysmod.com/?title=SWEP.TakeSecondaryAmmo]SWEP.TakeSecondaryAmmo [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Definition of the function

Because it is a convenience function, it is defined by the game.

function SWEP:TakeSecondaryAmmo( num )
 
	// Doesn't use clips
	if ( self:Clip2() <= 0 ) then 
 
		if ( self:Ammo2() <= 0 ) then return end
 
		self.Owner:RemoveAmmo( num, self:GetSecondaryAmmoType() )
 
	return end
 
	self:SetClip2( self:Clip2() - num )	
 
end

Examples

DescriptionN/A
Used onNewerMissing.png
Code
LuaIco3.pngThis page needs an example to demonstrate the item detailed on this page. See how to make one here.
See more articles that need examples here.
OutputN/A


Additiona Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox