if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
SWEP.HoldType = "melee"
end
if ( CLIENT ) then
SWEP.PrintName = "Sweet Bananna"
SWEP.Author = "SMOD"
SWEP.Slot = 1
SWEP.SlotPos = 1
SWEP.ViewModelFOV = 60
SWEP.IconLetter = "x"
end
------------General Swep Info---------------
SWEP.Author = "SMOD"
SWEP.Instructions = "Left click throws a Banana. Right click blows all of them up"
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
-----------------------------------------------
------------Models---------------------------
SWEP.ViewModel = "models/weapons/v_banana.mdl"
SWEP.WorldModel = "models/weapons/w_banana.mdl"
-----------------------------------------------
-------------Primary Fire Attributes----------------------------------------
SWEP.Primary.Delay = 0.01 --In seconds
SWEP.Primary.Recoil = 0 --Gun Kick
SWEP.Primary.Damage = 0 --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 = false --Pistol fire (false) or SMG fire (true)
SWEP.Primary.Ammo = "none" --Ammo Type
-------------End Primary Fire Attributes------------------------------------
-------------Secondary Fire Attributes-------------------------------------
SWEP.Secondary.Delay = 0.01
SWEP.Secondary.Recoil = 0
SWEP.Secondary.Damage = 0
SWEP.Secondary.NumShots = 0
SWEP.Secondary.Cone = 0
SWEP.Secondary.ClipSize = 0
SWEP.Secondary.DefaultClip = 0
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo = "none"
-------------End Secondary Fire Attributes--------------------------------
function SWEP:Reload()
end
if ( CLIENT ) then
function SWEP:GetViewModelPosition( pos, ang )
pos = pos + ang:Forward()*4
return pos, ang
end
end
function SWEP:Think() -- Called every frame
end
function SWEP:PrimaryAttack()
self.Weapon:EmitSound("weapons/bananna/throw.wav")
self.Weapon:SetNextPrimaryFire(CurTime() + 0.01)
self.Weapon:SendWeaponAnim(ACT_VM_THROW)
if SERVER then
local banana = ents.Create("ent_sweetbananna")
banana:SetAngles(self.Owner:EyeAngles())-- Angle(0,90,0))
banana:SetPos(self.Owner:GetShootPos())
banana:SetOwner(self.Owner)
banana:SetPhysicsAttacker(self.Owner)
banana:Spawn()
banana:Activate()
local phys = banana:GetPhysicsObject()
phys:SetVelocity(self.Owner:GetAimVector()*7000)
phys:AddAngleVelocity(Vector(0,0,50))
end
end
function SWEP:Idle()
self.Weapon:SendWeaponAnim(ACT_VM_IDLE)
end