Questions tagged [garrys-mod]

Garry's Mod is a sandbox game based around player created content. Only post questions relating to game modding. For questions relating to game play, see gaming.stackexchange.com.

Garry's Mod is a sandbox game that allows users to use the Lua scripting language to create custom addons, such as weapons, NPCs, etc.

Questions tagged with relate to creating addons for Garry's Mod using Lua.

198 questions
-1
votes
1 answer

(gLua) Derma not working. attempt to call method 'Close' (a nil value)

Error at function ContextClose() And all derma menu not working attempt to call method 'Close' (a nil value) I've create derma menu and it worked in garrysmod\lua folder, then I moved flies to addon floder and it stopped…
notClown
  • 1
  • 1
-1
votes
1 answer

Garry'sMod Detecting if there's a wall between two players

I was wondering about how to detect if there's a wall between two players. Does a command to do it exists or any code snippet?
Lario
  • 5
  • 3
-1
votes
1 answer

Trouble with Derma Button draw with function

I have some trouble with Derma SpawnIcon. When i draw 1 SpawnIcon with function it work okay, but when i try to use the same function and draw second SpawnIcon DoClick function work only for last SpawnIcon. I dont have any idea why that happens, and…
DeloreanZ
  • 13
  • 2
-1
votes
1 answer

Table[1] returning nil when table does exist and has values

local mapSpawnsData = {} local JSONData = file.Read(filePath) -- read file as json text mapSpawnsData = util.JSONToTable(JSONData) -- convert JSON to…
Infideon
  • 11
  • 2
-1
votes
1 answer

How to get over the 32 bits for storing numbers like - 2,147,483,647 to 2,147,483,647

I try to fix some old Basewars script for Gmod amd there is something i tried to fix but i dont know what i am missing there. Basicly its about a Bank script. This Bank could original store a amount of 2 Billion $. I would like to expand that…
Akina
  • 1
-1
votes
1 answer

team checking weapon dealer garry's mod darkrp gamemode

I want to make a npc system if some players in this job "weapon dealer" npc can't be used i tried this but didn't work i put this code on lua/entities/npc/init.lua if pl:Team() = TEAM_DEALER > 0 then chat.AddText(Color(255, 0, 0), "Someone is…
mjos
  • 1
  • 1
-1
votes
1 answer

GMOD LUA: Restricting wire support to job

If you're reading this right now, I expect you to know something about how lua and Gmod works together. I'm recoding a fading door addon with wire support, on a DarkRP Gmod server. I'm having problems with restricting the wire support to a specific…
Lukas Knudsen
  • 197
  • 2
  • 3
  • 14
-1
votes
1 answer

Shorten useless coding?

Creating my loading screen on garrys mod, and seeing this "useless" coding, and was betting that there is a way to shorten it massively, however I am quite a php nooby and was wondering if there was a perhaps a way to use arrays or something to make…
Tomzen
  • 55
  • 1
  • 4
-1
votes
1 answer

Lua - How to return a value from mysql callback function?

I have been trying for a month to try and return a value from a callback function using this module. I am overwriting the default GetPData function which retrieves the data from a local sql database, but I wanted to retrieve it from a MySQL database…
-2
votes
1 answer

How does this bit of code work? Someone said this is a solution

frame.buttons = {} frame.AddButton = function() frame.buttons[#frame.buttons + 1] = frame:Add("DButton") local button = frame.Buttons[#frame.buttons] end I know it's simple, but it's the only part so far that I do not understand. How do…
TheMimic
  • 11
  • 2
-2
votes
1 answer

What does fn.id mean

I have looked through DarkRP code to learn to create my own addons and game modes. I am trying to understand all that is happening and I have seen fn.id many times and fail to understand what it means. Anyone who can point me in the right direction…
Dyerrrr
  • 3
  • 2
-2
votes
2 answers

Creating a Gmod Lua Timer

I was wondering how to create a timer in lua that works also in servers with no players on. Timer.Simple or Timer.Create don't work, they need CurTime(). How could I do it?
Lario
  • 5
  • 3
-2
votes
1 answer

How would I start Garry's Mod and connected to an address on launch?

I'm currently in the middle of making a game launcher for my Garry's Mod server. Right now, when you press Launch all it does is start Garry's Mod with Process.Start("GarrysMod.exe"). Is it possible for me to start Garrys Mod with launch arguments…
-2
votes
1 answer

Lua referencing a HTML file

So I'm helping my friend with his server, and he wants a simple message of the day. I have made local html files for it This is the directory This is the LUA code I tried to reference the local files but it doesn't show
-2
votes
1 answer

Using "\n" in Garry's Mod draw.DrawText

I want to make an admin-online list. I have the v:Nick() part down but I want to place a new line after it. Example: (At the top right corner, the names are INSIDE OF EACH OTHER.)
Zormonic
  • 7
  • 2
1 2 3
13
14