• Trying to make a Shotgun Swep...
    3 replies, posted
I'm trying to make a shotgun swep, but when I reload, it plays the put a shell in the gun animation forever. How do I fix this?
Can't really fix what we can't see, you should post your code.
[code] if ( SERVER ) then AddCSLuaFile( "shared.lua" ) SWEP.HoldType = "ar2" end if ( CLIENT ) then SWEP.PrintName = "Spytech Mosstron 500" SWEP.Author = "Mescool" SWEP.Slot = 2 SWEP.SlotPos = 3 SWEP.IconLetter = "k" killicon.AddFont( "weapon_pumpshotgun", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) ) end SWEP.Base = "weapon_cs_base" SWEP.Category = "Engie's Workshop Weapons" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_models/v_shotgun_engineem.mdl" SWEP.WorldModel = "models/weapons/w_shotgun.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound( "weapons/m500_shoot.wav" ) SWEP.Primary.Recoil = 5 SWEP.Primary.Damage = 8 SWEP.Primary.NumShots = 8 SWEP.Primary.Cone = 0.1 SWEP.Primary.ClipSize = 8 SWEP.Primary.Delay = 0.95 SWEP.ViewModelFlip = false SWEP.Primary.DefaultClip = 16 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "buckshot" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.IronSightsPos = Vector( 5.7, -3, 3 ) /*--------------------------------------------------------- Reload does nothing ---------------------------------------------------------*/ function SWEP:Reload() //if ( CLIENT ) then return end self:SetIronsights( false ) // Already reloading if ( self.Weapon:GetNetworkedBool( "reloading", false ) ) then return end // Start reloading if we can if ( self.Weapon:Clip1() < self.Primary.ClipSize && self.Owner:GetAmmoCount( self.Primary.Ammo ) > 0 ) then self.Weapon:SetNetworkedBool( "reloading", true ) self.Weapon:SetVar( "reloadtimer", CurTime() + 0.3 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) end end /*--------------------------------------------------------- Think does nothing ---------------------------------------------------------*/ function SWEP:Think() if ( self.Weapon:GetNetworkedBool( "reloading", false ) ) then if ( self.Weapon:GetVar( "reloadtimer", 0 ) < CurTime() ) then // Finsished reload - if ( self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then self.Weapon:SetNetworkedBool( "reloading", false ) return end // Next cycle self.Weapon:SetVar( "reloadtimer", CurTime() + 0.3 ) self.Weapon:SendWeaponAnim( ACT_VM_RELOAD ) // Add ammo self.Owner:RemoveAmmo( 1, self.Primary.Ammo, false ) self.Weapon:SetClip1( self.Weapon:Clip1() + 1 ) // Finish filling, final pump if ( self.Weapon:Clip1() >= self.Primary.ClipSize || self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then self.Weapon:SendWeaponAnim( ACT_SHOTGUN_RELOAD_FINISH ) else end end end end [/code]
Oh god no, not the CS base. :eng99: Does it decrease your ammo forever, or does it just loop the animation?
Sorry, you need to Log In to post a reply to this thread.