• Questions about client side lua being ran
    45 replies, posted
I was wondering if there was a non-cheaty way of logging chat using clientside lua that the server doesn't send. I don't want to take a screenshot every time someone talks but having a log of every message is vital for some things I'm working on. I'm new to lua and I don't know if this is possible. Is it? If so, is there something I can look at or use? I'm just wondering if Gmod prevents clientside lua from being executed unless the server sends it or can verify it. Thanks, sorry if this was asked before when I searched nothing like this turned up, just spam about aimbots and wall hacks that were from 2009 or so and I'm not sure if it's relevant anymore.
[QUOTE=Codingale;45324424]I'm just wondering if Gmod prevents clientside lua from being executed unless the server sends it or can verify it.[/QUOTE] There is a setting on servers called sv_allowcslua. If the server has it set it 1, you as a client can load and run any clientside scripts you want (with the lua_openscript_cl command). If it is set to 0, you cannot use the lua_openscript_cl command, and this would usually mean you cannot run your own lua.
[QUOTE=Codingale;45324424]I was wondering if there was a non-cheaty way of logging chat using clientside lua that the server doesn't send. I don't want to take a screenshot every time someone talks but having a log of every message is vital for some things I'm working on. I'm new to lua and I don't know if this is possible. Is it? If so, is there something I can look at or use? I'm just wondering if Gmod prevents clientside lua from being executed unless the server sends it or can verify it. Thanks, sorry if this was asked before when I searched nothing like this turned up, just spam about aimbots and wall hacks that were from 2009 or so and I'm not sure if it's relevant anymore.[/QUOTE] Not sure what you mean. Do you want to hide the fact that the user is having their chat logged? Most admins mods do that blatantly so hiding it isn't going to be an issue as no one really cares if their chat is recorded.
[QUOTE=CallMePyro;45324477]Not sure what you mean. Do you want to hide the fact that the user is having their chat logged? Most admins mods do that blatantly so hiding it isn't going to be an issue as no one really cares if their chat is recorded.[/QUOTE] I mean on any server, not just one I'm an admin or coder on. [QUOTE=wh1t3rabbit;45324448]There is a setting on servers called sv_allowcslua. If the server has it set it 1, you as a client can load and run any clientside scripts you want (with the lua_openscript_cl command). If it is set to 0, you cannot use the lua_openscript_cl command, and this would usually mean you cannot run your own lua.[/QUOTE] So, does garry's mod have this on or off by default or is it per-game mode or what? Is there another way to do this?
[QUOTE=Codingale;45324488]So, does garry's mod have this on or off by default or is it per-game mode or what? Is there another way to do this?[/QUOTE] It's off by default, but the DarkRP gamemode turns it on by default (or it used to, might not anymore). If it is off there is no way around without risking getting yourself VAC banned.
[QUOTE=wh1t3rabbit;45324521]It's off by default, but the DarkRP gamemode turns it on by default (or it used to, might not anymore). If it is off there is no way around without risking getting yourself VAC banned.[/QUOTE] Is there a 3rd party app to log it or what?
[QUOTE=Codingale;45324729]Is there a 3rd party app to log it or what?[/QUOTE] Not that I know of. Now I think about it though, chat shows up in your console so depending on your usage you might just log the whole console output with [URL="https://developer.valvesoftware.com/wiki/Developer_Console"]con_log "filename"[/URL] (I haven't tested that command but I've seen it mentioned before)
[QUOTE=wh1t3rabbit;45325450]Not that I know of. Now I think about it though, chat shows up in your console so depending on your usage you might just log the whole console output with [URL="https://developer.valvesoftware.com/wiki/Developer_Console"]con_log "filename"[/URL] (I haven't tested that command but I've seen it mentioned before)[/QUOTE] I'll test that once I get a chance, Thanks a ton. Even just for the info.
You can also add "log 1" to your autoexec.cfg (I think), which will save all logs to Garrysmod\garrysmod\logs.
[QUOTE=jackwilsdon;45326293]You can also add "log 1" to your autoexec.cfg (I think), which will save all logs to Garrysmod\garrysmod\logs.[/QUOTE] [B]2017 Edit:[/B] Derp, I completely missed this in 2014 and didn't pay attention. Basically, someone mentioned something of a VAC ban for this using Lua stuff which is absurd I misread this as using startup switches to enable debug stuff and adding other things to it. In this year more or less what we could do is just Inject a DLL to log the stuff, but that's more on the side of a VAC ban than just Lua coding on the Menu state adding hooks later on. More or less this idea dropped when I realized I could use E2 to fileAppend to directories and get clientside logs that way, combine that with the fact there's a lot of servers with CS lua allowed for whatever reason I can directly hook into whatever I wanted which is much easier than E2 since it's often restricted.
[QUOTE=Codingale;45326388]I think that works for servers, not sure about anything else, I was going to ask steam and maybe Garry what they'd think about me using it for that. According to VAC they only ban if it's giving me an unfair advantage, but I don't see a reason why logging chat (or the console) would be bad unless someone spews a password out randomly or something that would be their fault. But going into that seems to cause another issue, how would I force this one file to be ran without running other, bad scripts if sent from the server and how could I prevent bad things. Mostly hypothetical but still worth looking into as I doubt anything I do wouldn't be open for issues like that.[/QUOTE] VAC only affects DLLs I believe, so using Lua to log it isn't a problem. Issue is that most servers have sv_allowcslua 0, for security reasons, so you can't run your own Lua.
[QUOTE=jackwilsdon;45326555]VAC only affects DLLs I believe, so using Lua to log it isn't a problem. Issue is that most servers have sv_allowcslua 0, for security reasons, so you can't run your own Lua.[/QUOTE] How would I run lua rather than a dll? I just need to log the chat. [QUOTE=jackwilsdon;45326293]You can also add "log 1" to your autoexec.cfg (I think), which will save all logs to Garrysmod\garrysmod\logs.[/QUOTE] Didn't work, only logs chat on a SP/listen server.
You could theoretically do this in the menu state: timer.Create("CondumpTimer", 60*5, 0, function() RunConsoleCommand("condump") end) Since you can always run lua in the menu state even if you're on a sv_allowcslua 0 server, and condump creates a console dump. This would dump your console every 5 minutes for you to look at later. You can go into garrysmod/lua/menu.lua and just paste that in there (or include another file)
[QUOTE=OzymandiasJ;45355877]You could theoretically do this in the menu state...[/QUOTE] theoretically? Would that overwrite the old files and so on? I've never used condump before so yeah
[QUOTE=Codingale;45355896]theoretically? Would that overwrite the old files and so on? I've never used condump before so yeah[/QUOTE] Condump should save like condump1 condump2 etc. I said "theoretically" because you never know what engine features actually work anymore :P
[QUOTE=OzymandiasJ;45355877]You could theoretically do this in the menu state: timer.Create("CondumpTimer", 60*5, 0, function() RunConsoleCommand("condump") end) Since you can always run lua in the menu state even if you're on a sv_allowcslua 0 server, and condump creates a console dump. This would dump your console every 5 minutes for you to look at later. You can go into garrysmod/lua/menu.lua and just paste that in there (or include another file)[/QUOTE] wot you can't run code at the menu [IMG]http://i.imgur.com/KY0LfRC.png[/IMG]
[QUOTE=AnonTakesOver;45355968]wot you can't run code at the menu [/QUOTE] He put the code inside of a Garry's Mod file, I presume that would run rather than that. I think lua_run is check by the server to make sure it's okay first. Since you're not in a game it fails this check.
[QUOTE=Codingale;45356053]He put the code inside of a Garry's Mod file, I presume that would run rather than that. I think lua_run is check by the server to make sure it's okay first. Since you're not in a game it fails this check.[/QUOTE] ... [IMG]http://i.imgur.com/mtMZYHw.png[/IMG] Also, I'm running it client aswell...
[QUOTE=AnonTakesOver;45356068].......[/QUOTE] Damn resize your images, I don't know I was simply implying that was a thing that was happening. No need to spam huge 1280x1024 images, half that should work.
[QUOTE=Codingale;45356080]Damn resize your images, I don't know I was simply implying that was a thing that was happening. No need to spam huge 1280x1024 images, half that should work.[/QUOTE] True, I don't know how to downsize without loosing quality :v:. Plus, I just used Prt Scr and paint :v:, I'll re-size my images from now on. Anyway, what happens when you log console, show us an example of what it produces? I will test console logging.
[QUOTE=AnonTakesOver;45356086]True, I don't know how to downsize without loosing quality :v:. Plus, I just used Prt Scr and paint :v:, I'll re-size my images from now on. Anyway, what happens when you log console, show us an example of what it produces? I will test console logging.[/QUOTE] Crop the images from the most important places?
[QUOTE=OzymandiasJ;45355923]Condump should save like condump1 condump2 etc. I said "theoretically" because you never know what engine features actually work anymore :P[/QUOTE] condump isn't a valid command, also using the -condebug on the games launch properties won't log chat aswell. [editline]11th July 2014[/editline] What project are you trying to do then? I'm already assuming that this isn't for your own server, cause if it was then this would be easy to do. And I'm also assuming the server your trying to do the project on has sv_allowcslua 0.
[QUOTE=AnonTakesOver;45356133]condump isn't a valid command, also using the -condebug on the games launch properties won't log chat aswell. [editline]11th July 2014[/editline] What project are you trying to do then? I'm already assuming that this isn't for your own server, cause if it was then this would be easy to do. And I'm also assuming the server your trying to do the project on has sv_allowcslua 0.[/QUOTE] Looks like condump used to be enabled, but Garry removed it for some reason.
[QUOTE=AnonTakesOver;45356133][editline]11th July 2014[/editline] What project are you trying to do then? I'm already assuming that this isn't for your own server, cause if it was then this would be easy to do. And I'm also assuming the server your trying to do the project on has sv_allowcslua 0.[/QUOTE] Logging the chat, using various addons. Like hatschat or something else. I know that hatschat saves to /data/hatscaht/lastchat.txt but it's only the last session and not all servers run with this. I've also had issues with the log being gone randomly. I went to find a chat today and it was gone.
[QUOTE=Codingale;45356178]Logging the chat, using various addons. Like hatschat or something else. I know that hatschat saves to /data/hatscaht/lastchat.txt but it's only the last session and not all servers run with this. I've also had issues with the log being gone randomly. I went to find a chat today and it was gone.[/QUOTE] Just make a program to catch all files being logged to data/hatschat/ and back it up. For other chats, no idea what you could do. You could write a program to open the console and take a screen cap every x seconds then close the console, it might get a tad annoying, but the console would only be open for a few frames. but if you need the chat in text, your best bet that I can see is to social engineer one of the owners to allow sv_allowcslua.
Lua isn't available on the menu state.
[QUOTE=code_gs;45362990]Lua isn't available on the menu state.[/QUOTE] It is, but it's mostly undocumented. However it works just fine, I even made this and put it into one of menu files: [lua] concommand.Add("lua_run_m", function(_, _, _, raw) if #raw < 1 then MsgN("Cannot run empty string!") return end RunStringEx(raw, "MenuLuaExec") end) [/lua]
[QUOTE=mijyuoon;45363576]It is, but it's mostly undocumented. However it works just fine, I even made this and put it into one of menu files: [lua] concommand.Add("lua_run_m", function(_, _, _, raw) if #raw < 1 then MsgN("Cannot run empty string!") return end RunStringEx(raw, "MenuLuaExec") end) [/lua][/QUOTE] Then I guess I should close the many requests on the Github on running lua on the menu.
There is 3 lua states Server Menu Client Menu is NOT cl hence lua_openscript_ -------->CL<------- doesnt work go to menu.lua and shove whatever you want in there and it'll work. Keep in mind limited things are available. there is RCC, a few hooks, and ETC. You can >technically< make an unblockable chat spammer with those funcs :v:
What happens if code is running in the menu and you join a server? Does it all get cancelled? [editline]12th July 2014[/editline] [QUOTE=zerothefallen;45364172]There is 3 lua states Server Menu Client Menu is NOT cl hence lua_openscript_ -------->CL<------- doesnt work go to menu.lua and shove whatever you want in there and it'll work. Keep in mind limited things are available. there is RCC, a few hooks, and ETC. You can >technically< make an unblockable chat spammer with those funcs :v:[/QUOTE] Also, I didn't know that there was a third one, I thought it was just serverside and clientside. I was wrong, sorry codingale for misinformation. You learn something new everyday
Sorry, you need to Log In to post a reply to this thread.