• Regenerative Ammo in a clip
    3 replies, posted
I am trying to make a laser and what i want to have it do is to fire until it runs out of ammo while having the ammo in the clip keep regenerating. Any ideas?
What do you mean, if the weapon has ammo to start with then regenerate X ammo per second? Anyway, you're going to want to use the following links most likely, if you explain more I'll be able to help you. [url]http://wiki.garrysmod.com/?title=Giveammo[/url] [url]http://wiki.garrysmod.com/?title=Timer[/url]
k this is what i have now but i keep getting an error. timer.Create("MyTimer", 1, 0, Ammo ) timer.Start("MyTimer") function() Ammo self:GiveAmmo(1,"pistol") end
Uhh you should learn the basic syntax of Lua first. Call the following function once upon player initial spawn. [lua] function ReAmmo(ply,cmd,arg) if(ply:IsValid()) then ply:GiveAmmo(1,"pistol") end timer.Create(ply:Nick().."RegenAmmo", 1, 1, ReAmmo, ply ) end [/lua]
Sorry, you need to Log In to post a reply to this thread.