Jump to content

Getting chat logs


Duke777

Recommended Posts

  • Management

Lines that start with "say:", "sayteam:", "saybuddy:", "privmsg:", "tprivmsg:", "mprivmsg:" and "adminchat:" are player chats. Saybuddy is fireteam chats, privmsg is normal private message, tprivmsg is private message to team and mprimsg is private message sent with the private message dialog and it can have multiple recipients.

 

EDIT:

I forgot to mention, to see private messages in the log, you need to have g_tyranny enabled.

Link to comment
Share on other sites

Okay thanks, I used Notpad++ and typed  say (under the find icon which looks like binoculars)  until I found the chats amongst the omni-bot chatter.  I want to thank everyone for helping me learn the ins and outs of silent mod.

Edited by Duke777
Link to comment
Share on other sites

That's pretty much what i did with lua my self for pm logging. I log my pms via date/ip/name/name/message and i use "|" as a seperater and then just remove some stuff from the string and print it out via php.

 

Heres an example of how i have it setup.

 

http://gyazo.com/63a8518e10d3b031895fae08913aae99

 

(very basic setup atm just started working on it a few nights ago will add visuals and tables to make it look cleaner) 

Edited by Purple
Link to comment
Share on other sites

  • Management

That's pretty much what i did with lua my self for pm logging. I log my pms via date/ip/name/name/message and i use "|" as a seperater and then just remove some stuff from the string and print it out via php.

 

Heres an example of how i have it setup.

 

http://gyazo.com/63a8518e10d3b031895fae08913aae99

 

(very basic setup atm just started working on it a few nights ago will add visuals and tables to make it look cleaner) 

 

You can also submit your own version in download section so if any admin who needs it can download it and use it :) 

 

Thank you!

Link to comment
Share on other sites

Here i made something up real quick should work haven't tested it though. 

--[[
Chat logger v.1 by Purple (DRi*VJ*)
8/27/2014

	Info:
		All logs are logged in a seperate file including PM, regular chat and team chat. 
		They will be in your silent directory. If you would like to organize them put them into a folder called anything
		and change 
		
		pm_logs 	= "pm_logs.txt"
		say_logs 	= "say_logs.txt"
		say_team_logs = "say_team_logs.txt"
		
		To your directory destination 
		e.g. pm_logs = "logs/pm_logs.txt"
		
		
		Note: The file names must be the same in order for this to work.



--]]




pm_logs 	= "pm_logs.txt"
say_logs 	= "say_logs.txt"
say_team_logs = "say_team_logs.txt"
date_fmt 	= "%Y-%m-%d, %H:%M:%S"
version 	= "0.1"
temp_name = {}
c_Name = {}
temp_sguid = {}
temp_ip = {}
pm = {}
say = {}
say_team = {}

function et_InitGame(levelTime, randomSeed, restart)

    et.RegisterModname("pm_logs.lua "..version.." "..et.FindSelf())
    maxclients = tonumber(et.trap_Cvar_Get("sv_maxclients"))
	
	for i = 0, maxclients - 1 do
		pm[i] = ""
		say[i] = ""
		say_team[i] = ""
	end
	
end

function et_ClientBegin( clientNum )
	temp_name[clientNum] = et.Info_ValueForKey( et.trap_GetUserinfo( clientNum ), "name" )
	temp_sguid[clientNum] = et.Info_ValueForKey( et.trap_GetUserinfo( clientNum ), "sil_guid" )
	temp_ip[clientNum] = et.Info_ValueForKey( et.trap_GetUserinfo( clientNum ), "ip" )
	c_Name[clientNum] = et.Q_CleanStr( temp_name[clientNum] )	
end


function et_ClientCommand(clientNum, command)
	
	if command == "m" then
	
		if et.trap_Argc() > 1 then
       
        for i = 2, et.trap_Argc() - 1, 1 do
          pm[clientNum]  = pm[clientNum]  .. et.trap_Argv(i) .. " "
        end
		local sender = string.lower(et.trap_Argv(1))
		info = os.date("%x %I:%M:%S%p") .. " | IP: [" .. temp_ip[clientNum] .. "] | From: "..playerName(clientNum).." | To: " .. sender .. " | Pm: [ " .. pm[clientNum] .. "] " .."\n"
		
			fd,len = et.trap_FS_FOpenFile(pm_logs, et.FS_APPEND)
			count = et.trap_FS_Write(info, string.len(info), fd)
			et.trap_FS_FCloseFile(fd)
			fd = nil
			
			for i = 0, maxclients - 1 do
				pm[i] = ""
			end
			
		end
		
		return 0
	end
	
	if command == "say" then
	
		if et.trap_Argc() > 1 then
       
        for i = 1, et.trap_Argc() - 1, 1 do
          say[clientNum]  = say[clientNum]  .. et.trap_Argv(i) .. " "
        end
		
		info = os.date("%x %I:%M:%S%p") .. " | IP: [" .. temp_ip[clientNum] .. "] | Player: "..playerName(clientNum).." | say: [ " .. say[clientNum] .. "] " .."\n"
		
			fd,len = et.trap_FS_FOpenFile(say_logs, et.FS_APPEND)
			count = et.trap_FS_Write(info, string.len(info), fd)
			et.trap_FS_FCloseFile(fd)
			fd = nil
			
			for i = 0, maxclients - 1 do
				say[i] = ""
			end
			
		end
		
		return 0
	end
	
	if command == "say_team" then
	
		if et.trap_Argc() > 1 then
       
        for i = 1, et.trap_Argc() - 1, 1 do
          say_team[clientNum]  = say_team[clientNum]  .. et.trap_Argv(i) .. " "
        end

		info = os.date("%x %I:%M:%S%p") .. " | IP: [" .. temp_ip[clientNum] .. "] | Player: "..playerName(clientNum).." | say_team: [ " .. say_team[clientNum] .. "] " .."\n"
		
			fd,len = et.trap_FS_FOpenFile(say_team_logs, et.FS_APPEND)
			count = et.trap_FS_Write(info, string.len(info), fd)
			et.trap_FS_FCloseFile(fd)
			fd = nil
			
			for i = 0, maxclients - 1 do
				say_team[i] = ""
			end
			
		end
		
		return 0
	end
	
	
	return 0
end

function playerName(id)
  local name = et.Info_ValueForKey(et.trap_GetUserinfo(id), "name")
  if name == "" then
    return "*unknown*"
  end
  return name
end
Edited by Purple
Link to comment
Share on other sites

<?php

	$file_handle = fopen("pm_logs.txt","rb");
	
	while(!feof($file_handle)){
		$get_userinfo = fgets($file_handle);
		$userinfo = explode('|', $get_userinfo);
		
		$find[] = ']';
		$find[] = '[';
		
		$replace[] = '';
		$replace[] = '';
		
		$userinfo = str_replace($find, $replace, $userinfo);
		print $userinfo[0] . $userinfo[1] . $userinfo[2] . $userinfo[3] . $userinfo[4]. "<BR>";
	}
	fclose($file_handle);
?>

heres also the php script for the simple parsing which i showed in my screen shot earlier.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...