Welcome, Guest. Please login or register.
Did you miss your activation email?
November 10, 2024, 06:47:27 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom Weapons do Not Work?
Pages: [1]
Author Topic: Custom Weapons do Not Work?  (Read 4237 times)
Idek912
Poster

Posts: 2


« on: November 20, 2011, 01:09:00 AM »

Me and a brah have a TTT server. However is it Vanilla and we wanna add a few things. However the weapons are not showing up in game and we can't use the console command to obtain them. For example, the Kalashnikov. In the weapons folder, there is a weapon_ttt_kalashnikov folder. Inside there is a shared.lua with this code:

Quote
---- Example TTT custom weapon

-- First some standard GMod stuff
if SERVER then
  AddCSLuaFile( "shared.lua" )
end

if CLIENT then
  SWEP.PrintName = "Kalashnikov"
  SWEP.Slot      = 6 -- add 1 to get the slot number key

  SWEP.ViewModelFOV  = 72
  SWEP.ViewModelFlip = true
end

-- Always derive from weapon_tttbase.
SWEP.Base = "weapon_tttbase"

--- Standard GMod values

SWEP.HoldType = "ar2"

SWEP.Primary.Delay      = 0.08
SWEP.Primary.Recoil      = 1.9
SWEP.Primary.Automatic  = true
SWEP.Primary.Damage      = 25
SWEP.Primary.Cone        = 0.025
SWEP.Primary.Ammo        = "smg1"
SWEP.Primary.ClipSize    = 45
SWEP.Primary.ClipMax    = 90
SWEP.Primary.DefaultClip = 45
SWEP.Primary.Sound      = Sound( "Weapon_AK47.Single" )

SWEP.IronSightsPos = Vector( 6.05, -5, 2.4 )
SWEP.IronSightsAng = Vector( 2.2, -0.1, 0 )

SWEP.ViewModel  = "models/weapons/v_rif_ak47.mdl"
SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl"


--- TTT config values

-- Kind specifies the category this weapon is in. Players can only carry one of
-- each. Can be: WEAPON_... MELEE, PISTOL, HEAVY, NADE, CARRY, EQUIP1, EQUIP2 or ROLE.
-- Matching SWEP.Slot values: 0      1      2    3      4      6      7        8
SWEP.Kind = WEAPON_EQUIP1

-- If AutoSpawnable is true and SWEP.Kind is not WEAPON_EQUIP1/2, then this gun can
-- be spawned as a random weapon. Of course this AK is special equipment so it won't,
-- but for the sake of example this is explicitly set to false anyway.
SWEP.AutoSpawnable = false

-- The AmmoEnt is the ammo entity that can be picked up when carrying this gun.
SWEP.AmmoEnt = "item_ammo_smg1_ttt"

-- CanBuy is a table of ROLE_* entries like ROLE_TRAITOR and ROLE_DETECTIVE. If
-- a role is in this table, those players can buy this.
SWEP.CanBuy = { ROLE_TRAITOR }

-- InLoadoutFor is a table of ROLE_* entries that specifies which roles should
-- receive this weapon as soon as the round starts. In this case, none.
SWEP.InLoadoutFor = nil

-- If LimitedStock is true, you can only buy one per round.
SWEP.LimitedStock = false

-- If AllowDrop is false, players can't manually drop the gun with Q
SWEP.AllowDrop = true

-- If IsSilent is true, victims will not scream upon death.
SWEP.IsSilent = false

-- If NoSights is true, the weapon won't have ironsights
SWEP.NoSights = false

-- Equipment menu information is only needed on the client
if CLIENT then
  -- Path to the icon material
  SWEP.Icon = "VGUI/ttt/icon_myserver_ak47"

  -- Text shown in the equip menu
  SWEP.EquipMenuData = {
      type = "Kalashnikov",
      desc = "A loud, rapid Russian killer. Uses SMG ammo."
  };
end

-- Tell the server that it should download our icon to clients.
if SERVER then
  -- It's important to give your icon a unique name. GMod does NOT check for
  -- file differences, it only looks at the name. This means that if you have
  -- an icon_ak47, and another server also has one, then players might see the
  -- other server's dumb icon. Avoid this by using a unique name.
  resource.AddFile("materials/VGUI/ttt/icon_myserver_ak47.vmt")
end

nrich588
Poster

Posts: 253

WzG Owner


« Reply #1 on: November 20, 2011, 08:57:29 AM »

Under type in swep menu data, change it to weapon.
Kalashnikov made a lot of weapons consider name revision.
Anonymous
Poster

Posts: 126


« Reply #2 on: November 22, 2011, 09:32:08 PM »

Sent you a PM.

Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Custom Weapons do Not Work? « 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.011 seconds with 17 queries.