• Weapon Reload Isuse
    3 replies, posted
Issue* Hello guys, well this is like my 3rd post i guess? haha :C im wondering if someone can help me to figure this out ? [code] timer.Simple(reloadtime, function() if self then self.Reloading = false if self.Primary.ClipSize < self.Owner:GetAmmoCount(self.Primary.Ammo) then local old_clip = self:Clip1() self:SetClip1(self.Primary.ClipSize) self.Owner:SetAmmo(self.Owner:GetAmmoCount(self.Primary.Ammo) - self.Primary.ClipSize + old_clip, self.Primary.Ammo) else self:SetClip1(self.Owner:GetAmmoCount(self.Primary.Ammo)) self.Owner:SetAmmo(0, self.Primary.Ammo) end end end) [/code] After you reload sets your ( Clip ( the one you don't shoot ) to 0, instead of for example if i have: Default: 20 bullets, i shoot 3 bullets and i have a clip of 20 it doesnt fit 20-(17) if does 20-0 Sorry for the weird explanation, Thanks =C
self.Owner:SetAmmo(0, self.Primary.Ammo) You are setting the ammo to 0 here.
Trying to figure out how to set this self.Owner:SetAmmo(0, self.Primary.Ammo) as the LEFT ammo .... i've been looking for alot of weapon_base's but none of them show how to do that, any help with that part of the code pleease ? , i've tried changing the code at the top from the code at the bottom but still nothing x_x
Why are you using a custom reload function if you could just use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Weapon/DefaultReload]Weapon:DefaultReload[/url]? In either case, Lua help is over there: [url]http://facepunch.com/forums/65[/url]
Sorry, you need to Log In to post a reply to this thread.