The swep has no errors but the bullets dont fire even though for the debugging it says they are. Also the hud doesn’t update the SWEP.Charge
[lua]SWEP.Author = “Atwal”
SWEP.Contact = “Facepunch”
SWEP.Purpose = “Weapon for all situations”
SWEP.Instructions = “Primary to fire laser, Secondary to fire a rocket”
SWEP.Category = “Atwal’s SWEPs”
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel = “models/weapons/v_irifle.mdl”
SWEP.WorldModel = “models/weapons/w_irifle.mdl”
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = “none”
SWEP.Secondary.ClipSize = -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “none”;
SWEP.Sound = Sound (“weapon_ar2.Single”)
SWEP.Damage = 1
SWEP.Spread = 0
SWEP.NumBul = 1
SWEP.Delay = 0.1
SWEP.Force = 5
SWEP.Charge = 100
function SWEP:Deploy()
return true
end
function SWEP:Holster()
return true
end
function SWEP:Think()
end
function SWEP:PrimaryAttack() --when +attack1 happens
if self.Charge > 0 then
local bullet = {} --creates a table for the properties of the bullet
bullet.Num = self.NumBul --number of bullets you are shooting
bullet.Src = self.Owner:GetShootPos() -- Source, where you are standing
bullet.Dir = self.Owner:GetAimVector() -- direction of bullet, where you are looking
bullet.Spread = Vector( self.Spread, self.Spread, 0 ) -- spread of bullet, how accurate it is
bullet.Tracer = 0 -- this doesn't really affect anything
bullet.Force = self.Force -- how powerful it is
bullet.Damage = self.Damage --how much damage it does to people
bullet.AmmoType = self.Primary.Ammo --what type of ammo you are using
self.Owner:FireBullets( bullet ) --actually shoots the bullet.
Msg("Bullet Fired
")
self.Weapon:EmitSound ( self.Sound )
– this makes the sound, which I specified earlier in the code
--this makes the shooting animation for the 357 for view model and world model
self.Weapon:SetNextPrimaryFire( CurTime() + self.Delay )
self.Weapon:SetNextSecondaryFire( CurTime() + self.Delay )
--this sets the delay for the next primary and secondary fires.
self.Charge = self.Charge - 1 --removes 1 ammo from our clip
Msg("Charge Lowered
")
end
end --end our function
function SWEP:SecondaryAttack()
if self.Charge < 100 then
self.Charge = self.Charge + 1
Msg("Charge + 1
")
end
end
function SWEP:DrawHUD()
draw.SimpleText(“Energy” … self.Charge … “%” ,“ScoreboardText”,500,500,Color(255,0,0,255))
end[/lua]