SWEP Particle

How do you emit a particle when using a SWEP? for example emit a fire when shooting

util.Effect + a Lua effect is the best way.

Ok thanks. Btw do you happen to know how to see why the weapon isn’t showing up in spawn menu?

Have you put it in a category? Or are there any errors?

You should use

SWEP:ShootEffects to create the muzzle flares.

Can’t find any errors and yea it’s in a category

-snip-

Even easier, have you set SWEP.Spawnable to true?


SWEP.Author = "Keeperman"
SWEP.Contact = "http://steamcommunity.com/id/Keeperman/"
SWEP.Purpose = ""
SWEP.Instructions = ""

SWEP.Spawnable = true
SWEP.AdminSpawnable = false

SWEP.HoldType = "normal"

SWEP.ViewModel = "models/thing.mdl"
SWEP.WorldModel = "models/thing.mdl"

SWEP.Primary.ClipSize		= -1
SWEP.Primary.DefaultClip	= -1
SWEP.Primary.Automatic		= false
SWEP.Primary.Ammo		= "none"
 
SWEP.Secondary.ClipSize	= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo		= "none" 

accidently removed the category

-snip-

So it’s all good now?

yea in cl_init

So it has a category or not? Usually you should set one :stuck_out_tongue:

it has a category but nothing is showing up in spawn menu

What’s the name of the category?
Is it laid out like:


SWEP.Author = "Your Name"
SWEP.Contact = "Your Email Address"
SWEP.Purpose = "What your SWep does."
SWEP.Instructions = "How to operate your SWep"
 
//The category that you SWep will be shown in, in the Spawn (Q) Menu 
//(This can be anything, GMod will create the categories for you)
SWEP.Category = "Category"
 
SWEP.Spawnable = true -- Whether regular players can see it
SWEP.AdminOnly = true -- Whether Admins/Super Admins can see it
 
SWEP.ViewModel = "models/weapons/v_RPG.mdl" -- This is the model used for clients to see in first person.
SWEP.WorldModel = "models/weapons/w_rocket_launcher.mdl" -- This is the model shown to all other clients and in third-person.
 


SWEP.Author = "Keeperman"
SWEP.Contact = "http://steamcommunity.com/id/Keeperman/"
SWEP.Purpose = ""
SWEP.Instructions = ""

SWEP.Spawnable = true
SWEP.AdminOnly = false

SWEP.Category = "Keeperman"

SWEP.HoldType = "normal"

SWEP.ViewModel = "models/thing.mdl"
SWEP.WorldModel = "models/thing.mdl"

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
 
SWEP.Secondary.ClipSize	= -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo	= "none"


SWEP.Author = "Keeperman"
SWEP.Contact = "http://steamcommunity.com/id/Keeperman/"
SWEP.Purpose = ""
SWEP.Instructions = ""

SWEP.Category = "Keeperman"

SWEP.Spawnable = true
SWEP.AdminOnly = true

SWEP.HoldType = "normal"

SWEP.ViewModel = "models/thing.mdl"
SWEP.WorldModel = "models/thing.mdl"

SWEP.Primary.ClipSize = -1
SWEP.Primary.DefaultClip = -1
SWEP.Primary.Automatic = false
SWEP.Primary.Ammo = "none"
 
SWEP.Secondary.ClipSize	= -1
SWEP.Secondary.DefaultClip = -1
SWEP.Secondary.Automatic = false
SWEP.Secondary.Ammo	= "none"

I just updated it as I found another error. Try it now.

Hm, still nothing

Can you show me your init.lua?

of course


AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )
include('shared.lua')
 
SWEP.Weight	= 5
SWEP.AutoSwitchTo = false
SWEP.AutoSwitchFrom	= false

Are there still no errors? I’m really confused as to why this isn’t working. Where are you looking to find the swep?

in spawn menu (under weapons tab)

Could you paste all of your swep’s code? Shared, init, and cl_init all in different blocks?