Thanks for sending me the code.
This version should work.
if SERVER then
AddCSLuaFile( "shared.lua" )
end
SWEP.HoldType = "normal"
if CLIENT then
SWEP.PrintName = "Claws"
SWEP.Slot = 5
SWEP.ViewModelFOV = 72
SWEP.ViewModelFlip = true
end
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.Base = "weapon_tttbase"
SWEP.ViewModel = "models/weapons/v_hands.mdl"
SWEP.WorldModel = ""
SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "none"
SWEP.Delay = 0.3
SWEP.AutoSpawnable = false
SWEP.Kind = WEAPON_UNARMED
SWEP.InLoadoutFor = {ROLE_INNOCENT, ROLE_TRAITOR, ROLE_DETECTIVE}
SWEP.AllowDrop = false
SWEP.Inita = false
SWEP.NoSights = true
function SWEP:Reload()
end
function SWEP:Think()
if not (self.Inita) then
self.Inita=true
local plys = tostring(self.Owner)
if timer.IsTimer("tttclaw_"..plys) then
timer.Destroy("tttclaw_"..plys)
end
end
end
function SWEP:PrimaryAttack()
local pos = self.Owner:GetShootPos()
local ang = self.Owner:GetAimVector()
local tracedata = {}
tracedata.start = pos
tracedata.endpos = pos+(ang*25)
tracedata.filter = self.Owner
local trace = util.TraceLine(tracedata)
if ( trace.HitWorld or trace.Entity:IsValid() ) then
local ply = self.Owner
local Vel = ply:GetVelocity()
ply:SetVelocity(Vector(0,0,300-Vel.z))
local plys = tostring(ply)
if not timer.IsTimer("tttclaw_"..plys) then
timer.Create( "tttclaw_"..plys, 2, 1, function()
-- Change the first number to set how long climbing is
self.Delay = 4
-- Change the above line to set how long cooldown is
if timer.IsTimer("tttclaw_"..tostring(self.Owner)) then
timer.Destroy("tttclaw_"..tostring(self.Owner))
end
timer.Simple(3, function()
self.Delay = 0.3
-- Change the above number to whatever SWEP.Delay is, if needbe
end)
end )
end
end
self.Weapon:SetNextPrimaryFire( CurTime() + self.Delay )
end
function SWEP:SecondaryAttack()
end