Weapon Reload Isuse

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 ?



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)


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

Weapon:DefaultReload?

In either case, Lua help is over there:
http://facepunch.com/forums/65