duel elites

Can anyone tell me why my duel elites are not working? I fixed the code so i dont get yellow flooding text but now unfortunately only one pistol makes a shooting effect while the other one doesnt. Can anyone tell me how to fix this? Oh and im never made the gun.

Here is the lua:

[lua]if ( SERVER ) then

AddCSLuaFile( "shared.lua" )

SWEP.HoldType			= "pistol"

end

if ( CLIENT ) then

SWEP.PrintName			= "Duel Elites"			
SWEP.Author				= "Tyrone Blake"
SWEP.Slot				= 1
SWEP.SlotPos			= 5
SWEP.IconLetter			= "u"

killicon.AddFont( "weapon_p228", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )

end

SWEP.Base = “weapon_cs_base”

SWEP.Spawnable = true
SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_pist_elite.mdl”
SWEP.WorldModel = “models/weapons/w_pist_elite.mdl”

SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false

SWEP.Primary.Sound = Sound( “Weapon_FiveSeven.Single” )
SWEP.Primary.Recoil = .1
SWEP.Primary.Damage = 5
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0.03
SWEP.Primary.ClipSize = 21
SWEP.Primary.Delay = 0.1
SWEP.Primary.DefaultClip = 21
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “pistol”

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

SWEP.IronSightsPos = Vector( 4.5, -4, 3 )[/lua]

Teta made me sad.

Here’s one way to do it:

[lua]
if SERVER then

AddCSLuaFile( "shared.lua" )
SWEP.Weight				= 5
SWEP.HoldType			= "smg"
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

end

if CLIENT then

SWEP.DrawAmmo			= true
SWEP.DrawCrosshair		= true
SWEP.ViewModelFOV		= 65
SWEP.ViewModelFlip		= false
SWEP.CSMuzzleFlashes	= false

SWEP.Slot				= 1
SWEP.SlotPos			= 10

SWEP.PrintName			= "Dual Elites"	
SWEP.Author				= "Teta_Bonita"
SWEP.Contact			= ""
SWEP.Purpose			= ""
SWEP.Instructions		= "Aim away from face"

SWEP.WepSelectIcon		= surface.GetTextureID( "weapons/swep" )
SWEP.BounceWeaponIcon   = false

end

SWEP.Spawnable = false
SWEP.AdminSpawnable = true

SWEP.ViewModel = “models/weapons/v_pist_elite.mdl”
SWEP.WorldModel = “models/weapons/w_pist_elite.mdl”

SWEP.Primary.Sound = Sound( “Weapon_Elite.Single” )
SWEP.Primary.Damage = 15
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 0.12
SWEP.Primary.Cone = 0.03
SWEP.Primary.Recoil = 2

SWEP.Primary.ClipSize = 20
SWEP.Primary.DefaultClip = 40
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = “pistol”

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

function SWEP:Initialize()

if SERVER then
	self:SetWeaponHoldType( self.HoldType )
end

self.ShootRight = true
self.LastShoot = 0

end

function SWEP:PrimaryAttack()

self.Weapon:SetNextSecondaryFire( CurTime() + self.Primary.Delay )
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay )

if not self:CanPrimaryAttack() then return end

self.Weapon:EmitSound( self.Primary.Sound )
self:TakePrimaryAmmo( 1 )

self:ShootBulletExample(
	self.Primary.Damage,
	self.Primary.Recoil,
	self.Primary.NumShots,
	self.Primary.Cone )
	
self.LastShoot = CurTime()

end

function SWEP:SecondaryAttack()

end

function SWEP:Think()

end

function SWEP:Reload()

self.Weapon:DefaultReload( ACT_VM_RELOAD )

end

– Sequence names
– draw
– idle
– idle_leftempty
– reload
– shoot_left1
– shoot_left2
– shoot_leftlast
– shoot_right1
– shoot_right2
– shoot_rightlast

– Attachements
– 1 = right muzzle
– 2 = left muzzle
– 3 = right shell eject
– 4 = left shell eject

function SWEP:ShootBulletExample( dmg, recoil, numbul, cone )

--send the bullet
local bullet = {} 
bullet.Num		= numbul 
bullet.Src		= self.Owner:GetShootPos() 
bullet.Dir		= self.Owner:GetAimVector()
bullet.Spread	= Vector( cone, cone, 0 ) 
bullet.Tracer	= 0	 
bullet.Force	= 3 
bullet.Damage 	= dmg  

self.Owner:FireBullets( bullet )

--play animations
local sequence
if self.ShootRight then
	
	if CurTime() - self.LastShoot > 0.3 then
		sequence = "shoot_right1"
	else
		sequence = "shoot_right2"
	end

	self.ShootRight = false
	
else

	if CurTime() - self.LastShoot > 0.3 then
		sequence = "shoot_left1"
	else
		sequence = "shoot_left2"
	end
	
	self.ShootRight = true
	
end

local vm = self.Owner:GetViewModel()
local attack = vm:LookupSequence( sequence )
vm:ResetSequence( attack )  

self.Owner:MuzzleFlash()
self.Owner:SetAnimation( PLAYER_ATTACK1 )

--apply recoil
self.Owner:ViewPunch( Angle( math.Rand( -0.2, -0.1 ) * recoil, math.Rand( -0.1, 0.1 ) * recoil, 0 ) )

end
[/lua]

This makes it switch between the left and right shooting animations every time you fire. Unfortunately, Garrysmod handles muzzleflashes in a very silly way, so they don’t work so well- only the right-hand gun can emit muzzleflashes. For now I set SWEP.CSMuzzleFlashes = false so that the effect appears in between the two guns (a sort of compromise I guess). Fixing the muzzleflashes is an exercise left to the reader.

The muzzleflash system is pretty frustrating, I think I’m going to go post it as a request on Mantis to be able to set whether any muzzleflash is drawn at all… if the default ones were removed we could do more custom effects.

Heh, we’ve had this problem for ages in Gmod. First time I’ve seen anyone fix it to any extent. Nice one, Teta.

What the hell? You people must be devoted to lua or something XD. Do you study lua or something because most of the articals i have seen on lua are not so helpfull. Thanks for helping…

is there any way to actually USE the Css Dual elites holdtype in GMOD?ive been trying to fix this problem FOREVER