Weapon.SetClip1

From GMod Wiki

Jump to: navigation, search


Function
Syntax Weapon:SetClip1( Integer bullets )
Description:
Sets the number of bullets in the primary clip.
Returns: nil
In Object: Weapon
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Weapon.SetClip1]Weapon.SetClip1 [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionIf put in your SWEP, this will add 10 bullets in your clip every 5 seconds
Used onNewerShared.png
Code
 
 
function SWEP:Initialize()
    -- other init code goes here
 
    self.NextAddBullets = 0
end
 
function SWEP:Think()
     if( CurTime() >= self.NextAddBullets ) then // Checks if the proper amount of time has passed
          self:SetClip1( self:Clip1() + 10 ) // Adds 10 bullets to the primary clip
          self.NextAddBullets = CurTime() + 5.0 // Sets the time for the next Think
     end
end
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox