My weapon has 244 ammo in clip on server instead of 500.

And if I try to reload it with 244 ammo, it just loops ( the reload. )




if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "Venom"
	SWEP.Author				= "Nightstalker"
	SWEP.Slot				= 5
	SWEP.SlotPos			= 2
	SWEP.ViewModelFOV		= 80

SWEP.WepSelectIcon		= surface.GetTextureID( "vgui/icons/rtcw_venom" )
	
	killicon.Add( "rtcw_venom", "vgui/icons/rtcw_venom", Color( 255, 255, 255, 255 ) )
end


function SWEP:Deploy()
	self.Weapon:SetNextPrimaryFire(CurTime() +.5)
	self.Weapon:SetNextSecondaryFire(CurTime() +.5)
	self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
		self.Weapon:EmitSound("RTCW/change.wav")
	self.bInAttack = true
	return true
end

function SWEP:PrimaryAttack()
	self.bInAttack = true
	if ( !self:CanPrimaryAttack() ) then return end
	if self.attackDelay then
		if CurTime() < self.attackDelay then return end
		self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
		self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK )
		self.Owner:ViewPunch( Angle( math.Rand(-.2,-.2) * self.Primary.Recoil, math.Rand(.1,-.1) *self.Primary.Recoil, math.Rand(0,0) ) )
		if SERVER then self.Owner:EmitSound("RTCW/venom/venomf1.wav", 100, 100)
		end
		self:ShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Spread )
		self:Muzzleflash()
		self:TakePrimaryAmmo( 1 )
	end
end

function SWEP:Reload()
	if ( self.Weapon:Ammo1() <= 0 ) then return end
	if ( self.Weapon:Clip1() >= self.Primary.ClipSize ) then return end
	self.Weapon:DefaultReload( ACT_VM_RELOAD )
	self.Weapon:EmitSound(self.ReloadSound)
	self.attackDelay = nil
	self.cantrelease = true
	
	
end

function SWEP:Muzzleflash()
	local pos = self.Owner:GetShootPos()
	local ang = self.Owner:GetAimVector():Angle()
	pos = pos +ang:Forward() *30 +ang:Right() *8 +ang:Up() *-6
	local effectdata = EffectData()
	effectdata:SetStart( pos )
	effectdata:SetOrigin( pos )
	util.Effect("rtcw_muzzle", effectdata)
end

function SWEP:Think()


if self.Weapon:Clip1() <= 0 then return end
if !self.bInAttack then return end
if (!self.Owner || self.Owner == NULL) then return end

	if ( self.Owner:KeyPressed( IN_ATTACK ) ) then
		self.cantrelease = false
		self.attackDelay = CurTime() +0.6
		self.Weapon:SendWeaponAnim(ACT_VM_PULLPIN)
			if SERVER then self.PullSound = CreateSound( self.Owner, "RTCW/venom/venomsu1.wav", 100, 100)
			self.PullSound:Play() end
	elseif ( self.Owner:KeyReleased( IN_ATTACK ) ) then
	

		if self.cantrelease then return end
		self.Weapon:SendWeaponAnim(ACT_VM_RELEASE)
		if SERVER then
		if self.PullSound then self.PullSound:Stop() end
	end
		if SERVER then self.Owner:EmitSound("RTCW/venom/venomsd1.wav", 100, 100) end
	end
end
function SWEP:DryFire()
	self.Weapon:EmitSound("RTCW/noammo.wav")
end



SWEP.HoldType			= "smg"
SWEP.Base				= "rtcw_base"
SWEP.Category			= "Return to Castle Wolfenstein"

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/RTCW/v_venom.mdl"
SWEP.WorldModel			= "models/RTCW/w_venom.mdl"

SWEP.Weight				= 3
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Force = 40
SWEP.Primary.Recoil			= 1
SWEP.Primary.Damage			= 12
SWEP.Primary.NumShots		= 1
SWEP.Primary.Spread			= 0.1
SWEP.Primary.ClipSize		= 500
SWEP.Primary.Delay			= .04
SWEP.Primary.DefaultClip	= 1000
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "StriderMinigun"

SWEP.ReloadSound			= "RTCW/venom/venom_reload.wav"

try this



function SWEP:Reload()
	if ( self.Weapon:Ammo1() < 500 ) then 
	     self.Weapon:DefaultReload( ACT_VM_RELOAD )
	     self.Weapon:EmitSound(self.ReloadSound)
	     self.attackDelay = nil
	     self.cantrelease = true

        elseif ( self.Weapon:Ammo1() == 0 ) then
        return end	
end


Not sure if will change anything, but try moving all the SWEP.* variables to top. It’s just generally a better idea to keep them on top.

That didn’t work.

Yeah it does the same to me when I put it over around 250 ammo, then when it runs out of that 244 ammo, it shows up with the rest, (say I put 300 ammo, it shoots 244 times, then the bar is still full, but it brings 56 more ammo in).

It works for me, so there’s something you are doing wrong.