
if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	
end

if ( CLIENT ) then

	SWEP.PrintName			= "Hands"			
	SWEP.Author				= "1337bot"

	SWEP.Slot				= 1
	SWEP.SlotPos			= 1
	SWEP.IconLetter			= "f"
	SWEP.DrawCrosshair		= false
	
        killicon.AddFont( "weapon_knife", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )


end

-----------------------Main functions----------------------------
 
 function SWEP:Reload() --To do when reloading
 
   	if( self.Owner:KeyDown( IN_SPEED ) and self.Owner:GetVelocity():Length() >= 140 ) then return; end
  	
  	local trace = { }
	trace.start = self.Owner:EyePos();
	trace.endpos = trace.start + self.Owner:GetAimVector() * 60;
	trace.filter = self.Owner;
  	
  	local tr = util.TraceLine( trace );
  	
  	if( self.Owner:GetNWInt( "holstered" ) == 0 ) then
  
	  	if( self.Weapon:GetNWBool( "ironsights" ) ) then return; end
	  
		self.Weapon:EmitSound( self.SwingSounds[math.random( 1, #self.SwingSounds )] );
		
		self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER )
		
		self.Weapon:SetNextPrimaryFire( CurTime() + 1.4 - ( .8 * math.Clamp( self.Owner:GetNWInt( "sprint" ) / 100, 0, 1 ) )  );
		
		self.Owner:SetNWInt( "sprint", math.Clamp( self.Owner:GetNWInt( "sprint" ) - math.Clamp( 200 / self.Owner:GetNWFloat( "stat.Sprint" ), .01, 40 ), 0, self.Owner:GetNWInt("MaxSprint") )  );
			
		if( tr.Hit or tr.Entity:IsValid() ) then
			
			if( SERVER ) then
				
				if( tr.Entity:IsValid() ) then
			
					local norm = ( tr.Entity:GetPos() - self.Owner:GetPos() ):Normalize();
					local push = 2000 * norm;
					
					if( tr.Entity:IsPlayer() or tr.Entity:IsPlayerRagdoll() ) then
						local ply = tr.Entity;
						if( tr.Entity:IsPlayerRagdoll() ) then
							ply = tr.Entity:GetPlayer();
						end
						ply:HandlePunch( self.Owner, tr.HitGroup );
						push = 50 * norm;
						tr.Entity:SetVelocity( push );
					else
					
						IncreaseStat(self.Owner,"stat.Strength",0.35)
					
						tr.Entity:GetPhysicsObject():ApplyForceOffset( push, tr.HitPos );
					end
				
				end
				
			end
			
			self.Weapon:EmitSound( self.HitSounds[math.random( 1, #self.HitSounds )] );
			
		end
		
	elseif( tr.Entity:IsValid() and tr.Entity:IsDoor() ) then
	
		self.Weapon:EmitSound( Sound( "physics/wood/wood_crate_impact_hard2.wav" ) );
	
	end

  end
 
function SWEP:Think() -- Called every frame
end

function SWEP:Initialize()
util.PrecacheSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav")
util.PrecacheSound("weapons/iceaxe/iceaxe_swing1.wav")
end
 
function SWEP:PrimaryAttack()

if( self.Owner:GetNWInt( "holstered" ) == 0 ) then
  
	if( self.Weapon:GetNWBool( "ironsights" ) ) then return; end
self.Weapon:SetNextPrimaryFire(CurTime() + .4)

local trace = self.Owner:GetEyeTrace()

if trace.HitPos:Distance(self.Owner:GetShootPos()) <= 75 then
self.Weapon:SendWeaponAnim(ACT_VM_HITCENTER)
	bullet = {}
	bullet.Num    = 1
	bullet.Src    = self.Owner:GetShootPos()
	bullet.Dir    = self.Owner:GetAimVector()
	bullet.Spread = Vector(0, 0, 0)
	bullet.Tracer = 0
	bullet.Force  = 20
	bullet.Damage = 3
self.Owner:FireBullets(bullet)
self.Owner:SetAnimation( PLAYER_ATTACK1 );
self.Weapon:EmitSound("physics/flesh/flesh_impact_bullet" .. math.random( 3, 5 ) .. ".wav")
else
	self.Weapon:EmitSound("weapons/iceaxe/iceaxe_swing1.wav")
	self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
end

end
 
function SWEP:SecondaryAttack()

end


function SWEP:Initialize()
self:SetWeaponHoldType("melee")  
end 


-------------------------------------------------------------------

------------General Swep Info---------------
SWEP.Author   = "1337bot"
SWEP.Contact        = ""
SWEP.Purpose        = ""
SWEP.Instructions   = ""
SWEP.Spawnable      = false
SWEP.AdminSpawnable  = true
-----------------------------------------------

------------Models---------------------------
SWEP.ViewModel      = "models/weapons/v_fists.mdl"
SWEP.WorldModel   = ""
-----------------------------------------------

-------------Primary Fire Attributes----------------------------------------
SWEP.Primary.Delay			= 0.9 	--In seconds
SWEP.Primary.Recoil			= 0		--Gun Kick
SWEP.Primary.Damage			= 2	--Damage per Bullet
SWEP.Primary.NumShots		= 1		--Number of shots per one fire
SWEP.Primary.Cone			= 0 	--Bullet Spread
SWEP.Primary.ClipSize		= -1	--Use "-1 if there are no clips"
SWEP.Primary.DefaultClip	= -1	--Number of shots in next clip
SWEP.Primary.Automatic   	= true	--Pistol fire (false) or SMG fire (true)
SWEP.Primary.Ammo         	= "none"	--Ammo Type
-------------End Primary Fire Attributes------------------------------------
 
-------------Secondary Fire Attributes-------------------------------------
SWEP.Secondary.Delay		= 0.9
SWEP.Secondary.Recoil		= 0
SWEP.Secondary.Damage		= 0
SWEP.Secondary.NumShots		= 1
SWEP.Secondary.Cone			= 0
SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic   	= true
SWEP.Secondary.Ammo         = "none"
end
-------------End Secondary Fire Attributes--------------------------------