• Swep:reload()
    0 replies, posted
Im having trouble with my swep and reloading, It may be that fact that i am using the portal gun model but i don't know. Anyway when my gun goes to 0 ammo it automaticaly starts removing it from the whole ammo so you don't have to reload the gun. How can i make it so that when the gun gets to 0 ammo, it doesn't automaticly reload you HAVE to press R: Also the animation is not working, here is the lua code for my weapon [lua]if (SERVER) then AddCSLuaFile( "shared.lua" ) SWEP.Weight = 5 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false SWEP.HoldType = "ar2" end if ( CLIENT ) then SWEP.PrintName = "Pwned Gun" SWEP.Author = "Adzter" SWEP.DrawAmmo = true SWEP.DrawCrosshair = true SWEP.ViewModelFOV = 82 SWEP.ViewModelFlip = false SWEP.CSMuzzleFlashes = true SWEP.NameOfSWEP = "pwned_gun" SWEP.SlotPos = 1 SWEP.IconLetter = "D" killicon.AddFont( SWEP.NameOfSWEP, "CSKillIcons", SWEP.IconLetter, Color( 0, 230, 215, 255 ) ) end SWEP.Category = "Other" SWEP.Base = "weapon_cs_base" SWEP.Spawnable = false SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_portalgun.mdl" SWEP.WorldModel = "models/weapons/w_portalgun.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = true SWEP.AutoSwitchFrom = false function SWEP:Deploy() return true end SWEP.Primary.Sound = Sound( "weapons/pwnagegun_single.wav" ) SWEP.Primary.Recoil = 0.5 SWEP.Primary.Damage = 20 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.01 SWEP.Primary.ClipSize = 38 SWEP.Primary.Delay = 0.05 SWEP.Primary.DefaultClip = 152 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "smg1" SWEP.MoveSpread = 4 SWEP.JumpSpread = 10 SWEP.CrouchSpread = 0.9 function SWEP:DrawHUD() if !self.CrossHairIronsight then if ( self.Weapon:GetNetworkedBool( "Ironsights" ) ) then return end end local crosshairsize = self.Weapon:GetNetworkedInt("Crosshair") local x = ScrW() / 2.0 local y = ScrH() / 2.0 local scale = 10 * crosshairsize local LastShootTime = self.Weapon:GetNetworkedFloat( "LastShootTime", 0 ) scale = scale * (2 - math.Clamp( (CurTime() - LastShootTime) * 5, 0.0, 1.0 )) surface.SetDrawColor( 0, 200, 215, 200 ) local gap = 20 * scale local length = gap + 20 * scale surface.DrawLine( x - length, y, x - gap, y ) surface.DrawLine( x + length, y, x + gap, y ) surface.DrawLine( x, y - length, x, y - gap ) surface.DrawLine( x, y + length, x, y + gap ) end SWEP.IronSightsPos = Vector (6.1518, -2.9359, 1.0987) SWEP.IronSightsAng = Vector (-3.3388, -2.8267, -173.704) function SWEP:Reload() self.Weapon:DefaultReload( ACT_VM_RELOAD ) return true end [/lua]
Sorry, you need to Log In to post a reply to this thread.