I’m making a SWEP, but it dosn’t show up in the weapon tab.
Why not?
The Lua code:
if ( SERVER ) then
AddCSLuaFile( "shared.lua" )
SWEP.HoldType = "pistol"
end
if ( CLIENT ) then
SWEP.PrintName = "G18"
SWEP.Author = "NinjaCat"
SWEP.Purpose = "Shoot stuff"
SWEP.Instructions = "Ever hold a gun on gmod? Use it like that one."
SWEP.Slot = 3
SWEP.SlotPos = 1
SWEP.IconLetter = "e"
killicon.AddFont( "weapon_pistol", "CSKillIcons", SWEP.IconLetter, Color( 255, 80, 0, 255 ) )
end
SWEP.DrawCrosshair = true
SWEP.DrawAmmo = true
SWEP.Spawnable = true
SWEP.AdminSpawnable = true
SWEP.ViewModel = "models/weapons/v_pist_glock18.mdl"
SWEP.WorldModel = "models/weapons/w_pist_glock18.mdl"
SWEP.Weight = 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom = false
SWEP.Primary.Recoil = 5
SWEP.Primary.Damage = 21
SWEP.Primary.NumShots = 1
SWEP.Primary.Cone = 0
SWEP.Primary.ClipSize = 20
SWEP.Primary.Delay = 2
SWEP.Primary.DefaultClip = 1
SWEP.Primary.Automatic = true
SWEP.Primary.Ammo = "smg1"
function SWEP:Initialize()
local sound = Sound("sound/clong-2.mp3")
ent:EmitSound( sound )
util.PrecacheSound("Weapon_pist_glock18.Single")
end
function SWEP:PrimaryAttack()
if ( !self:CanPrimaryAttack() ) then return end
self.Weapon:EmitSound(Sound("Weapon_pist_glock18.Single"))
self:ShootBullet( 100, 1, 0 )
self:TakePrimaryAmmo( 1 )
self.Owner:ViewPunch( Angle( -1, 0, 0 ) )
self.Weapon:SetNextPrimaryFire( CurTime() + 0.1 )if (SERVER) then
local owner=self.Owner
if self.Owner.SENT then
owner=self.Owner.SENT.Entity
end
end
I bet it’s something simple. :o