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
vote
2 answers

lua - garry's mod - attempt to call global 'Player' (a table value)

When trying start Garry's Mod server i get an error: [ERROR] gamemodes/darkrp/gamemode/modules/base/sv_gamemode_functions.lua:227: attempt to call global 'Player' (a table value) unknown -…
lksmnd
  • 11
  • 5
1
vote
2 answers

Gmod lua attempt to index a string value with bad key ('addMoney' is not part of the string library)

When trying to run my script i keep getting this error: [ERROR] addons/moneymanagement/lua/autorun/derma.init.lua:7: attempt to index a string value with bad key ('addMoney' is not part of the string library) 1. error - [C]:-1 2. __index -…
1
vote
1 answer

attempt to index global ' self ' (a nil value)

I ran this code and it gave me an error attempt to index global 'self' (a nil value) hook.Add( "PostDrawOpaqueRenderables","2d3d", function( ) cam.Start3D2D( Vector( self.Entity:GetPos() ), Angle(0, -90, 90), 1 ) …
MrYabloko
  • 31
  • 2
1
vote
1 answer

Can't make an entity in gmod

I'm mkaing an addon for Garry's Mod, but inorder for it to work, I must spawn an entity first, which is not working for me. I followed numerous tutorials on how to create an entity and spawn it and I can't even create it. Here is the tutorial I am…
Jamie Bowen
  • 55
  • 1
  • 8
1
vote
0 answers

how to place image on the screen of player in Garry's mod lua server

I want to create my own F4 menu for my server in Garry's Mod, and I want to set image of the background of the menu from PhotoShop, but in video lessons don't speak about it and show only how to change color of rectangle.I hope you help me local…
pinkcat
  • 327
  • 4
  • 17
1
vote
1 answer

How do i make surface.DrawTexturedRectRotated() to rotate from left?

I used surface.DrawTexturedRectRotated() to make filled circle but it rotates from center and i want to make it rotate from left. I tried to rotate it but it makes full circle when its 180 degrees function draw.FilledCircle( x, y, w, h, ang, color…
kruzgi
  • 11
  • 2
1
vote
2 answers

Can't get PlayerSay working in Gmod lua addon

I have tried making a Garry's Mod lua file to look for messages containing "/discord" at the beginning of them and save that message as a text file in the same directory, I'm not familliar to lua files so I am unsure of syntax but when I look at…
Jamie Bowen
  • 55
  • 1
  • 8
1
vote
1 answer

How to fix 'attempt to call method 'addMoney' (a nil value)' error?

I have two .lua file, one named sv_money.lua and the other economy.lua The code in sv_money.lua is : local meta = FindMetaTable("Player") local PlayersMoney = {} function meta:addMoney(amount) if not amount then return false end …
Lucas Damase
  • 83
  • 1
  • 2
  • 10
1
vote
1 answer

Garry's Mod MOTD popping up for everybody when a player joins the server

Upon following a tutorial to set up a basic lobby screen in Garry's Mod, I encountered a bug that makes the lobby screen pop up on everybody's screen every time a player joins. I'm new to programming, and I am unsure of what to even consider…
KateBear
  • 11
  • 3
1
vote
1 answer

Decode obfuscated lua

I recently downloaded some lua scripts and discovered this obfuscated code within. After a good many hours I failed to discover how to deobfuscate it and was looking for some help. In terms of what I have tried already, I noticed the number's just…
Cjinks
  • 33
  • 4
1
vote
1 answer

Lua ! not expected

The error seems to be in the first line at "!self.Replace" I always get errors when trying to use ! in lua, if someone could help that'd be great. function ENT:Think() if ( !self.Replace ) && ( self:GetrHealth() <= 0 ) then …
DdOd
  • 11
  • 1
1
vote
1 answer

GLua - Getting the difference between two tables

Disclaimer: This is Glua (Lua used by Garry's Mod) I just need to compare tables between them and return the difference, like if I was substrating them. TableOne = {thing = "bob", 89 = 1, 654654 = {"hi"}} --Around 3k items like that TableTwo =…
Hell Protection
  • 323
  • 3
  • 5
  • 11
1
vote
1 answer

I am trying to do arithmetic on table values

I was trying to do name changing that depends on sex choosing (by default it's male). But I can't do it. I have been trying to do it all day but it still doesn't work correctly. Actually it works, the sex is correctly changing from male to female…
hazed
  • 61
  • 5
1
vote
1 answer

How do I stop Garry's Mod from Printing the Death Message in Console?

I've been trying for a few days now to make a sort of mystery game with a few friends in Garry's Mod, I managed to get rid of the death notices showing up on the top right of the screen using this addon but we found out the deaths are still shown…
Sir_Snape
  • 11
  • 1
1
vote
1 answer

LUA error : attempt to call method '' (a nil value)

I have some troubles with a simple code that I've made : SWEP.PrintName = "Gestionnaire d'alarmes Administrateur" SWEP.Author = "Frass" SWEP.Instructions = "Clic Gauche : Ouvrir le gestionnaire" SWEP.Spawnable =…
Jean Pindemie
  • 11
  • 1
  • 3
1
2
3
13 14