if ( CLIENT ) then SWEP.Author = "CSE - Night-Eagle" SWEP.Contact = "gmail sedhdi" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.PrintName = "CSE Scout" SWEP.Instructions = "" SWEP.Slot = 2 SWEP.SlotPos = 0 SWEP.IconLetter = "n" killicon.AddFont("cse_scout","CSKillIcons",SWEP.IconLetter,Color(255,80,0,255)) end if ( SERVER ) then AddCSLuaFile( "shared.lua" ) end SWEP.Base = "cse_base_s" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_snip_scout.mdl" SWEP.WorldModel = "models/weapons/w_snip_scout.mdl" SWEP.HoldType = "ar2" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound("Weapon_Scout.Single") SWEP.Primary.Recoil = 8 SWEP.Primary.Unrecoil = 8 SWEP.Primary.Damage = 40 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0 SWEP.Primary.ClipSize = 11 SWEP.Primary.Delay = 0.06 //Don't use this, use the tables below! SWEP.Primary.DefaultClip = 61 //Always set this 1 higher than what you want. SWEP.Primary.Automatic = true //Don't use this, use the tables below! SWEP.Primary.Ammo = "smg1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" //Firemode configuration SWEP.data = {} SWEP.mode = "semi" //The starting firemode SWEP.data.newclip = false //Do not change this SWEP.data.zoomfov = 45 SWEP.data.snipefov = 15 SWEP.data.scope = true SWEP.data.semi = {} SWEP.data.semi.Delay = 1.2 SWEP.data.semi.Cone = 0.05 SWEP.data.semi.ConeZoom = 0.001 //End of configuration function SWEP:Think() if SinglePlayer() then self.data.singleplayer(self) end if self.data.init then self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) self.data.init = nil end if self.data.newclip then if self.data.newclip == 0 then self.data.newclip = false if self:Ammo1() > self.Primary.ClipSize - 1 then if self.data.oldclip == 0 then self.Weapon:SetClip1( self.Weapon:Clip1() - 1 ) if SERVER then self.Owner:GiveAmmo(1,self.Primary.Ammo,true) end end end else self.data.newclip = self.data.newclip - 1 end end if self.rezoom then if self.rezoom <= CurTime() then self.Owner:SetFOV(self.zoomto,.3) self.rezoom = nil self.zoomto = nil end end end function SWEP:PrimaryAttack() if ( !self:CanPrimaryAttack() ) or self.data.newclip or self.data.init then return end if CLIENT then self.xhair.loss = self.xhair.loss + self.Primary.Recoil end --self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextPrimaryFire( CurTime() + self.data[self.mode].Delay ) self.Weapon:EmitSound(self.Primary.Sound) self:TakePrimaryAmmo( 1 ) self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) ) if self.Owner:GetFOV() == 90 then self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.data[self.mode].Cone ) else self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.data[self.mode].ConeZoom ) if SERVER then self.zoomto = self.Owner:GetFOV() self.Owner:SetFOV(90,.3) self.rezoom = CurTime() + self.data[self.mode].Delay end end end function SWEP:Deploy() if SERVER then self.zoomto = nil self.rezoom = nil end return true end function SWEP:SecondaryAttack() if ( !self:CanPrimaryAttack() ) or self.data.newclip or self.data.init or self.rezoom then return end if self.Owner:KeyDown(IN_USE) then self.data[self.mode].Init(self) elseif SERVER then if self.Owner:GetFOV() == 90 then self.Owner:SetFOV(self.data.zoomfov,.3) elseif self.Owner:GetFOV() == self.data.zoomfov and self.data.snipefov > 0 then self.Owner:SetFOV(self.data.snipefov,.3) else self.Owner:SetFOV(90,.3) end end end function SWEP:Reload() if SERVER and self.Owner:GetFOV() ~= 90 then self.Owner:SetFOV(90,.3) end self.data.oldclip = self.Weapon:Clip1() self.Weapon:DefaultReload(ACT_VM_RELOAD) self.data.newclip = 1 if SERVER then self.zoomto = nil self.rezoom = nil end end