It’s holdtype is melee, but it’s MEANT to shoot weak bullets. If that’s a problem, tell me.
[LUA]
if ( CLIENT ) then
SWEP.Category = "*TacoNinja1995";
SWEP.PrintName = "Civil Protection SWEP"
SWEP.Author = "TacoNinja1995"
SWEP.Slot = 1
SWEP.ViewModelFOV = 60
SWEP.SlotPos = 9
SWEP.Instructions = "Click"
SWEP.Purpose = "Pretend you're a CP";
end
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel =
“models/weapons/v_stunstick.mdl”
SWEP.WorldModel =
“models/weapons/w_stunbaton.mdl”
SWEP.Primary.Sound = “pickupthecan1.wav”
SWEP.ViewModelFlip = false
SWEP.DrawCrosshair = false
SWEP.Weight = 1
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
SWEP.Primary.Recoil = 0
SWEP.Primary.RecoilUp = 0
SWEP.Primary.RecoilRight = 0
SWEP.Primary.RecoilSpin = 0
SWEP.Primary.RecoilRandom = false
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Ammopershot = 0
SWEP.Primary.Damage = 1
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 1.5
SWEP.Primary.Ammo = “pistol”
SWEP.Primary.Automatic = false
SWEP.Secondary.ClipSize = 100
SWEP.Secondary.DefaultClip = 100
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “pistol”
SWEP.Secondary.Sound = “putitinthetrash1.wav”
–Ignore everything from here on out, since you DON’T KNOW WHAT
YOU’RE DOING!
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay
)
self.Weapon:EmitSound(self.Primary.Sound)
self:FireBullet( self.Primary.Damage, self.Primary.Recoil,
self.Primary.NumShots, self.Primary.Cone )
self:TakePrimaryAmmo( self.Primary.Ammopershot )
self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
local RUp = self.Primary.RecoilUp
local RRight = self.Primary.RecoilRight
local RSpin = self.Primary.RecoilSpin
if self.Primary.RecoilRandom then
self.Owner:ViewPunch( Angle( math.Rand(-RUp,RUp),
math.Rand(-RRight,RRight), math.Rand(-RSpin,RSpin) ) )
else
self.Owner:ViewPunch( Angle( RUp, RRight, RSpin ) )
end
end
function SWEP:SecondaryAttack()
self.Weapon:EmitSound(“putitinthetrash1.wav”)
end
end
function SWEP:Initialize()
if ( SERVER ) then
self:SetWeaponHoldType( “melee” )
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
end
end
function SWEP:Deploy()
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
return true
end
function SWEP:Holster()
return true
end
function SWEP:Think()
end
function SWEP:FireBullet(dmg, recoil, numbul, cone)
local bullet = {}
bullet.Num = numbul
bullet.Src = self.Owner:GetShootPos()
bullet.Dir = self.Owner:GetAimVector()
bullet.Spread = Vector(cone, cone, 0)
bullet.Tracer = 1 --Set this to 0 for no tracers.
bullet.Force = 0.1 * dmg
bullet.Damage = dmg
self.Owner:FireBullets(bullet)
self.Owner:MuzzleFlash()
self.Owner:SetAnimation(PLAYER_ATTACK1)
end
[/lua]
It was working, but the secondary sound wouldn’t work, and i went to fix it, and then nothing worked…
and, there aren’t any lua errors in the console regarding this SWEP…
EDIT:
Well, i think the error is involved in these parst of code.
[LUA]
if ( CLIENT ) then
SWEP.Category = "*TacoNinja1995";
SWEP.PrintName = "Civil Protection SWEP"
SWEP.Author = "TacoNinja1995"
SWEP.Slot = 1
SWEP.ViewModelFOV = 60
SWEP.SlotPos = 9
SWEP.Instructions = "Click"
SWEP.Purpose = "Pretend you're a CP";
end
SWEP.Spawnable = false
SWEP.AdminSpawnable = true
SWEP.ViewModel =
“models/weapons/v_stunstick.mdl”
SWEP.WorldModel =
“models/weapons/w_stunbaton.mdl”
SWEP.Primary.Sound = “pickupthecan1.wav”
SWEP.ViewModelFlip = false
SWEP.DrawCrosshair = false
SWEP.Weight = 1
SWEP.AutoSwitchTo = true
SWEP.AutoSwitchFrom = true
SWEP.Primary.Recoil = 0
SWEP.Primary.RecoilUp = 0
SWEP.Primary.RecoilRight = 0
SWEP.Primary.RecoilSpin = 0
SWEP.Primary.RecoilRandom = false
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = 1
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Ammopershot = 0
SWEP.Primary.Damage = 1
SWEP.Primary.NumShots = 1
SWEP.Primary.Delay = 1.5
SWEP.Primary.Ammo = “pistol”
SWEP.Primary.Automatic = false
SWEP.Secondary.ClipSize = 100
SWEP.Secondary.DefaultClip = 100
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = “pistol”
SWEP.Secondary.Sound = “putitinthetrash1.wav”
[/lua]
and this part
[lua]
if self.Primary.RecoilRandom then
self.Owner:ViewPunch( Angle( math.Rand(-RUp,RUp),
math.Rand(-RRight,RRight), math.Rand(-RSpin,RSpin) ) )
else
self.Owner:ViewPunch( Angle( RUp, RRight, RSpin ) )
end
end
function SWEP:SecondaryAttack()
self.Weapon:EmitSound(“putitinthetrash1.wav”)
end
end
function SWEP:Initialize()
if ( SERVER ) then
self:SetWeaponHoldType( “melee” )
self.Weapon:SendWeaponAnim(ACT_VM_DRAW)
end
end
[/lua]
(User was banned for this post ("Undescriptive thread title" - mahalis))