Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if SERVER then
- AddCSLuaFile( "shared.lua" )
- end
- SWEP.HoldType = "pistol"
- if CLIENT then
- SWEP.PrintName = "Pepper Spray"
- SWEP.Slot = 7
- SWEP.EquipMenuData = {
- type="Weapon",
- model="models/weapons/w_defuser.mdl",
- desc="Used to blind enemies.\nThis cannot damage enemies."
- };
- SWEP.Icon = "VGUI/ttt/icon_spray"
- end
- SWEP.Base = "weapon_tttbase"
- SWEP.ViewModel = "models/weapons/v_pepperspray.mdl"
- SWEP.WorldModel = "models/weapons/w_pepperspray.mdl"
- SWEP.DrawCrosshair = false
- SWEP.Primary.Cone = 0.10
- SWEP.Primary.ClipSize = -1
- SWEP.Primary.DefaultClip = -1
- SWEP.Primary.Automatic = true
- SWEP.Primary.Delay = 0.1
- SWEP.Primary.Ammo = "none"
- SWEP.Primary.Automatic = true
- SWEP.Primary.Ammo = ""
- SWEP.Kind = WEAPON_EQUIP2
- SWEP.CanBuy = {ROLE_DETECTIVE} -- only detectives can buy
- SWEP.WeaponID = AMMO_SPRAY
- SWEP.Primary.Sound = Sound("weapons/pepper_spray/spray.wav")
- --SWEP.AllowDrop = true
- function SWEP:Initialize()
- self:SetWeaponHoldType("pistol")
- end
- function SWEP:CanPrimaryAttack ( ) return true; end
- function SWEP:PrimaryAttack()
- if self:GetTable().LastNoise == nil then self:GetTable().LastNoise = true; end
- if self:GetTable().LastNoise then
- self.Weapon:EmitSound(self.Primary.Sound)
- self:GetTable().LastNoise = false;
- else
- self:GetTable().LastNoise = true;
- end
- self.Weapon:SendWeaponAnim(ACT_VM_PRIMARYATTACK)
- self.Weapon:SetNextPrimaryFire(CurTime() + .1)
- if CLIENT or (SinglePlayer() and SERVER) then
- local ED = EffectData();
- ED:SetEntity(self.Owner);
- util.Effect('extinguish', ED);
- end
- if SERVER then
- local Trace2 = {};
- Trace2.start = self.Owner:GetShootPos();
- Trace2.endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 150;
- Trace2.filter = self.Owner;
- local Trace = util.TraceLine(Trace2);
- local CloseEnts = ents.FindInSphere(Trace.HitPos, 50)
- for k, v in pairs(CloseEnts) do
- if v:GetClass() == 'prop_fire' then
- v:HitByExtinguisher(self.Owner)
- end
- if v:IsOnFire() then v:Extinguish() end
- end
- end
- end
- function SWEP:SecondaryAttack()
- self:PrimaryAttack();
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement