SWep Q's

Hey guys, been playing gmod for a while and my windows broke down and I essentially had to start all over, so I put it aside for a while and now I’m back.

Trying to code a 5 sec swep but i came into some problems

My question:

The swep thinks it has an alt fire, so instead of showing the ironsights when i right click, it fires a shotgun(??)…
How do I fix this…
Thanks guys :slight_smile:

Edit: Also the gun is shooting extremely fast, even though the delay is at 1 second.


//General Settings \\
SWEP.AdminSpawnable = true               
SWEP.ViewModelFOV = 64
SWEP.ViewModelFlip = true                           
SWEP.ViewModel = "models/weapons/v_rif_aug.mdl"     
SWEP.WorldModel = "models/weapons/w_rif_aug.mdl"     
SWEP.AutoSwitchTo = yes                       
SWEP.Slot = 4                        
SWEP.HoldType = "ar2"                           
SWEP.PrintName = "M4"                        
SWEP.Author = "Dane"                    
SWEP.Spawnable = true                              
SWEP.AutoSwitchFrom = false                     
SWEP.FiresUnderwater = true                 
SWEP.Weight = 5             
SWEP.DrawCrosshair = true             
SWEP.Category = "Other"         
SWEP.SlotPos = 4                  
SWEP.DrawAmmo = true              
SWEP.ReloadSound = "sound/aug_clipin.wav"        
SWEP.Instructions = "Kill Shit"         
SWEP.Contact = ""                   
SWEP.Purpose = "Kill Shit"  
SWEP.base = "weapon_base"
//General settings\\

//PrimaryFire Settings\\
SWEP.Primary.Sound = "sound/aug/aug-1"        
SWEP.Primary.Damage = 45                       
SWEP.Primary.TakeAmmo = 1                        
SWEP.Primary.ClipSize = 50               
SWEP.Primary.Ammo = "smg1"                     
SWEP.Primary.DefaultClip = 300        
SWEP.Primary.Spread = 0.1                   
SWEP.Primary.NumberofShots = 1                     
SWEP.Primary.Automatic = true 
SWEP.Primary.Recoil = 0.1                           
SWEP.Primary.Delay = 1                          
SWEP.Primary.Force = 300                            
//PrimaryFire settings\\

SWEP.IronSightsPos = 2.5213, -3.1555, 0.6086
SWEP.IronSightsAng = -1.6939, -0.3972, -0.6101

Your weapon base should be weapon_cs_base because Ironsights aren’t defined in weapon_base

after i change the swep base to weapon_cs_bse it doesn’t even show up in the spawn menu

anybody? Its pretty simple

OK I figured out why it wasn’t showing up in the spawn menu, but it still has a alt fire (which is a shotgun for some reason) and it still fires extremely fast.

The alt fire is the default one. You have it because you haven’t defined any. The best way to get rid of it is to define an empty SecondaryFire function. You should also specify the properties of your SWEP.Secondary so that it is clear it does not exist. For an example edit a lua scripted weapon which you know does not have a secondary fire and see how they do it.



SWEP.Secondary.ClipSize 	= -1
SWEP.Secondary.DefaultClip 	= -1
SWEP.Secondary.Automatic 	= false
SWEP.Secondary.Ammo 		= "none"


Like this?

I think that works.
if not you can always use the default css base.

If you have the game, that is.

Ok now it doesnt have any secondary fire but the ironsights still dont pull up on a right click.

Edit: I do have CSS, but that weapon base doesn’t use ironsights does it?


//General Settings \\
SWEP.AdminSpawnable = true
SWEP.ViewModelFOV = 64
SWEP.ViewModelFlip = true
SWEP.ViewModel = "models/weapons/v_rif_aug.mdl"
SWEP.WorldModel = "models/weapons/w_rif_aug.mdl"
SWEP.AutoSwitchTo = yes                       
SWEP.Slot = 4
SWEP.HoldType = "ar2"    
SWEP.PrintName = "M4"
SWEP.Author = "Dane"
SWEP.Spawnable = true
SWEP.AutoSwitchFrom = false
SWEP.FiresUnderwater = true
SWEP.Weight = 5
SWEP.DrawCrosshair = true
SWEP.Category = "Other"
SWEP.SlotPos = 3
SWEP.DrawAmmo = true
SWEP.ReloadSound = "sound/aug_clipin.wav"
SWEP.Instructions = "Kill Shit"
SWEP.Contact = " "
SWEP.Purpose = "Kill Shit"
SWEP.base = "weapon_cs_base"
//General settings\\

//PrimaryFire Settings\\
SWEP.Primary.Sound = "sound/aug/aug-1"
SWEP.Primary.Damage = 45
SWEP.Primary.TakeAmmo = 1
SWEP.Primary.ClipSize = 50
SWEP.Primary.Ammo = "smg1"
SWEP.Primary.DefaultClip = 300
SWEP.Primary.Spread = 0.1
SWEP.Primary.NumberofShots = 1
SWEP.Primary.Automatic = true
SWEP.Primary.Recoil = 0.1
SWEP.Primary.Delay = 0.3
SWEP.Primary.Force = 100  
//PrimaryFire settings\\

//SecondaryFire Settings\\
SWEP.Secondary.ClipSize 	= -1
SWEP.Secondary.DefaultClip 	= -1
SWEP.Secondary.Automatic 	= false
SWEP.Secondary.Ammo 		= "none"
//SecondaryFire Settings\\

//Ironsight Settings\\
SWEP.IronSightsPos = Vector (2.5213, -3.1555, 0.6086)
SWEP.IronSightsAng = Vector (-1.6939, -0.3972, -0.6101)
//Ironsight Settings\\

Go in there, and somewhere type this
[lua]
function SWEP.SecondaryFire()
end
[/lua]

That doesnt change anything for me. On right click the swep makes a clicking sound, like its out of ammo, it doesn’t draw ironsights and It shoots with no delay. Any other ideas?

[lua]
function SWEP.SecondaryFire()
return false
end
[/lua]
All I can think of.

Still no joy

I can’t really think of anything else, I’ve never encountered this problem before :frown: