Open the addon folder
Create garrysmod/addons/welcome yourself first, then choose that folder as the working folder.
A !hello chat command on your own server is the smallest useful addon. It is plain GMod Lua scripting in 1 server-side file, and it shows how to make a GMod addon from an empty folder to a tested result. The agent writes it. You review it.
Create garrysmod/addons/welcome yourself first, then choose that folder as the working folder.
Write what the addon should do in plain words, for example answer the !hello chat command with the player's name.
Work in Ask first. Read the file card and the diff for sv_welcome.lua, then press Accept or Reject.
Start a multiplayer game on a local test server, join it, type the command in chat and read the console for Lua errors before you call it done.
lua/autorun/servercreatedlua/autorun/server/sv_welcome.luasavedlua/autorun/server/sv_welcome.lua12 linesPlayerSay1 matchyour server launch scriptexit 0-- sv_welcome.lua: answer the !hello chat command
-- Runs on the server only (lua/autorun/server/).
local command = "!hello"
hook.Add("PlayerSay", "Welcome_Hello", function(ply, text)
if string.lower(text) == command then
local name = ply:Nick()
ply:ChatPrint(string.format("Hello, %s!", name))
return ""
end
end)Server-side only. hook.Add attaches a function to PlayerSay, string.lower makes the match ignore capital letters, ChatPrint shows the greeting to that player, and the empty string hides the typed command from chat.
Next, add a scripted weapon. Weapons live in lua/weapons/, so ask the agent to create one file there and to explain every field it sets. A manual artillery and mortar mod, for example, could be a scripted weapon or a scripted entity, and you describe its behaviour in plain words. The agent uses write_file for the new file, grep to show where the class name appears and Shell for your test command. Plan only mode lists every file before anything is saved. Then spawn it on gm_flatgrass and read the console for errors.
Players download your addon from the server, not from your PC. A quick way to spare them a manual install of all your mods is a Workshop collection, or resource.AddWorkshop lines in a server Lua file. Your own addon must be published on the Workshop first, because resource.AddWorkshop takes the ID of a published item. Publish only permitted content. Ask the agent to add the lines with edit_file and review the diff. If Workshop addons are not downloading for a player on your GMod test server, grep for resource.AddWorkshop first. Then restart the server and join as a player to see the download.