-- #################################################################################### -- ## ## -- ## ## -- ## CASUAL BANANAS CONFIDENTIAL ## -- ## ## -- ## __________________________ ## -- ## ## -- ## ## -- ## Copyright 2014 (c) Casual Bananas ## -- ## All Rights Reserved. ## -- ## ## -- ## NOTICE: All information contained herein is, and remains ## -- ## the property of Casual Bananas. The intellectual and technical ## -- ## concepts contained herein are proprietary to Casual Bananas and may be ## -- ## covered by U.S. and Foreign Patents, patents in process, and are ## -- ## protected by trade secret or copyright law. ## -- ## Dissemination of this information or reproduction of this material ## -- ## is strictly forbidden unless prior written permission is obtained ## -- ## from Casual Bananas ## -- ## ## -- ## _________________________ ## -- ## ## -- ## ## -- ## Casual Bananas is registered with the "Kamer van Koophandel" (Dutch ## -- ## chamber of commerce) in The Netherlands. ## -- ## ## -- ## Company (KVK) number : 59449837 ## -- ## Email : info@casualbananas.com ## -- ## ## -- ## ## -- #################################################################################### AddCSLuaFile() if SERVER then SWEP.Weight = 5; SWEP.AutoSwitchTo = false; SWEP.AutoSwitchFrom = false; end if CLIENT then SWEP.DrawCrosshair = false; SWEP.ViewModelFlip = false; SWEP.DrawWeaponInfoBox = false; SWEP.ViewModelFOV = 54 end SWEP.Slot = 3 SWEP.SlotPos = 1 ; SWEP.Author = "Excl"; SWEP.Contact = ""; SWEP.Purpose = ""; SWEP.Instructions = ""; SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.PrintName = "Knife" SWEP.UseHands = true; SWEP.ViewModel = "models/weapons/cstrike/c_knife_t.mdl" SWEP.WorldModel = "models/weapons/w_knife_t.mdl" SWEP.Weight = 5 SWEP.DrawCrosshair = false SWEP.ViewModelFlip = false SWEP.Primary.Damage = 25 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Delay = 0.5 SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" SWEP.Secondary.Delay = 5 SWEP.HoldType = "knife" SWEP.HitDistance = 50; local sound_single =Sound("weapons/knife/knife_slash1.wav") function SWEP:Initialize() self:SetWeaponHoldType(self.HoldType) end function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) if not IsValid(self.Owner) then return end if self.Owner.LagCompensation and SERVER then self.Owner:LagCompensation(true); end self.Owner:SetAnimation( PLAYER_ATTACK1 ) local spos = self.Owner:GetShootPos() local sdest = spos + (self.Owner:GetAimVector() * 70) local tr_main = util.TraceLine( { start = self.Owner:GetShootPos(), endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance, filter = self.Owner } ) if ( !IsValid( tr_main.Entity ) ) then tr_main = util.TraceHull( { start = self.Owner:GetShootPos(), endpos = self.Owner:GetShootPos() + self.Owner:GetAimVector() * self.HitDistance, filter = self.Owner, mins = Vector( -15, -15, -8 ), maxs = Vector( 15, 15, 8 ) } ) end local hitEnt = tr_main.Entity self.Weapon:EmitSound(sound_single) if IsValid(hitEnt) or tr_main.HitWorld then self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) if SERVER and IsFirstTimePredicted() then local edata = EffectData() edata:SetStart(spos) edata:SetOrigin(tr_main.HitPos) edata:SetNormal(tr_main.Normal) edata:SetEntity(hitEnt) if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then util.Effect("BloodImpact", edata) self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=0}); else util.Effect("Impact", edata) end end else self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) end if CLIENT then -- used to be some shit here else if hitEnt and hitEnt:IsValid() then local dmg = DamageInfo() dmg:SetDamage(self.Primary.Damage) dmg:SetAttacker(self.Owner) dmg:SetInflictor(self.Weapon) dmg:SetDamageForce(self.Owner:GetAimVector() * 1500) dmg:SetDamagePosition(self.Owner:GetPos()) dmg:SetDamageType(DMG_CLUB) hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest) end end if self.Owner.LagCompensation and SERVER then self.Owner:LagCompensation(false) end end function SWEP:SecondaryAttack() end function SWEP:GetClass() return "jb_knife" end function SWEP:OnDrop() end function SWEP:DrawWeaponSelection(x, y, wide, tall, alpha) draw.SimpleText(self.IconLetter, "CSSelectIcons", x + wide / 2, y + tall * 0.2, Color(255, 210, 0, 255), TEXT_ALIGN_CENTER) -- Draw a CS:S select icon self:PrintWeaponInfo(x + wide + 20, y + tall * 0.95, alpha) -- Print weapon information end