• SWEP Particle
    38 replies, posted
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.
[QUOTE=Robotboy655;49544409]util.Effect + a Lua effect is the best way.[/QUOTE] Ok thanks. Btw do you happen to know how to see why the weapon isn't showing up in spawn menu?
[QUOTE=keeperman;49544426]Ok thanks. Btw do you happen to know how to see why the weapon isn't showing up in spawn menu?[/QUOTE] Have you put it in a category? Or are there any errors? You should use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=https://wiki.garrysmod.com/page/WEAPON/ShootEffects]SWEP:ShootEffects[/url] to create the muzzle flares.
[QUOTE=Promptitude;49544479]Have you put it in a category? Or are there any errors? You should use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=https://wiki.garrysmod.com/page/WEAPON/ShootEffects]SWEP:ShootEffects[/url] to create the muzzle flares.[/QUOTE] Can't find any errors and yea it's in a category
[QUOTE=keeperman;49544539]Can't find any errors and yea it's in a category[/QUOTE] -snip- Even easier, have you set SWEP.Spawnable to true?
[code]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" [/code] accidently removed the category
[QUOTE=keeperman;49544659][code]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" [/code][/QUOTE] -snip- So it's all good now?
[QUOTE=Promptitude;49544684]Have you set it's PrintName?[/QUOTE] yea in cl_init
[QUOTE=keeperman;49544691]yea in cl_init[/QUOTE] So it has a category or not? Usually you should set one :P
[QUOTE=Promptitude;49544704]So it has a category or not? Usually you should set one :P[/QUOTE] it has a category but nothing is showing up in spawn menu
[QUOTE=keeperman;49544715]it has a category but nothing is showing up in spawn menu[/QUOTE] What's the name of the category? Is it laid out like: [CODE]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. [/CODE] - [url=https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html]Wiki[/url]
[QUOTE=Promptitude;49544756]What's the name of the category? Is it laid out like: [CODE]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.AdminSpawnable = 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. [/CODE] - [url=https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index8e50.html]Wiki[/url][/QUOTE] [code]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"[/code]
[QUOTE=keeperman;49544769][code]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"[/code][/QUOTE] [CODE]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"[/CODE] I just updated it as I found another error. Try it now.
[QUOTE=Promptitude;49544790][CODE]SWEP.Author = "Keeperman" SWEP.Contact = "http://steamcommunity.com/id/Keeperman/" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "Keeperman" SWEP.Spawnable = true SWEP.AdminSpawnable = 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"[/CODE] I just updated it as I found another error. Try it now.[/QUOTE] Hm, still nothing
[QUOTE=keeperman;49544850]Hm, still nothing[/QUOTE] Can you show me your init.lua?
[QUOTE=Promptitude;49544869]Can you show me your init.lua?[/QUOTE] of course [code]AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false[/code]
Are there still no errors? I'm really confused as to why this isn't working. Where are you looking to find the swep?
[QUOTE=Promptitude;49544882]Are there still no errors? I'm really confused as to why this isn't working. Where are you looking to find the swep?[/QUOTE] in spawn menu (under weapons tab)
[QUOTE=keeperman;49544888]in spawn menu (under weapons tab)[/QUOTE] Could you paste all of your swep's code? Shared, init, and cl_init all in different blocks?
I can show the majority of them shared: [code]SWEP.Author = "Keeperman" SWEP.Contact = "http://steamcommunity.com/id/Keeperman/" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "Keeperman" SWEP.Spawnable = true SWEP.AdminOnly = 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" function SWEP:Primary() end function SWEP:Reload() end function SWEP:Think() end[/code] cl_init [code]include('shared.lua') SWEP.PrintName = "Pipe" SWEP.Slot = 5 SWEP.SlotPos = 99 SWEP.DrawAmmo = false SWEP.DrawCrosshair = false[/code] init [code]AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false[/code]
I updated the code before, put it in again and tell me the results.
[QUOTE=Promptitude;49544947]I updated the code before, put it in again and tell me the results.[/QUOTE] which one?
[QUOTE=keeperman;49544967]which one?[/QUOTE] [CODE]SWEP.Author = "Keeperman" SWEP.Contact = "http://steamcommunity.com/id/Keeperman/" SWEP.Purpose = "" SWEP.Instructions = "" SWEP.Category = "Keeperman" SWEP.Spawnable = true SWEP.AdminOnly = 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"[/CODE]
still nothing
[QUOTE=keeperman;49545011]still nothing[/QUOTE] How are you checking if it's working?
[QUOTE=Promptitude;49545025]How are you checking if it's working?[/QUOTE] I apply the new code then reload and check the weapons tab and see if its there
[QUOTE=keeperman;49545038]I apply the new code then reload and check the weapons tab and see if its there[/QUOTE] Where is the code? Is this on single player or are you using a server?
single player
[QUOTE=keeperman;49545074]single player[/QUOTE] [QUOTE=Promptitude;49545052]Where is the code?[/QUOTE]
Sorry, you need to Log In to post a reply to this thread.