Why does include never seem to work for me on a dedicated server, but fine in single play? It just spits out an error saying file does not exist.
[QUOTE=fghdx;46569872]Why does include never seem to work for me on a dedicated server, but fine in single play? It just spits out an error saying file does not exist.[/QUOTE]
Make sure you're AddCSLuaFile'ing all the client files
[QUOTE=Ott;46569911]Make sure you're AddCSLuaFile'ing all the client files[/QUOTE]
That did the trick. Cheers.
Also, never test files using single-player / listen server because client is the server and server is the client meaning both realms execute on the client ( and things can be overwritten ). It isn't an accurate representation of the end-result on a real server.
Here's how to set up a local srcds: [url]https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html[/url]
Listen servers have always done the trick for me
Hi. I have a problem. I want to change weapon world model material:
[code]function SWEP:Deploy()
self.Weapon:SetMaterial(self.Mater)
end[/code]
Yeah, It works, but when I use thirdperson, I can see that:
[IMG]http://screenshot.su/img/f8/b6/f7/f8b6f75f5db979f8a016e4877e686567.jpg[/IMG]
I didn't know how remove this bug, I try use SWEP:DrawWorldModel(), but this didn't help me.
[QUOTE=UnkN;46570612]Hi. I have a problem. I want to change weapon world model material:
[code]function SWEP:Deploy()
self.Weapon:SetMaterial(self.Mater)
end[/code]
I didn't know how remove this bug, I try use SWEP:DrawWorldModel(), but this didn't help me.[/QUOTE]
If I recall correctly this is already fixed in the dev branch.
[QUOTE=Jvs;46570618]If I recall correctly this is already fixed in the dev branch.[/QUOTE]
So, no methods to remove it?
In what hook should I render rendertargets? I tried PreRender which, as the wiki describes, is called before the next frame is being rendered, but when I apply the texture it's still 1 frame behind for some reason.
[QUOTE=LEETNOOB;46571618]In what hook should I render rendertargets? I tried PreRender which, as the wiki describes, is called before the next frame is being rendered, but when I apply the texture it's still 1 frame behind for some reason.[/QUOTE]
What are you rendering to the RT?
Alright so the metastruct Dump site is still up.
Can you guys read my dump and see what might be causing this crash?
[URL="http://dumps.metastruct.uk.to/dumper.py?dump=srcds_1678491_crash_2014_11_25T22_9_26C0.mdmp"]http://dumps.metastruct.uk.to/dumper.py?dump=srcds_1678491_crash_2014_11_25T22_9_26C0.mdmp[/URL]
Ok so I am having this really weird error and I have no idea how the hell it happens. So I am working on an editor of sorts and all the data is kept in a table. When the player loads it in I save the table to a temp variable for editing purposes but for some reason when I edit the temp variable it also edits the source table. How and why does this happen, because I don't make any references to the source table in the function bedsides to apply it to the temp variable.
[QUOTE=residualgrub;46573927]:words:[/QUOTE]
[t]http://i.imgur.com/isQ4OSo.png[/t]
[t]http://i.imgur.com/Vj0XIWw.png[/t]
If I'm not understanding you correctly this'll look pretty stupid.
variables in lua are kept by reference, use [url=http://wiki.garrysmod.com/page/table/Copy]table.Copy[/url]
Well I feel like an idot. Thanks for the help guys.
[img]http://puu.sh/d5Dlh/6f136fa3bd.png[/img] - How do I fix this? Having weird issues trying to launch a server on Ubuntu 14.10, and I can't find an exact issue.
[editline]25th November 2014[/editline]
[img]http://puu.sh/d5Dlh/6f136fa3bd.png[/img] - How do I fix this? Having weird issues trying to launch a server on Ubuntu 14.10, and I can't find an exact fix.
does anyone know if the prone animations from the day of defeat source models are in gmod? I haven't been able to find them on the dods models using pac3
Hello, anyone knows how can I connect half-life 2 NPCs with garry's mod lua functions?
For example when I do this everything works fine.
[CODE]entity2:SetName("ent2");
entity2:Fire("AddOutput", "OnFoundPlayer ent2:Kill::0:1", 0); --Entity kills itself when finds player.[/CODE]
And here is format <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>.
When I'm trying to force NPC run lua function - it refuses to work.
[CODE]entity2:SetName("ent2");
entity2:Fire("AddOutput", "OnFoundPlayer ent2:RunPassedCode:SendInfo(ACTIVATOR,CALLER,TRIGGER_PLAYER):0:-1", 0); --Entity should remove itself too but with lua function, but it doesn't work.
[/CODE]
[CODE]function SendInfo(ent, cal, psa)
cal:Remove();
end;[/CODE]
Anyone knows how can I force HL2 NPCs run lua functions?
How can I alphabetically sort a table by its keys? table.sort doesn't return anything or seem to do anything
["a"] = {stuff=stuff}
You should read what table.sort does then :P
Also search on the wiki, garry added some sorting functions himself.
[QUOTE=freakyy;46579128]You should read what table.sort does then :P
Also search on the wiki, garry added some sorting functions himself.[/QUOTE]
SortByKey doesn't work with table values, I did find this on google though
[code]
a = {}
for n in pairs(HD.FormatTypes) do table.insert(a, n) end
table.sort(a)
for i,n in ipairs(a) do
HD.ShapeOptions[id].Format:AddChoice(n)
end
[/code]
[QUOTE=EnnX49;46577930]Hello, anyone knows how can I connect half-life 2 NPCs with garry's mod lua functions?
For example when I do this everything works fine.
[CODE]entity2:SetName("ent2");
entity2:Fire("AddOutput", "OnFoundPlayer ent2:Kill::0:1", 0); --Entity kills itself when finds player.[/CODE]
And here is format <output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>.
When I'm trying to force NPC run lua function - it refuses to work.
[CODE]entity2:SetName("ent2");
entity2:Fire("AddOutput", "OnFoundPlayer ent2:RunPassedCode:SendInfo(ACTIVATOR,CALLER,TRIGGER_PLAYER):0:-1", 0); --Entity should remove itself too but with lua function, but it doesn't work.
[/CODE]
[CODE]function SendInfo(ent, cal, psa)
cal:Remove();
end;[/CODE]
Anyone knows how can I force HL2 NPCs run lua functions?[/QUOTE]
There's no built-in way to do this without creating another entity first.
Put this in lua/autorun/info_output_hook.lua
[code]DEFINE_BASECLASS( "base_point" )
ENT.Hooks = { }
local this, meta, hooks, fmt
hooks = { }
meta = FindMetaTable( "Entity" )
fmt = "%s __this,%s"
function meta:HookOutput( name, uid, func )
if not IsValid( this ) then
this = ents.Create( "info_output_hook" )
this:SetName( "__this" )
this:Spawn( )
end
hooks[ self ] = hooks[ ent ] or { }
hooks[ self ][ name ] = hooks[ self ][ name ] or { }
hooks[ self ][ name ][ uid ] = func
self:Fire( "AddOutput", fmt:format( name, name ), 0 )
end
function meta:UnhookOutput( name, uid )
if not IsValid( this ) then
this = ents.Create( "info_output_hook" )
this:SetName( "__this" )
this:Spawn( )
end
hooks[ self ] = hooks[ ent ] or { }
hooks[ self ][ name ] = hooks[ self ][ name ] or { }
hooks[ self ][ name ][ uid ] = nil
end
function ENT:Initialize( )
hook.Add( "EntityRemoved", self, self.EntityRemoved )
end
function ENT:AcceptInput( name, activator, caller, data )
local k, v, ok, err
if hooks[ caller ] then
if hooks[ caller ][ name ] then
for k, v in pairs( hooks[ caller ][ name ] ) do
if IsValid( k ) then
ok, err = pcall( v, k, caller, activator, data )
else
ok, err = pcall( v, caller, activator, data )
end
if not ok then
ErrorNoHalt( "Moonhook failed: " .. name .. "::" .. k .. " - " .. err .. "\n" )
end
end
end
end
return true
end
function ENT:EntityRemoved( e )
if not IsValid( self ) then
this = ents.Create( "info_output_hook" )
this:SetName( "__this" )
this:Spawn( )
hook.Add( "EntityRemoved", this, this.EntityRemoved )
end
end[/code]
And then do this:
[code]entity2:HookOutput( "OnFoundPlayer", entity2, function( this, caller, activator, data ) this:Kill( ) end )[/code]
[url=http://www.facepunch.com/threads/newreply.php?p=24291360&noquote=1]Garry said he was going to "look into it" four years ago.[/url]
Thank you a lot Kogitsune!
Not sure what this lua error means, I get it on the line where I try to file.Read a document because I need the JSON that it has.
[code]
-- Error
[ERROR] addons/exho hud designer/lua/autorun/cl_util.lua:165: bad key to string index (number expected, got string)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:274
3. Load - addons/exho hud designer/lua/autorun/cl_util.lua:165
4. DoClick - addons/exho hud designer/lua/autorun/cl_assorted.lua:737
5. unknown - lua/vgui/dlabel.lua:206
[Exho|3|STEAM_0:0:53332328] Lua Error:
[ERROR] addons/exho hud designer/lua/autorun/cl_util.lua:165: bad key to string index (number expected, got string)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:274
3. Load - addons/exho hud designer/lua/autorun/cl_util.lua:165
4. DoClick - addons/exho hud designer/lua/autorun/cl_assorted.lua:737
5. unknown - lua/vgui/dlabel.lua:206
-- Derma code
SavePanels[i].DoClick = function()
HD.Load( Saves[i] ) --"save_testproject1_104953.txt"
end
-- Load function code
local found = file.Read( "hud_designer/"..file, DATA ) -- "save_testproject1_104953.txt"
local table = util.JSONToTable( found )
[/code]
[editline]26th November 2014[/editline]
Not sure what this lua error means, I get it on the line where I try to file.Read a document because I need the JSON that it has.
[code]
-- Error
[ERROR] addons/exho hud designer/lua/autorun/cl_util.lua:165: bad key to string index (number expected, got string)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:274
3. Load - addons/exho hud designer/lua/autorun/cl_util.lua:165
4. DoClick - addons/exho hud designer/lua/autorun/cl_assorted.lua:737
5. unknown - lua/vgui/dlabel.lua:206
[Exho|3|STEAM_0:0:53332328] Lua Error:
[ERROR] addons/exho hud designer/lua/autorun/cl_util.lua:165: bad key to string index (number expected, got string)
1. error - [C]:-1
2. __index - lua/includes/extensions/string.lua:274
3. Load - addons/exho hud designer/lua/autorun/cl_util.lua:165
4. DoClick - addons/exho hud designer/lua/autorun/cl_assorted.lua:737
5. unknown - lua/vgui/dlabel.lua:206
-- Derma code
SavePanels[i].DoClick = function()
HD.Load( Saves[i] ) --"save_testproject1_104953.txt"
end
-- Load function code
local found = file.Read( "hud_designer/"..file, DATA ) -- "save_testproject1_104953.txt"
local table = util.JSONToTable( found )
[/code]
It means you are trying to index a string with a non numerical key that doesn't exist in the string library.
-snip, too informative-
[QUOTE=Exho;46579522]
[code]
local table = util.JSONToTable( found )
[/code]
[/QUOTE]
Also be careful.
[IMG]http://i.imgur.com/43oX2mG.png[/IMG]
[QUOTE=bran92don;46577465]does anyone know if the prone animations from the day of defeat source models are in gmod? I haven't been able to find them on the dods models using pac3[/QUOTE]
GMOD Prone Back 2014 in Nutscript.: [url]http://youtu.be/WfhtkY-wQ7g[/url]
[QUOTE=Willox;46579748]It means you are trying to index a string with a non numerical key that doesn't exist in the string library.[/QUOTE]
The string is "save_testproject1_104953.txt" and it gets passed through my function without a problem. The issue seems to be my file.Read based on the lua error but I cannot figure out whats wrong with it.
I've written it like this (without concatenating a variable) and still gotten the same error...
[code]
-- This gives me errors
local txt = file.Read( "hud_designer/save_testproject1_104953.txt", "DATA" )
[/code]
I dont know why it isn't working right here when it does everywhere else and I don't even understand how the Lua error plays into this (bad key to string index (number expected, got string)).
[QUOTE=Exho;46580656]The string is "save_testproject1_104953.txt" and it gets passed through my function without a problem. The issue seems to be my file.Read based on the lua error but I cannot figure out whats wrong with it.
I've written it like this (without concatenating a variable) and still gotten the same error...
[code]
-- This gives me errors
local txt = file.Read( "hud_designer/save_testproject1_104953.txt", "DATA" )
[/code]
I dont know why it isn't working right here when it does everywhere else and I don't even understand the Lua error (bad key to string index (number expected, got string)).[/QUOTE]
It means you're attempting to [b]index[/b] a string on that line.
Sorry, you need to Log In to post a reply to this thread.