---- Example TTT custom weapon
-- First some standard GMod stuff
if SERVER then
AddCSLuaFile( "shared.lua" )
end
if CLIENT then
SWEP.PrintName = "F2000"
SWEP.Slot = 2 -- add 1 to get the slot number key
SWEP.ViewModelFOV = 70
SWEP.ViewModelFlip = false
end
-- Always derive from weapon_tttbase.
SWEP.Base = "weapon_tttbase"
--- Standard GMod values
SWEP.HoldType = "ar2"
SWEP.Primary.Delay = 0.08
SWEP.Primary.Recoil = .8
SWEP.Primary.Automatic = true
SWEP.Primary.Damage = 15
SWEP.Primary.Cone = 0.015
SWEP.Primary.Ammo = "ar2"
SWEP.Primary.ClipSize = 30
SWEP.Primary.ClipMax = 50
SWEP.Primary.DefaultClip = 30
SWEP.Primary.Sound = Sound( "weapons/mw2_f2000/galil-1.wav" )
SWEP.IronSightsPos = Vector( -3.4375, -4.8219, 1.1775 )
SWEP.IronSightsAng = Vector( -1.1046, -0.1484, 0 )
SWEP.ViewModel = "models/weapons/v_mw1_galil.mdl"
SWEP.WorldModel = "models/weapons/w_rif_famas.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_HEAVY
-- 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 = true
-- The AmmoEnt is the ammo entity that can be picked up when carrying this gun.
SWEP.AmmoEnt = "item_ammo_pistol_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 = { }
-- 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 = "Weapon",
desc = "Example custom weapon."
};
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
This relies on a model I got from the toybox. I could always zip them up.
This is easy to write, and it makes a weapon which relies on weapon_tttbase.
If we make the weapons with different qualities but still balanced (in which I could help, with community influence), then it would be simple to implement and upkeep.
The appeal is that it would be something rare to find these new weapons, since the only way for them to spawn would be if they are enabled in random spawning entities, and then it would have to win from all the other guns. That would make it fun to find one, even if they are lesser guns than the ttt default weapons.
We talked with coolz about this: hes gonna do a bit of research and get back to us.
EDIT: Also, to add the weapon to the game you would put it in garrysmod/garrysmod/gamemodes/terrortown/entities/weapons