• Multi-Grenade Launcher Reload Problem
    0 replies, posted
I was hoping I could figure it out and I wouldn't have to come here... but I couldn't. I am making a multi-grenade launcher that can fire 5 different grenades (Only have 3 coded at the moment. I have everything PERFECT except for the reloading. I cant seem to get it working since its not just an ordinary gun. I want the user to reload each barrel one by one, and remove 1 ammo from their inventory and then STOP. So that way the user can bring the gun back up and fire it, or select a different type of round to load. Heres my code so far: [lua] function SWEP:Reload() // Already reloading if ( self.Weapon:GetNetworkedBool( "reloading", true ) ) then return end // Start reloading if we can if (self.ClipRound6 == "none") then self.Weapon:SetNetworkedBool( "reloading", true ) self.Weapon:SetVar( "reloadtimer", CurTime() + 0.6 ) end end function SWEP:Think() if ( self.Weapon:GetNetworkedBool( "reloading", true ) ) then if ( self.Weapon:GetVar( "reloadtimer", 0 ) < CurTime() ) then if ( self.ClipRound6 == "none" ) then if ( self.Owner:GetAmmoCount( self.Primary.Ammo ) <= 0 ) then print("I dont have enough ammo") self.Weapon:SetNetworkedBool( "reloading", false ) self.Weapon:SendWeaponAnim(ACT_VM_DEPLOY) return end if self.ClipRound1 == "none" then self.ClipRound1 = self.Mode elseif self.ClipRound2 == "none" then self.ClipRound2 = self.Mode elseif self.ClipRound3 == "none" then self.ClipRound3 = self.Mode elseif self.ClipRound4 == "none" then self.ClipRound4 = self.Mode elseif self.ClipRound5 == "none" then self.ClipRound5 = self.Mode elseif self.ClipRound6 == "none" then self.ClipRound6 = self.Mode end self.Weapon:SendWeaponAnim(ACT_VM_RELOAD ) // Remove ammo self.Owner:RemoveAmmo( 1, self.Primary.Ammo, false ) end end end end [/lua]
Sorry, you need to Log In to post a reply to this thread.