Server Spawnlist Categories [SOLVED]
(In advance: Sorry if this is the wrong area, no where else seemed right) Hello!
I've been looking to move some RP props into a single category on the spawnlist (An example would be like the TDM props), as well as whitelisted props into one category for my PoliceRP server so people know what they're able to spawn, what they can't spawn. Also making it to find the additional props I have added to the server to enhance the RP. I've done some searching, and found nothing overly helpful on doing this and was wondering if anyone here would be able to provide support for this. If you know what to do, please make it as simple as possible as coding isn't really my strong point (e.g. Put <Code> into this folder / Lua file, and change and/or duplicate <piece of code>
Thanks in advance!
EDIT The solution to this is the following;
hook.Add( "PopulatePropMenu", "Add Two Of Each", function()local contents = {}-- Propstable.insert( contents, {type = "header",text = "Props"} )table.insert( contents, {type = "model",model = "models/props_c17/oildrum001.mdl"} )table.insert( contents, {type = "model",model = "models/props_wasteland/cargo_container01.mdl",skin = 1,wide = 128,tall = 64} )spawnmenu.AddPropCategory( "TwoOfEach", "Whitelisted Props", contents, "icon16/world_add.png" )end )
Here is a blank version of what you can copy and paste:
table.insert( contents, {type = "model",model = ""} )
The only part you need to change are "Whitelisted Props", "icon16/world_add.png" and 'model = "<prop>"'. ( A list of the icons available with gmod: http://www.famfamfam.com/lab/icons/silk/previews/index_abc.png ) To get the model path, simply right click the model in-game, click "Copy to Clipboard", then paste it in the quote marks. In /<serverip>/garrysmod/lua/autorun/client , create a file called categories_cl.lua (This is where all of the code will go) Copy and paste the code above into the document
Here's how you can blacklist every prop expect the ones you want: Go to Utilities > Falco's prop protection > Admin settings > "Blocked models options" and unblock all blocked models. This can be found under "Show blocked models" As you're adding models to your code, blacklist them in-game. Once you've blacklisted all the models you want whitelisted, go to that same place (Utilities > Falco's prop protection etc..) and then tick "The blocked models list is a whitelist" - You then have all the blacklisted models spawnable, and every other prop unspawnable.
Finally, if you do not want a header at the top of your props (In-game) then you can simply remove the following code:
table.insert( contents, {type = "header",text = "Props"} )
If you want multiple folders inside one folder (On the Q menu) such as with TDM props then just PM me, I'll explain everything for you
Anyone needing help can reply to the thread, or add me on steam / PM me on gmodstore.
Credits to Luke on helping me originally
This might help? https://wiki.garrysmod.com/page/spawnmenu/AddPropCategory
And I take it this is just to go in the lua > autorun, under what file?
Its Orange which is client i belive
I'd need to make a new file. What would the name of it be? (The only files under lua > autorun > client are gm_demo.lua and demo_recording.lua)
Pretty sure it would be <something>_cl.lua
categories_cl.lua
Not sure though
I'll give it a go, thanks.
Edited It does work! Thank you for the help Luke. I'll edit the main post to help anyone else needing it.
And for delete the default categories ?
There is no code I could find on the Garry's Mod wiki to remove the default code : to make your category top however, I'll add something at the bottom of the post tomorrow to help anyone in need out.
How do you rearrange it to the top?
Did you really have to bring this post to the top? Really man
ByZedan_Man [Apex Servers]at 23rd of May 2018 11:24:02
How do you rearrange it to the top?
why the fuck are you trying to resurrect a dead topic