• Secondary Fire Swep Problem
    5 replies, posted
I do not want secondary fire on my Swep, when I was creating my Swep I left everything out that had to do with secondary fire. It still has a secondary fire which is like a shotgun fire that does 900 damage. Please help me fix this. (I will provide my Swep if asked.)
You need to use a blank function.. Define it to do nothing, otherwise it'll use the base function. Here's an example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/holster_weapon_system/__holstering_weapon__.lua[/url]
[QUOTE=Acecool;45410768]You need to use a blank function.. Define it to do nothing, otherwise it'll use the base function. Here's an example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/holster_weapon_system/__holstering_weapon__.lua[/url][/QUOTE] Which part do I need to be looking at? Since I based this off of an example Swep file this is what it currently has under function SWEP:SecondaryAttack() [CODE]function SWEP:SecondaryAttack() if ( !self:CanSecondaryAttack() ) then return end local rnda = -self.Secondary.Recoil local rndb = self.Secondary.Recoil * math.random(-1, 1) self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) ) local eyetrace = self.Owner:GetEyeTrace() self.Weapon:EmitSound ( self.Secondary.Sound ) self:ShootEffects() local explode = ents.Create("env_explosion") explode:SetPos( eyetrace.HitPos ) explode:SetOwner( self.Owner ) explode:Spawn() explode:SetKeyValue("iMagnitude","175") explode:Fire("Explode", 0, 0 ) explode:EmitSound("weapon_AWP.Single", 400, 400 ) self.Weapon:SetNextPrimaryFire( CurTime() + self.Secondary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) self:TakePrimaryAmmo(self.Secondary.TakeAmmo) end[/CODE] What do I change here? I hope that wasn't too much. [editline]16th July 2014[/editline] [QUOTE=Acecool;45410768]You need to use a blank function.. Define it to do nothing, otherwise it'll use the base function. Here's an example: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/holster_weapon_system/__holstering_weapon__.lua[/url][/QUOTE] Also since I made most of the properties for the secondary -1, "none", nil, etc. it doesn't have any ammo it just clicks, and I don't want that either. If anything I would want a slight zoom in but that is a project for another day.
if you want secondary fire to do nothing change it to this [Code] function SWEP:SecondaryAttack() return end [/Code]
You dont need the return.
[QUOTE=Marijuanaman;45415152]if you want secondary fire to do nothing change it to this [Code] function SWEP:SecondaryAttack() return end [/Code][/QUOTE] Thank you
Sorry, you need to Log In to post a reply to this thread.