if (SERVER) then AddCSLuaFile("shared.lua") end
if (CLIENT) then
	SWEP.DrawAmmo			= true
	SWEP.DrawCrosshair		= false
	SWEP.ViewModelFOV			= 45
	SWEP.ViewModelFlip		= true
	SWEP.IconLetter			= "f"
	killicon.AddFont("weapon_csgo_deagle", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
end
if ( CLIENT ) then

	SWEP.PrintName			= "Desert Eagle (CSGO)"			
	SWEP.Author				= "Counter-Strike: Global Offensive"
	SWEP.Slot				= 1
	SWEP.SlotPos			= 5
	SWEP.IconLetter			= "d"
	
	killicon.AddFont( "weapon_glock", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
	
	util.PrecacheSound("weapons/pistol/pistol_reload1.wav")
	util.PrecacheSound("weapons/pistol_bms/single.wav")
	
end

SWEP.HoldType			= "pistol"
SWEP.Base				= "weapon_classiq_base"
SWEP.Category			= "Counter-Strike: Global Offensive"

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.UseHands 			= true
SWEP.ViewModelFlip		= false
SWEP.ViewModelFOV		= 55
SWEP.ViewModel			= "models/weapons/c_csgo_deagle.mdl"
SWEP.WorldModel			= "models/weapons/csgo_world/w_pist_deagle.mdl"

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

SWEP.Primary.Sound 			= Sound("CsGO/deagle/deagle-1.wav")
SWEP.Primary.Reload 		= Sound("")
SWEP.Primary.Recoil 		= 1.1
SWEP.Primary.Damage 		= 62
SWEP.Primary.NumShots 		= 1
SWEP.Primary.Cone 			= 0.01
SWEP.Primary.ClipSize 		= 7
SWEP.Primary.Delay 			= 0.3
SWEP.Primary.DefaultClip 	= 35
SWEP.Primary.Automatic 		= false
SWEP.Primary.Ammo 			= "pistol"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"
----
SWEP.IronSightsPos = Vector(-4.64, -7.362, 0.239)
SWEP.IronSightsAng = Vector(0, 0, 0)

function SWEP:DrawWorldModel()
	if not IsValid(self.Owner) then self:DrawModel() return end
	
	local hand, offset, rotate
	hand = self.Owner:GetAttachment(self.Owner:LookupAttachment("anim_attachment_rh"))

	offset = hand.Ang:Right() * 0.5 + hand.Ang:Forward() * -2.8 + hand.Ang:Up() * 0.2

	hand.Ang:RotateAroundAxis(hand.Ang:Right(), 0)
	hand.Ang:RotateAroundAxis(hand.Ang:Forward(), 10)
	hand.Ang:RotateAroundAxis(hand.Ang:Up(), 0)

	self:SetRenderOrigin(hand.Pos + offset)
	self:SetRenderAngles(hand.Ang)

	self:DrawModel();if (CLIENT) then self:SetModelScale(1,1,1) end
end

--
-- Sound data
--
local soundData = {
    name 		= "Weapon_Cdeagle.Clipout" ,
    channel 	= CHAN_ITEM,
    volume 		= 0.25,
    soundlevel 	= 80,
    pitchstart 	= 100,
    pitchend 	= 100,
    sound 		= "CsGO/deagle/de_clipout.wav"
}

sound.Add(soundData)

local soundData = {
    name 		= "Weapon_Cdeagle.Clipin" ,
    channel 	= CHAN_ITEM,
    volume 		= 0.25,
    soundlevel 	= 80,
    pitchstart 	= 100,
    pitchend 	= 100,
    sound 		= "CsGO/deagle/de_clipin.wav"
}

sound.Add(soundData)

local soundData = {
    name 		= "Weapon_Cdeagle.Slideforward" ,
    channel 	= CHAN_ITEM,
    volume 		= 0.25,
    soundlevel 	= 80,
    pitchstart 	= 100,
    pitchend 	= 100,
    sound 		= "CsGO/deagle/de_slideforward.wav"
}

sound.Add(soundData)


local soundData = {
    name 		= "Weapon_Cdeagle.Slideback" ,
    channel 	= CHAN_ITEM,
    volume 		= 0.25,
    soundlevel 	= 80,
    pitchstart 	= 100,
    pitchend 	= 100,
    sound 		= "CsGO/deagle/de_slideback.wav"
}

sound.Add(soundData)

local soundData = {
    name 		= "Weapon_Cdeagle.Draw" ,
    channel 	= CHAN_ITEM,
    volume 		= 0.25,
    soundlevel 	= 80,
    pitchstart 	= 100,
    pitchend 	= 100,
    sound 		= "CsGO/deagle/de_draw.wav"
}

sound.Add(soundData)