• What do you need help with? V3
    6,419 replies, posted
I try to include and I get this error: [code] global_items.LoadAll()... Couldn't include file '\items\item_test.lua.lua' (File not found) (@gamemodes/gflight/gamemode/sh_items.lua (line 6)) [/code] here's what I have so far; [lua] function global_items.LoadAll() local files, dir = file.Find(GAMEMODE.Folder.."/gamemode/items/*.lua","GAME") for k,v in pairs(files) do include("/items/"..v) AddCSLuaFile("/items/"..v) end end [/lua]
'Warning Player X unhandled shitload of usermessages', it happens after a while the server has quite some people and starts lagging like hell, what am I doing wrong? I don't seem to not close any usermessage.
Trying to create different money printers for a DarkRP. Copied the same default money printer, changed the print amount value and the name, and now there is a MAX Printer glitch. you can only have 1 printer max, when i destroy it, it says i've reached the limit. the default printer still works. Is anyone familiar with the glitch?
[QUOTE=Persious;38820061]I'm thinking about making a new version of my wanted addon (I suppose you use my former one).[/QUOTE] It would be nice, it really is a beautiful idea.
I cant seem to get my code to spawn entities automatically working correctly. For some reason, it spawns all the entities twice in the same spot. Any ideas? [URL="http://pastebin.com/n3SWuakr"]sv_entstartup.lua[/URL] [URL="http://pastebin.com/yk61SX8s"]Map file[/URL]
How would you resize a player now that SetModelScale no longer works? I read you can resize ents with EnableMatrix but if you try to do something like this... pl:EnableMatrix("RenderMultiple", mat) it won't work because EnableMatrix is nil when called from player.
Is there any way I can find the material a model/entity is using? (not override material) I'm completely stumped here. I am using a model from the team fortress materials.gcf, however the material that SHOULD be in materials/models/...etc. (in the gcf) just isn't there, however the material still shows up in game! When I remove the gcf archive, after manually extracting the model, the material doesn't show up in game (purple/black checkers) I'm so confused, the material doesn't appear to be in the gcf, but it still works in game when the gcf is present. Trouble is, I want to extract this material but I can't find it. Does TF2 do some kind of material magic? Thanks for any help
I need a way to block every hudpaint type hook except one; mine. Is this possible?
Any idea if [URL="http://wiki.garrysmod.com/page/Libraries/http/Post"]http.Post[/URL] is working correctly? I only ever seem to be getting NULL in return no matter what I do. [editline]15th December 2012[/editline] Turns out you need a trailing slash at the end of the URL (assuming you don't specify the target url directly)!
[QUOTE=Trumple;38836284]Is there any way I can find the material a model/entity is using? (not override material) I'm completely stumped here. I am using a model from the team fortress materials.gcf, however the material that SHOULD be in materials/models/...etc. (in the gcf) just isn't there, however the material still shows up in game! When I remove the gcf archive, after manually extracting the model, the material doesn't show up in game (purple/black checkers) I'm so confused, the material doesn't appear to be in the gcf, but it still works in game when the gcf is present. Trouble is, I want to extract this material but I can't find it. Does TF2 do some kind of material magic? Thanks for any help[/QUOTE] Entity:GetTextures()?
Hi. Is there any documentation about "MatType"? Because the old identifiers like "MAT_METAL" or "MAT_TILE" don't seem to work anymore (or I'm just using them wrong). While debugging I've found out that MatType returns numbers, which stand for materials. "MAT_TILE" equals the number "84", and so on. Is there maybe a list about this?
[QUOTE=itkuitkzhji;38839182]Hi. Is there any documentation about "MatType"? Because the old identifiers like "MAT_METAL" or "MAT_TILE" don't seem to work anymore (or I'm just using them wrong). While debugging I've found out that MatType returns numbers, which stand for materials. "MAT_TILE" equals the number "84", and so on. Is there maybe a list about this?[/QUOTE] Those are called [url=http://wiki.garrysmod.com/page/Enums/MAT]enumerations.[/url]
How do I make a console command in init.lua that changes the value of a local variable in cl_init.lua? (I am a beginner LUA coder, so sorry if this is a n00b question)
[QUOTE=Par3210;38839825]How do I make a console command in init.lua that changes the value of a local variable in cl_init.lua? (I am a beginner LUA coder, so sorry if this is a n00b question)[/QUOTE] You'll need to send something to the client (with the net library) to tell the client to change the value. (That means you also have to do something in cl_init.lua)
I gathered that myself, but what in particular do I have to send? I've been puzzling over this for an hour at least now..
I'm confused by this: [CODE]if CLIENT then -- LocalPlayer.somefunction = function(text) end pokemoncaught = {"Empty", "Empty", "Empty", "Empty", "Empty", "Empty"} function PBalls(Panel) Panel:ClearControls() button = vgui.Create("DButton") button:SetParent(Panel) button:SetPos(25, 50) button:SetText(pokemoncaught[1]) button:SetSize( 100, 30) if pokemoncaught[1] ~= "Empty" then button.DoClick = function() net.Start("give_monster") print("what!?") buttons = 1 net.SendToServer() end else button.DoClick = function() net.Start("pokeball_give") buttons = 1 net.WriteString(buttons) net.WriteString(pokemoncaught[buttons]) net.SendToServer(buttons) net.SendToServer(pokemoncaught[1]) print(pokemoncaught[1]) end end end[/CODE] This isn't even sending the value, because I get this error: [ERROR] ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:78: attempt to index global 'pokemoncaught' (a nil value) 1. unknown - ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:78 2. Give - [C]:-1 3. func - ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:3 4. unknown - lua/includes/modules/net.lua:31 Because I want to print what's in that index on pickup of the SWEP. This is the autorun file, by the way. It's only the table is nil when I send it.
[QUOTE=Turtle95;38840794]I'm confused by this: [CODE]if CLIENT then -- LocalPlayer.somefunction = function(text) end pokemoncaught = {"Empty", "Empty", "Empty", "Empty", "Empty", "Empty"} function PBalls(Panel) Panel:ClearControls() button = vgui.Create("DButton") button:SetParent(Panel) button:SetPos(25, 50) button:SetText(pokemoncaught[1]) button:SetSize( 100, 30) if pokemoncaught[1] ~= "Empty" then button.DoClick = function() net.Start("give_monster") print("what!?") buttons = 1 net.SendToServer() end else button.DoClick = function() net.Start("pokeball_give") buttons = 1 net.WriteString(buttons) net.WriteString(pokemoncaught[buttons]) net.SendToServer(buttons) net.SendToServer(pokemoncaught[1]) print(pokemoncaught[1]) end end end[/CODE] This isn't even sending the value, because I get this error: [ERROR] ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:78: attempt to index global 'pokemoncaught' (a nil value) 1. unknown - ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:78 2. Give - [C]:-1 3. func - ...ddog's pokeballs/lua/weapons/pokeball_capture/shared.lua:3 4. unknown - lua/includes/modules/net.lua:31 Because I want to print what's in that index on pickup of the SWEP. This is the autorun file, by the way. It's only the table is nil when I send it.[/QUOTE] -snip-
[QUOTE=NinjaS;38841555]net.WriteString(pokemoncaught[buttons]) the index is nil Guessing here since you didn't post the full code and error line pokemoncaught = {['buttons'] = "value"} would be pokemoncaught['buttons'] or pokemoncaught.buttons[/QUOTE] Well I need to store what I caught here: [CODE]function ENT:StartTouch( ent ) if self.Entity:GetNWBool("HasHitNpc") then return false end if ent:Health() == 0 then local pball2 = "pokeball_capture" local ent2 = ents.Create(pball2) --set spawn ent2:SetPos(self:GetPos()) ent2:Spawn() self:Remove() return false end if not self.Entity:GetNWBool("HasHitNpc") and ent:IsNPC() and IsValid(ent) then self.Entity:SetNWBool("HasHitNpc", true) self.Entity:EmitSound(Sound("Pokeballs/capture.wav")) local pball = "pokeball_base" local ent1 = ents.Create(pball) ent1.spawn = ent:GetClass() ent1:SetPos(self:GetPos()) ent1:Spawn() if self.type == "pack" then table.insert(pokemoncaught, buttons, ent:GetClass()) end self:Remove() elseif not self.Entity:GetNWBool("HasHitNpc") then local pball2 = "pokeball_capture" local ent2 = ents.Create(pball2) --set spawn ent2:SetPos(self:GetPos()) ent2:Spawn() end if ent:IsNPC() and ent:IsValid() then self.ent = ent self:DoColorstuff(ent) end end[/CODE] then write it to the client on picking up the "pokeball_base"
[QUOTE=Turtle95;38841581]Well I need to store what I caught here: [CODE]function ENT:StartTouch( ent ) if self.Entity:GetNWBool("HasHitNpc") then return false end if ent:Health() == 0 then local pball2 = "pokeball_capture" local ent2 = ents.Create(pball2) --set spawn ent2:SetPos(self:GetPos()) ent2:Spawn() self:Remove() return false end if not self.Entity:GetNWBool("HasHitNpc") and ent:IsNPC() and IsValid(ent) then self.Entity:SetNWBool("HasHitNpc", true) self.Entity:EmitSound(Sound("Pokeballs/capture.wav")) local pball = "pokeball_base" local ent1 = ents.Create(pball) ent1.spawn = ent:GetClass() ent1:SetPos(self:GetPos()) ent1:Spawn() if self.type == "pack" then table.insert(pokemoncaught, buttons, ent:GetClass()) end self:Remove() elseif not self.Entity:GetNWBool("HasHitNpc") then local pball2 = "pokeball_capture" local ent2 = ents.Create(pball2) --set spawn ent2:SetPos(self:GetPos()) ent2:Spawn() end if ent:IsNPC() and ent:IsValid() then self.ent = ent self:DoColorstuff(ent) end end[/CODE] then write it to the client on picking up the "pokeball_base"[/QUOTE] May you use [lua ] [/ lua] tags that type of [code ] [/ code] tags gives me an headache and I didn't see Buttons = 1
So I am using[CODE] ents.GetByIndex("12")) [/CODE] to find a hammer entity in the map but I cannot figure out the code to check to see if the entity say a func_button has had its KeyValue toggle set to true or not. Say if I click a button that toggles 1 but doesn't reset, how could I get the script to check if it is toggled or not? (ent:GetKeyValues().spawnflags) Any help would be greatly appreciated. Thanks.
[QUOTE=NinjaS;38841639]May you use [lua ] [/ lua] tags that type of [code ] [/ code] tags gives me an headache and I didn't see Buttons = 1[/QUOTE] Well, I'll try setting net.ReadString(buttons) and see what happens. But it expects a table and gets nil for pokemoncaught.
[QUOTE=Turtle95;38841690]Well, I'll try setting net.ReadString(buttons) and see what happens.[/QUOTE] You haven't set pokemoncaught global for server or client at the top of the file, that's the only way I can think of it erroring, since all I can see is you've put it global for the client and not server. I've done a test my self reads it fine, and Notepad++ GLUA editor saved my life use [lua ] [/ lua] tags please next time. How are you saving it server side and reading cause this looks like an single player script lol
[QUOTE=NinjaS;38841711]You haven't set pokemoncaught global for server or client at the top of the file, that's the only way I can think of it erroring, since all I can see is you've put it global for the client and not server. I've done a test my self reads it fine, and Notepad++ GLUA editor saved my life use [lua ] [/ lua] tags please next time. How are you saving it server side and reading cause this looks like an single player script lol[/QUOTE] In my autorun: [lua]pokemoncaught = {"Empty", "Empty", "Empty", "Empty", "Empty", "Empty"} function PBalls(Panel) Panel:ClearControls() button = vgui.Create("DButton") button:SetParent(Panel) button:SetPos(25, 50) button:SetText(pokemoncaught[1]) button:SetSize( 100, 30) button.DoClick = function() net.Start("pokeball_give") buttons = 1 net.WriteString(buttons) net.WriteType(pokemoncaught) net.SendToServer(buttons) net.SendToServer(pokemoncaught) print(pokemoncaught[1]) end end [/lua] I do net.WriteType(pokemoncaught) and then net.SendToServer(pokemoncaught)
[QUOTE=Turtle95;38841777]In my autorun: [lua]pokemoncaught = {"Empty", "Empty", "Empty", "Empty", "Empty", "Empty"} function PBalls(Panel) Panel:ClearControls() button = vgui.Create("DButton") button:SetParent(Panel) button:SetPos(25, 50) button:SetText(pokemoncaught[1]) button:SetSize( 100, 30) button.DoClick = function() net.Start("pokeball_give") buttons = 1 net.WriteString(buttons) net.WriteType(pokemoncaught) net.SendToServer(buttons) net.SendToServer(pokemoncaught) print(pokemoncaught[1]) end end [/lua] I do net.WriteType(pokemoncaught) and then net.SendToServer(pokemoncaught)[/QUOTE] I don't know how net.String works but you can use concommand.Add and send it that way, it just delays, also debug your project please it'll help to find what is nil and that. [lua] pokemoncaught = {} concommand.Add("_TestCatch", function(p,c,a) table.insert(pokemoncaught, a[1], a[2]) print("Catched",a[1],a[2]) end) Catched 1 pie ] lua_run PrintTable(pokemoncaught) > PrintTable(pokemoncaught)... 1 = pie -- Clientside RunConsoleCommand("_testcatch",1,"pie") // cmd number string[/lua] Much easier then what you're doing
Quick question; is there any hook I can use to detect changes to a convar, or do I need to poll it instead? The convar is lua-defined (from a tool), if that changes anything.
[QUOTE=Splambob;38842660]Quick question; is there any hook I can use to detect changes to a convar, or do I need to poll it instead? The convar is lua-defined (from a tool), if that changes anything.[/QUOTE] [url]http://wiki.garrysmod.com/page/Libraries/cvars/AddChangeCallback[/url]
[QUOTE=NinjaS;38841810]I don't know how net.String works but you can use concommand.Add and send it that way, it just delays, also debug your project please it'll help to find what is nil and that. [lua] pokemoncaught = {} concommand.Add("_TestCatch", function(p,c,a) table.insert(pokemoncaught, a[1], a[2]) print("Catched",a[1],a[2]) end) Catched 1 pie ] lua_run PrintTable(pokemoncaught) > PrintTable(pokemoncaught)... 1 = pie -- Clientside RunConsoleCommand("_testcatch",1,"pie") // cmd number string[/lua] Much easier then what you're doing[/QUOTE] Ok, I'll take a look at it. Although I'm not sure where to put the top part (server?) and it all goes into my autorun lua file?
[QUOTE=Drakehawke;38842766][url]http://wiki.garrysmod.com/page/Libraries/cvars/AddChangeCallback[/url][/QUOTE] Huh, and there was me looking at the gamemode hooks. This makes more sense, cheers!
[QUOTE=Turtle95;38842793]Ok, I'll take a look at it. Although I'm not sure where to put the top part (server?) and it all goes into my autorun lua file?[/QUOTE] Top part server, bottom RunConsoleClient is client
How can I change the voice chat indicator's color based on teams? Currently the default looks like this when somebody is talking [img]http://puu.sh/1Bl0P[/img]
Sorry, you need to Log In to post a reply to this thread.