Welcome to The Forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads

Adding content to a GMOD server


pho-
 Share

Recommended Posts

Hello and welcome to my guide on how to add content to a Garry's Mod server, more specifically how to add playermodels to Zombie Survival!

To begin with you're gonna want access to a few programs, any alternatives are fine but these are just what I use:

paint.net: https://www.getpaint.net/
paint.net vtf support plugin: https://forums.getpaint.net/topic/115351-vtf-plug-in-for-paintnet-filetype/
gmoshui: https://github.com/FPtje/gmosh/releases/tag/v2.1.0alpha
gmpublish: "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\bin"  or https://garrysmods.org/download/53790/

Now let's start with a model to add; https://steamcommunity.com/sharedfiles/filedetails/?id=754962442
Make sure you have always gotten permission to add/use/or modify anything from the workshop.

Now take note of the last numbers in the workshop link, launch up gmosh and navigate to "Workshop Tools"
Take the last numbers of the link and put it into "Workshop ID", click "Get info" and your screen should match mine:

f1a180e79dbc83a173a7946476a82751.png.e77a5cc2998348dbf97a35b1dc8eda7e.png

Download it to whichever directory you want, I'll put mine in "D:\Models"

Once it's finished downloading, navigate to the folder. You will see (in this case) 3 folders, materials, models, and LUA.

Now we will compress some textures, go through the materials/models/player/pepe/ until you have reached

 3b276d93ce790597770a29f13d5aae4a.png.5e483338d4769a262637dc0265148392.png

Typically for textures this small we can upload them straight away without having to worry about compression, but for tutorials sake we will do a quick run through;
Open up eye.vtf and click 'Save As' once it opens up, click on eye.vtf and then go through the confirmation screens until you have reached a new UI. 

ff911f48431c718fe9944cc1a57cc12e.png.6b7a355c8ef989100d10ae55b79668ab.png

Change the 'Template' to "Compressed Texture" and click OK. (The file size won't change because the texture has been compressed previously by the uploader, but for any other larger model the file size will go down).
Repeat this process for the other VTF files (iris.vtf, mouth.vtf, shirt.vtf, skin.vtf). Note, other models may have other textures so the files you will need to compress will differ with each model.

Next we will create a workshop addon to host/hold the files for the server. This part is vital so everyone else can see "textures" and not floating red errors.
Create a new folder in whatever directory you want, mine will be "D:\Workshop Addon 1". Go back to where you downloaded your model files to and copy paste the materials and models folder into your new workshop directory. 

Now launch gmpu. 
Make sure the 'Mode' option is set to Create. 
We won't be using the other options for this guide but a quick run through shows that; 
'Create GMA' will compress your workshop folder into a GMA file, which is what GMOD recognises as workshop addons.
'Update' will require you to select one of your previously uploaded addons and then select whichever folder holds the files specific to that addon. 
'Extract' will require you to select a GMA file and extract, or decompress it.

Once you are on the Create option, you have a little freedom to choose the name of your addon, icon, and some descriptive terms.
In my case I will be uploading this as a Tutorial so I'll name my addon "Test" (McLovin you should name yours as "Model Content 1")

1ac07ea98bcd545b4a7a30f78e4a58ca.png.803bacfe5c83c6a403407bab1d10dd9d.png

When selecting the folder to upload, ensure it is the parent folder directly above 'materials/models'. 

20403997582e96baa0580484036ff7c8.png.1434d1b264c7eae276b0ad4c710b306b.png

These are the options I have selected for Addon.json. It doesn't really matter but it helps if people need to search for your content or come across it and don't know what it is (see my latest upload).
When selecting an icon, keep in mind it MUST be 512x512 and in jpg format.
Go down and press "Add to Queue", and then press "Execute". If it's completed then it will say Success! in the Log section. If not then double check that you have selected the correct parent directory and that
you have not left in any blanks in Addon.json.

Go to your Steam Profile and click on "Workshop Items" 
It should be the latest one uploaded on your page, mine is here https://steamcommunity.com/sharedfiles/filedetails/?id=2026306755

Grab the last digits of the URL and now launch SourceTree or whichever program you use to edit code. 
Go to your Workshop folder and copy the models folder, paste this into "addons\zsmodifications\". This will upload the model files to the server once you press commit and push. 

Now on any LUA editor, open up the following files:

\addons\zsmodifications\lua\autorun\server\sv_hg_workshop.lua
\addons\hg_base\lua\autorun\sh_playermodels.lua

In sv_hg_workshop.lua you will want to add your new Workshop Addon 
Add a new line to link your workshop collection to the server:
In this case: 

resource.AddWorkshop("Your workshop ID") -- Label


Save this file

In sh_playermodels.lua decide on if this should be a VIP/Gold or regular playermodel. I'll choose a regular playermodel.
Add a new line to link your playermodel and model hands.

RegMd( "Model Name", "Model Directory", "Model Hands" )

So for this model it would be:

RegMd( "Pepe", "models/player/burd/pepe/pepe.mdl" , SleevedCSHands )

If you don't know the directory for the model, go into the directory you downloaded the file to and open the lua folder, until you reach lua\autorun\[model name].lua (Mine was pepe_pm.lua)
and copy paste the model directory from there.

(note, sleevedcshands are just used because the model does not come with it's own hands, if it has it's own it will be provided in the LUA file.)

Commit and Push all the recent changes, launch GMOD and connect to debug. Ensure you have committed the models and two LUA file changes.
Open playermodels and check if it is there (server will require a restart or map change).
If it is, then you've successfully uploaded a model to ZS and it will be viewable by everyone else.
 

  • Like 4
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share