Geo Posted March 31, 2013 Share Posted March 31, 2013 If I was getting player guids like this: function GetPlayerGUID(client) local player_guid = et.Info_ValueForKey(et.trap_GetUserinfo(client), "sil_guid" ) if player_guid == "NO_GUID" or player_guid == "unknown" then return true end return player_guid end and checking if clients use a certain cmd (let's say i'm looking for people trying to access rcon for example) something like this function et_ClientCommand(clientNum, command) if et.trap_Argv(0) == "rcon" then if et.trap_Argc() == 2 then et.trap_SendServerCommand(clientNum, "print blablabla") et.G_Logprint(????) -- WHAT GOES HERE? SOMETHING TO PRINT GUID INTO LOG. PLAYER_GUID FROM ABOVE? else return end return 1 end end I want a msg to print to the client, but I want to record their silent GUID in the console log for further notice. How can I do this? ThanksCould be totally in wrong direction here but i'm just experimenting Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted March 31, 2013 Management Share Posted March 31, 2013 The rcon command is not an actual client command. If you want to log them, unfortunately, it must be done in the server engine or in the firewall. Luckily, the rcon command is sent as plain text inside the packets. I don't know what kind of options current server engine modifications can offer for this type of security. Quote Link to comment Share on other sites More sharing options...
Geo Posted March 31, 2013 Author Share Posted March 31, 2013 (edited) Ah okay thanks for the clarification. About the g_logprint, would there be a way to print the GUID of player that uses a console command (say if they did /players for a random example) to the log? Edited March 31, 2013 by Arcane Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted March 31, 2013 Management Share Posted March 31, 2013 Yes. You can intercept the "players" command with et_ClientCommand Lua hook. For example: function et_ClientCommand(clientNum, command) command = command:lower() if command == "players" then local name = et.gentity_get(clientNum, "pers.netname") local guid = et.gentity_get(clientNum, "sess.guid") local logLine = "Player "..name.." silEnT GUID "..guid.." executed command: "..command.."\n" -- log to the server log et.G_LogPrint(logLine) -- log to a separate file fd, len = et.trap_FS_FOpenFile("clientcommands.log", et.FS_APPEND) et.trap_FS_Write(logLine, string.len(logLine), fd) et.trap_FS_FCloseFile(fd) end return 0 end Quote Link to comment Share on other sites More sharing options...
Geo Posted April 1, 2013 Author Share Posted April 1, 2013 Thankyou, I managed to get my original script to work but your example is much simpler and a lot easier to understand! Much appreciated. Quote Link to comment Share on other sites More sharing options...
Geo Posted April 5, 2013 Author Share Posted April 5, 2013 There's one more question I have about this - can I add the date and time of when a client executes a command. E.G in the log 2013-04-05: 01:13:00 so I can check the log and see what time the specific command was executed. I tried to do this but I couldn't get it to work. Quote Link to comment Share on other sites More sharing options...
Management gaoesa Posted April 5, 2013 Management Share Posted April 5, 2013 Using the older example as base local timestamp = os.date("%Y-%m-%d %H:%M:%S") local logLine = timestamp.." Player "..name.." silEnT GUID "..guid.." executed command: "..command.."\n" Geo 1 Quote Link to comment Share on other sites More sharing options...
Geo Posted April 6, 2013 Author Share Posted April 6, 2013 Thanks, this worked perfectly! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.