[lua]
AddCSLuaFile()
SWEP.Base = “weapon_base”
SWEP.PrintName = “C13 Optimist”
SWEP.Instructions = “Advanced combat device with enhanced firing system. Fires 3 bullets per shot.”
SWEP.Author = “Professor Smiley”
SWEP.Spawnable = true
SWEP.AdminSpawnable = false
SWEP.ViewModelFlip = false
SWEP.HoldType = “ar2”
SWEP.ViewModelFOV = 75
SWEP.ViewModelFlip = true
SWEP.ViewModel = “models/weapons/v_rif_ak47.mdl”
SWEP.WorldModel = “models/weapons/w_rif_ak47.mdl”
SWEP.ShowViewModel = true
SWEP.ShowWorldModel = true
SWEP.ViewModelBoneMods = {}
SWEP.IronSightsPos = Vector(5.51, -8.242, -0.84)
SWEP.IronSightsAng = Vector(0, 0, 0)
SWEP.Primary.Recoil = 1.50
SWEP.Primary.Damage = 25
SWEP.Primary.NumShots = 3
SWEP.Primary.Spread = 0.10
SWEP.Primary.Cone = 0.10
SWEP.Primary.ClipSize = 45
SWEP.Primary.DefaultClip = 90
SWEP.Primary.Ammo = “ar2”
SWEP.Primary.Automatic = true
SWEP.Primary.Delay = 0.5
function SWEP:Initialize()
util.PrechacheSound( “cynosure/blast.wav” )
self:SetWeaponHoldType( self.HoldType )
end
function SWEP:PrimaryAttack()
if ( not self:CanPrimaryAttack() ) then return end
local Bullet = {}
Bullet.Num = self.Primary.NumShots
Bullet.Src = self.Owner:GetShootPos()
Bullet.Dir = self.Owner:GetAimVector()
Bullet.Spread = Vector( self.Primary.Spread, self.Primary.Spread, 0 )
Bullet.Tracer = 1
Bullet.Damage = self.Primary.Damage
Bullet.AmmoType = self.Primary.Ammo
self:ShootEffects()
self:FireBullets( Bullet )
self:EmitSount( Sound("cynosure/blast.wav") )
self:TakePrimaryAmmo( 3 )
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
end
SWEP.VElements = {
[“barrel”] = { type = “Model”, model = “models/props_c17/canister02a.mdl”, bone = “v_weapon.AK47_Clip”, rel = “”, pos = Vector(0, 0, 0), angle = Angle(0, 0, 0), size = Vector(0.5, 0.5, 0.5), color = Color(60, 60, 60, 255), surpresslightning = false, material = “bmw”, skin = 0, bodygroup = {} },
[“sight”] = { type = “Model”, model = “models/props_c17/pulleywheels_small01.mdl”, bone = “v_weapon.AK47_Parent”, rel = “”, pos = Vector(-0.519, 3.635, 10.909), angle = Angle(-87.663, 0, 22.208), size = Vector(0.5, 0.5, 0.5), color = Color(120, 120, 120, 255), surpresslightning = false, material = “metal2”, skin = 0, bodygroup = {} }
}
SWEP.WElements = {
[“barrel”] = { type = “Model”, model = “models/props_c17/canister02a.mdl”, bone = “ValveBiped.Bip01_R_Hand”, rel = “”, pos = Vector(5.714, 1.557, -4.676), angle = Angle(106.363, -108.701, -71.3), size = Vector(0.755, 0.755, 0.755), color = Color(60, 60, 60, 255), surpresslightning = false, material = “bmw”, skin = 0, bodygroup = {} },
[“sight”] = { type = “Model”, model = “models/props_c17/pulleywheels_small01.mdl”, bone = “ValveBiped.Bip01_R_Hand”, rel = “”, pos = Vector(18.181, 1.5, -11.948), angle = Angle(-12.858, 0, -160.131), size = Vector(0.5, 0.5, 0.5), color = Color(120, 120, 120, 255), surpresslightning = false, material = “metal2”, skin = 0, bodygroup = {} }
}
[/lua]
This should be fixed, self:EmitSound() needs an argument of the sound, “cynosure/blast.wav” is just a string, Sound(“cynosure/blast.wav”) is a path and a file for the sound to play, also you don’t GetNextPrimaryFire() when trying to set Delay, that function just gets the number of when the NextPrimaryFire can be performed, you use SetNextPrimaryFire() to set it.
Also util.Precache sound also takes an arguemnt of Sound() not just string.