So, im making a weapon and i want to remove the muzzel effect and shell effect but i cant get it working no matter what i try, i still get the shells ejecting when i shoot and the muzzel flash still comes.
I have been looking at this: [url]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexff1a.html[/url]
But it would be nice if someone could tell me how to use it.
Post the weapon code
By the way, I think you should be looking at [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/ShootEffects]WEAPON/ShootEffects[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/PrimaryAttack]WEAPON/PrimaryAttack[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/ShootBullet]WEAPON/ShootBullet[/url]
Pretty sure you copied your weapon from somewhere though, cause you have to code in the bullets and the muzzle flash, they don't automatically happen as far as I know
Im sorry if it's a bit messy/ im still learing how to use it propperly.
[CODE]
//General Settings\\
SWEP.Base = "weapon_sim_base"
SWEP.AdminSpawnable = true // Is the swep spawnable for admin
SWEP.ViewModelFOV = 70 // How much of the weapon do u see ?
SWEP.UseHands = true
SWEP.ViewModel = "models/weapons/v_smg_mp5.mdl" // The viewModel, the model you se when you are holding it-.-
SWEP.WorldModel = "models/weapons/w_smg_mp5.mdl" // The worldmodel, The model yu when it's down on the ground
SWEP.AutoSwitchTo = true
SWEP.Slot = 3
SWEP.ViewModelFlip = true
SWEP.Primary.Cone = 0.02
SWEP.HoldType = "smg" // How the swep is hold Pistol smg greanade melee
SWEP.PrintName = "MP5 Airsoft" // your sweps name
SWEP.Author = "pLASTER" // Your name
SWEP.Spawnable = true // Can everybody spawn this swep ? - If you want only admin keep this false and adminsapwnable true.
SWEP.AutoSwitchFrom = true // Does the weapon get changed by other sweps if you pick them up ?
SWEP.FiresUnderwater = false // Does your swep fire under water ?
SWEP.Weight = 5 // Chose the weight of the Swep
SWEP.DrawCrosshair = false // Do you want it to have a crosshair ?
SWEP.Category = "pLASTERS Airsoft" // Make your own catogory for the swep
SWEP.SlotPos = 1 // Deside wich slot you want your swep do be in 1 2 3 4 5 6
SWEP.DrawAmmo = true // Does the ammo show up when you are using it ? True / False
SWEP.ReloadSound = "Weapon_Pistol.Reload" // Reload sound, you can use the default ones, or you can use your one; Example; "sound/myswepreload.waw"
SWEP.Instructions = "You know how to shoot..." // How do pepole use your swep ?
SWEP.Contact = "plaster422@gmail.com" // How Pepole chould contact you if they find bugs, errors, etc
SWEP.Purpose = "You know what to do with a weapon" // What is the purpose with this swep ?
SWEP.Primary.Sound = "mp5bb.wav" // The sound that plays when you shoot :]
SWEP.Primary.Damage = 2 // How much damage the swep is doing
SWEP.Primary.TakeAmmo = 1 // How much ammo does it take for each shot ?
SWEP.Primary.ClipSize = 30 // The clipsize
SWEP.Primary.Ammo = "smg1" // ammmo type pistol/ smg1
SWEP.Primary.DefaultClip = 400 // How much ammo does the swep come with `?
SWEP.Primary.Spread = 0.05 // Does the bullets spread all over, if you want it fire exactly where you are aiming leave it o.1
SWEP.Primary.NumberofShots = 1 // How many bullets you are firing each shot.
SWEP.Primary.Automatic = true // Is the swep automatic ?
SWEP.Primary.Recoil = 0 // How much we should punch the view
SWEP.Primary.Delay = 0.11 // How long time before you can fire again
SWEP.Primary.Force = 1 // The force of the shot
SWEP.HeadshotMultiplier = 1.5
//SWEP:PrimaryFire()\\
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
local bullet = {}
bullet.Num = self.Primary.NumberofShots
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector( self.Primary.Spread * 0.1 , self.Primary.Spread * 0.1, 0)
bullet.Tracer = 1
bullet.TracerName = "Tracer"
bullet.Force = self.Primary.Force
bullet.Damage = self.Primary.Damage
bullet.AmmoType = self.Primary.Ammo
local rnda = self.Primary.Recoil * -1
local rndb = self.Primary.Recoil * math.random(-1, 1)
self:ShootEffects()
self.Owner:FireBullets( bullet )
self.Weapon:EmitSound(Sound(self.Primary.Sound))
self.Owner:ViewPunch( Angle( rnda,rndb,rnda ) )
self:TakePrimaryAmmo(self.Primary.TakeAmmo)
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
end
//SWEP:SecondaryAttack\\
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
SWEP.Pistol = false
SWEP.Rifle = true
SWEP.Shotgun = false
SWEP.Sniper = false
SWEP.IronSightsPos = Vector (4.7494, -4.114, 1.9335)
SWEP.IronSightsAng = Vector (1.018, -0.0187, 0)
SWEP.RunArmOffset = Vector (-2.6657, 0, 2.5)
SWEP.RunArmAngle = Vector (-20.0824, -20.5693, 0)
/*---------------------------------------------------------
Name: SWEP:Precache()
Desc: Use this function to precache stuff.
---------------------------------------------------------*/
function SWEP:Precache()
util.PrecacheSound("weapons/mp5navy/mp5-1.wav")
end[/CODE]
[editline]10th January 2016[/editline]
[QUOTE=MPan1;49498942]Post the weapon code
By the way, I think you should be looking at [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/ShootEffects]WEAPON/ShootEffects[/url], [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/PrimaryAttack]WEAPON/PrimaryAttack[/url] and [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/WEAPON/ShootBullet]WEAPON/ShootBullet[/url]
Pretty sure you copied your weapon from somewhere though, cause you have to code in the bullets and the muzzle flash, they don't automatically happen as far as I know[/QUOTE]
Yea i fund a template and changed the weapon base, but i pretty much changed every thing/ added some things
[CODE]
self:ShootEffects()
self.Owner:FireBullets( bullet )
[/CODE]
Those create the bullets and the flash. Remove them if you want, they're in the SWEP:PrimaryFire function
[QUOTE=MPan1;49498989][CODE]
self:ShootEffects()
self.Owner:FireBullets( bullet )
[/CODE]
Those create the bullets and the flash. Remove them if you want, they're in the SWEP:PrimaryFire function[/QUOTE]
Thank you very much, helped a lot!
Sorry, you need to Log In to post a reply to this thread.