Welcome, Guest. Please login or register.
Did you miss your activation email?
November 23, 2024, 03:06:28 PM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: custom wep help
Pages: [1]
Author Topic: custom wep help  (Read 4741 times)
Gamementors
Poster

Posts: 5


« on: August 29, 2010, 03:28:37 AM »

hi i need help on adding a limit on how long u can use a wep,

it is called claws, i wanted to add a script so were u hold u stay and also that u can only climb something for like 3 or 4 seconds. so i was wondering if any one could help me with this problem :D.
Manmax75
Poster

Posts: 254


Programming Guy


« Reply #1 on: August 29, 2010, 05:30:45 AM »

u could make a timer that calls the holster event that would make the person put away the claws

Ride Forward and Thrust Your Pelvis In The Dark Void. The One Induced By Pleasure Yet Cast By The Bigger Picture.
Charles445
Build Tester
*
Posts: 2338


I LOVE THIS AVATAR


« Reply #2 on: August 29, 2010, 07:42:36 PM »

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

del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.

Bookcases, Bookcases Everywhere
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #3 on: August 29, 2010, 11:44:55 PM »

Lol, trying to copy from nnjg.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: custom wep help « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.01 seconds with 17 queries.