if CLIENT then SWEP.WepSelectIcon = surface.GetTextureID( "csgo/econ/weapons/base_weapons/weapon_taser" ) SWEP.DrawWeaponInfoBox = false SWEP.BounceWeaponIcon = false killicon.Add( "weapon_csgo_taser", "csgo/econ/weapons/base_weapons/weapon_taser", Color( 255, 255, 255, 255 ) ) end SWEP.PrintName = "Zeus x27" SWEP.Category = "Counter-Strike: Global Offensive" SWEP.Spawnable= true SWEP.AdminSpawnable= true SWEP.AdminOnly = false SWEP.ViewModelFOV = 60 SWEP.ViewModel = "models/csgo/weapons/v_eq_taser.mdl" SWEP.WorldModel = "models/csgo/weapons/w_eq_taser.mdl" SWEP.ViewModelFlip = false SWEP.BobScale = 0.4 SWEP.SwayScale = 0.75 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Weight = 5 SWEP.Slot = 0 SWEP.SlotPos = 0 SWEP.UseHands = false SWEP.HoldType = "pistol" SWEP.FiresUnderwater = false SWEP.DrawCrosshair = false SWEP.DrawAmmo = true SWEP.CSMuzzleFlashes = 1 SWEP.Base = "weapon_base" SWEP.Drop = 0 SWEP.DropTimer = CurTime() SWEP.DropTime = 0.5 SWEP.Idle = 0 SWEP.IdleTimer = CurTime() SWEP.Speed = 176 SWEP.CrosshairDistance = 24 SWEP.Primary.Sound = Sound( "Weapon_CSGO_Taser.Single" ) SWEP.Primary.ClipSize = 0 SWEP.Primary.DefaultClip = 0 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Primary.Damage = 500 SWEP.Primary.Spread = 0.001 SWEP.Primary.SpreadMin = 0.001 SWEP.Primary.SpreadMax = 0.044240002 SWEP.Primary.SpreadKick = 0.022120001 SWEP.Primary.SpreadMove = 0.04 SWEP.Primary.SpreadAir = 0.044240002 SWEP.Primary.SpreadTimer = CurTime() SWEP.Primary.SpreadTime = 0.345388 SWEP.Primary.NumberofShots = 1 SWEP.Primary.Delay = 0.5 SWEP.Primary.Force = 1 SWEP.Secondary.Sound = Sound( "Weapon_CSGO_Taser.Hit" ) SWEP.Secondary.ClipSize = 0 SWEP.Secondary.DefaultClip = 0 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" function SWEP:Initialize() self:SetWeaponHoldType( self.HoldType ) self.Idle = 0 self.IdleTimer = CurTime() + 0.5 end function SWEP:DrawHUD() local dist1 = self.Primary.Spread / self.Primary.SpreadMax * self.CrosshairDistance + 4 local dist2 = self.Primary.Spread / self.Primary.SpreadMax * self.CrosshairDistance + 12 surface.SetDrawColor( GetConVar( "csgo_crosshair_red" ):GetInt(), GetConVar( "csgo_crosshair_green" ):GetInt(), GetConVar( "csgo_crosshair_blue" ):GetInt(), GetConVar( "csgo_crosshair_alpha" ):GetInt() ) surface.DrawLine( ScrW() / 2 - dist1, ScrH() / 2, ScrW() / 2 - dist2, ScrH() / 2 ) surface.DrawLine( ScrW() / 2 + dist1, ScrH() / 2, ScrW() / 2 + dist2, ScrH() / 2 ) surface.DrawLine( ScrW() / 2, ScrH() / 2 - dist1, ScrW() / 2, ScrH() / 2 - dist2 ) surface.DrawLine( ScrW() / 2, ScrH() / 2 + dist1, ScrW() / 2, ScrH() / 2 + dist2 ) surface.DrawLine( ScrW() / 2 - dist1, ScrH() / 2 + 1, ScrW() / 2 - dist2, ScrH() / 2 + 1 ) surface.DrawLine( ScrW() / 2 + dist1, ScrH() / 2 + 1, ScrW() / 2 + dist2, ScrH() / 2 + 1 ) surface.DrawLine( ScrW() / 2 + 1, ScrH() / 2 - dist1, ScrW() / 2 + 1, ScrH() / 2 - dist2 ) surface.DrawLine( ScrW() / 2 + 1, ScrH() / 2 + dist1, ScrW() / 2 + 1, ScrH() / 2 + dist2 ) end function SWEP:GetViewModelPosition( pos, ang ) if CLIENT then pos = pos + ang:Forward() * GetConVar( "csgo_vm_y" ):GetInt() + ang:Right() * GetConVar( "csgo_vm_x" ):GetInt() + ang:Up() * GetConVar( "csgo_vm_z" ):GetInt() return pos end end function SWEP:Deploy() self:SetWeaponHoldType( self.HoldType ) self.Weapon:SendWeaponAnim( ACT_VM_DRAW ) self:SetNextPrimaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() ) self:SetNextSecondaryFire( CurTime() + self.Owner:GetViewModel():SequenceDuration() ) self.Drop = 0 self.DropTimer = CurTime() self.Idle = 0 self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration() self.Owner:SetWalkSpeed( self.Speed ) self.Owner:SetRunSpeed( self.Speed * 2 ) return true end function SWEP:Holster() self.DropTimer = CurTime() self.Idle = 0 self.IdleTimer = CurTime() self.Owner:SetWalkSpeed( 200 ) self.Owner:SetRunSpeed( 400 ) if self.Drop == 1 then if SERVER then local entity = ents.Create( "prop_physics" ) entity:SetModel( "models/csgo/weapons/w_eq_taser.mdl" ) entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) entity:DrawShadow( false ) entity:SetOwner( self.Owner ) if IsValid( entity ) then entity:SetPos( self.Owner:GetShootPos() + self.Owner:EyeAngles():Forward() * 16 ) entity:SetAngles( self.Owner:EyeAngles() ) entity:Spawn() entity:GetPhysicsObject():SetVelocity( self.Owner:EyeAngles():Forward() * 500 ) entity:GetPhysicsObject():AddAngleVelocity( Vector( math.Rand( -500, 500 ), math.Rand( -500, 500 ), math.Rand( -500, 500 ) ) ) end self.Owner:DropWeapon( self.Weapon ) self.Weapon:Remove() end end return true end function SWEP:PrimaryAttack() if self.FiresUnderwater == false and self.Owner:WaterLevel() == 3 then return end local tr = util.TraceLine( { start = self.Owner:GetShootPos(), endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * 190, filter = self.Owner, mask = MASK_SHOT_HULL } ) if SERVER and IsValid( tr.Entity ) and tr.Entity:IsNPC() || tr.Entity:IsPlayer() then local dmg = DamageInfo() local attacker = self.Owner if !IsValid( attacker ) then attacker = self end dmg:SetAttacker( attacker ) dmg:SetInflictor( self ) dmg:SetDamage( self.Primary.Damage ) dmg:SetDamageType( DMG_SHOCK ) dmg:SetDamageForce( self.Owner:GetForward() * self.Primary.Force ) tr.Entity:TakeDamageInfo( dmg ) end EffectData():SetOrigin( tr.HitPos ) EffectData():SetNormal( tr.HitNormal ) EffectData():SetStart( self.Owner:GetShootPos() ) EffectData():SetAttachment( 1 ) EffectData():SetEntity( self.Weapon ) util.Effect( "ToolTracer", EffectData() ) if tr.Hit and tr.Entity:IsNPC() || tr.Entity:IsPlayer() then self:EmitSound( self.Secondary.Sound ) else self:EmitSound( self.Primary.Sound ) end self:ShootEffects() self:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self:SetNextSecondaryFire( CurTime() + self.Primary.Delay ) if self.Primary.Spread < self.Primary.SpreadMax then self.Primary.Spread = self.Primary.Spread + self.Primary.SpreadKick end self.Primary.SpreadTimer = CurTime() + self.Primary.SpreadTime self.Drop = 1 self.DropTimer = CurTime() + self.Primary.Delay self.Idle = 2 end function SWEP:ShootEffects() self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) self.Owner:SetAnimation( PLAYER_ATTACK1 ) end function SWEP:SecondaryAttack() end function SWEP:Reload() end function SWEP:IdleAnimation() if self.Idle == 0 then self.Idle = 1 end if SERVER and self.Idle == 1 then self.Weapon:SendWeaponAnim( ACT_VM_IDLE ) end self.IdleTimer = CurTime() + self.Owner:GetViewModel():SequenceDuration() end function SWEP:Think() self.Owner:GetViewModel():SetBodygroup( 2, GetConVar( "csgo_vm_hands" ):GetInt() ) self.ViewModelFOV = GetConVar( "csgo_vm_fov" ):GetInt() if self.Owner:IsOnGround() then if self.Owner:GetVelocity():Length() <= 100 then if self.Primary.SpreadTimer <= CurTime() then self.Primary.Spread = self.Primary.SpreadMin end if self.Primary.Spread > self.Primary.SpreadMin then self.Primary.Spread = ( ( self.Primary.SpreadTimer - CurTime() ) / self.Primary.SpreadTime ) * self.Primary.Spread end end if self.Owner:GetVelocity():Length() <= 100 and self.Primary.Spread > self.Primary.SpreadMax then self.Primary.Spread = self.Primary.SpreadMax end if self.Owner:GetVelocity():Length() > 100 then self.Primary.Spread = self.Primary.SpreadMove self.Primary.SpreadTimer = CurTime() + self.Primary.SpreadTime if self.Primary.Spread > self.Primary.SpreadMin then self.Primary.Spread = ( ( self.Primary.SpreadTimer - CurTime() ) / self.Primary.SpreadTime ) * self.Primary.SpreadMove end end end if !self.Owner:IsOnGround() then self.Primary.Spread = self.Primary.SpreadAir self.Primary.SpreadTimer = CurTime() + self.Primary.SpreadTime if self.Primary.Spread > self.Primary.SpreadMin then self.Primary.Spread = ( ( self.Primary.SpreadTimer - CurTime() ) / self.Primary.SpreadTime ) * self.Primary.SpreadAir end end if self.IdleTimer <= CurTime() then self:IdleAnimation() end if self.Drop == 1 and self.DropTimer <= CurTime() then if SERVER then local entity = ents.Create( "prop_physics" ) entity:SetModel( "models/csgo/weapons/w_eq_taser.mdl" ) entity:SetCollisionGroup( COLLISION_GROUP_WEAPON ) entity:DrawShadow( false ) entity:SetOwner( self.Owner ) if IsValid( entity ) then entity:SetPos( self.Owner:GetShootPos() + self.Owner:EyeAngles():Forward() * 16 ) entity:SetAngles( self.Owner:EyeAngles() ) entity:Spawn() entity:GetPhysicsObject():SetVelocity( self.Owner:EyeAngles():Forward() * 500 ) entity:GetPhysicsObject():AddAngleVelocity( Vector( math.Rand( -500, 500 ), math.Rand( -500, 500 ), math.Rand( -500, 500 ) ) ) end self.Owner:DropWeapon( self.Weapon ) self.Weapon:Remove() end end end