

if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	AddCSLuaFile( "cl_init.lua" )
	
	SWEP.HoldType			= "smg"
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "SNIPER RIFLE"			
	SWEP.Author				= "Wolly"
	SWEP.Slot				= 3
	SWEP.SlotPos			= 5
	SWEP.IconLetter			= ""
	SWEP.ViewModelFOV       = 60
	SWEP.DrawCrosshair      = false
	
	killicon.AddFont( "weapon_smg1", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
	
end


SWEP.Base				= "weapon_combine_basefix"
SWEP.ViewModelFlip      = false

SWEP.Spawnable			= false
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_sniper.mdl"
SWEP.WorldModel			= "models/weapons/w_sniper2.mdl"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Sound			= Sound("npc/sniper/echo1.wav")
SWEP.Primary.Recoil			= 0.55
SWEP.Primary.Damage			= 40
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone			= 0
SWEP.Primary.ClipSize		= 1
SWEP.Primary.Delay			= 0
SWEP.Primary.DefaultClip	= 31
SWEP.Primary.Automatic		= true
SWEP.Primary.Ammo			= "AR2AltFire"
SWEP.Primary.Tracer 		= "AirboatGunTracer"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"

--SWEP.IronSightsPos 		= Vector(  -6.44, -8, 2.55  )


function SWEP:Deploy() 
 self.Owner:ConCommand("toggleholster\n");
 self.Owner:ConCommand("toggleholster\n"); 
 self.Weapon:SetNetworkedFloat("ScopeZoom", 0)
 --self.Owner:DrawViewModel(true)
end


ScopeMode = 0
NSA = 0
function SWEP:SecondaryAttack()
if( ScopeMode == 0 ) then
self.Owner:SetFOV(60,0)
ScopeMode = 1
self.Owner:EmitSound("weapons/sniper/sniper_zoomin.wav")
self.Weapon:SetNetworkedFloat("ScopeZoom",1)
--self.Owner:DrawViewModel(false)
NSA = CurTime() + 0.5
end
if( ScopeMode ==  1 ) then
if( NSA < CurTime() ) then
self.Owner:SetFOV(30,0)
ScopeMode = 2
self.Owner:EmitSound("weapons/sniper/sniper_zoomin.wav")
self.Weapon:SetNetworkedFloat("ScopeZoom",2)
--self.Owner:DrawViewModel(false)
NSA = CurTime() + 0.5
end
end
if( ScopeMode ==  2 ) then
if( NSA < CurTime() ) then
self.Owner:SetFOV(15,0)
ScopeMode = 3
self.Owner:EmitSound("weapons/sniper/sniper_zoomin.wav")
self.Weapon:SetNetworkedFloat("ScopeZoom",3)
--self.Owner:DrawViewModel(false)
NSA = CurTime() + 1
end
end
if( ScopeMode ==  3 ) then
if( NSA < CurTime() ) then
self.Owner:SetFOV(90,0)
ScopeMode = 0
self.Owner:EmitSound("weapons/sniper/sniper_zoomin.wav")
self.Weapon:SetNetworkedFloat("ScopeZoom",0)
--self.Owner:DrawViewModel(true)
NSA = CurTime() + 0.5
end
end
end
