if ( SERVER ) then

	AddCSLuaFile( "shared.lua" )
	
	SWEP.HoldType			= 

"Pistol"
	
end

if ( CLIENT ) then

	SWEP.PrintName			= 

"Melon Gun"			
	SWEP.Author				

= "Sam Wilkinson"

	SWEP.Slot				

= 5
	SWEP.SlotPos			= 7
	SWEP.ViewModelFOV		= 62
	SWEP.IconLetter			= "x"

end

------------General Swep Info---------------
SWEP.Author   = "Sam Wilkinson"
SWEP.Contact        = "samwilki@live.co.uk"
SWEP.Purpose        = "Shoots melons FTW."
SWEP.Instructions   = "Press left mouse button to fire."
SWEP.Spawnable      = true
SWEP.AdminSpawnable  = true
--------------------------------------------

---

------------Models---------------------------
SWEP.ViewModel      = 

"models/weapons/v_pistol.mdl"
SWEP.WorldModel   = 

"models/weapons/w_pistol.mdl"
--------------------------------------------

---

-------------Primary Fire Attributes--------

--------------------------------
SWEP.Primary.Delay			= 0.9 

	--In seconds
SWEP.Primary.Recoil			= 0	

	--Gun Kick
SWEP.Primary.Damage			= 15	

--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 Secondary Fire Attributes--

------------------------------
 
-- function SWEP:Reload() --To do when 

reloading
-- 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()
self.Weapon:EmitSound

("weapons/iceaxe/iceaxe_swing1.wav")
self.Weapon:SetNextPrimaryFire(CurTime() + 

.4)
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
if SERVER then
local bar = ents.Create("prop_physics")
bar:SetModel

("models/props_junk/watermelon01.mdl")
bar:SetAngles(self.Owner:EyeAngles())-- 

Angle(0,90,0))
bar:SetPos(self.Owner:GetShootPos())
bar:SetOwner(self.Owner)
bar:SetPhysicsAttacker(self.Owner)
bar:Spawn()
local phys = bar:GetPhysicsObject()
phys:ApplyForceCenter

(self.Owner:GetAimVector() * 19999)
phys:AddAngleVelocity(Vector(0,5000,0))
bar:Fire("kill", "", 5)
end
end

--------------------------------------------

-------------------------------


--------------------------------------------

-------------------------------

function SWEP:SecondaryAttack()
self.Weapon:EmitSound

("weapons/iceaxe/iceaxe_swing1.wav")
self.Weapon:SetNextSecondaryFire(CurTime() + 

.4)
self.Weapon:SendWeaponAnim(ACT_VM_MISSCENTER)
if SERVER then
local bar = ents.Create("prop_physics")
bar:SetModel

("models/props_junk/watermelon01.mdl")
bar:SetAngles(self.Owner:EyeAngles())-- 

Angle(0,90,0))
bar:SetPos(self.Owner:GetShootPos())
bar:SetOwner(self.Owner)
bar:SetPhysicsAttacker(self.Owner)
bar:Spawn()
local phys = bar:GetPhysicsObject()
phys:ApplyForceCenter

(self.Owner:GetAimVector() * 1999999999)
phys:AddAngleVelocity(Vector(0,5000000,0))
bar:Fire("kill", "", 5)
end
end
--------------------------------------------

-----------------------