How to log chat
#1

How can I log the normal chat? Here is what I use for ban log

Код:
function BanLog(string[])
{
	new
		entry[ 128 ],
		year,
		month,
		day,
		hour,
		minute,
		second
	;
	getdate(year, month, day);
	gettime(hour, minute, second);

	format(entry, sizeof(entry), "%s | (%d-%d-%d) (%d:%d:%d)\n",string, day, month, year, hour, minute, second);
	new File:hFile;
	hFile = fopen("Basic/logs/BanLog.log", io_append);
	fwrite(hFile, entry);
	fclose(hFile);
}
And I use this at any thing I want to log in there:
Код:
BanLog(string);
but idk how to log normal chat xD when player talks in game, how can I create a string for what a player say so I can save it in a log?



SOLVED, SORRY

How I did it was:
Код:
if(IsPlayerConnected(playerid))
	{
		if(realchat)
		{
			if(PlayerInfo[playerid][pAccent] == 0)
			{
				format(string, sizeof(string), "%s says: %s", RPName(playerid), text);
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				ChatLog(string);
				
			}
			else
			{
				new
					accent[20]
				;
				switch(PlayerInfo[playerid][pAccent])
				{
					case 1: accent = "Russian";
					case 2: accent = "Italian";
					case 3: accent = "Germany";
					case 4: accent = "Japanese";
					case 5: accent = "French";
					case 6: accent = "Spain";
					case 7: accent = "China";
					case 8: accent = "British";
				}
				format(string, sizeof(string), "%s says: [%s Accent] %s", RPName(playerid), accent, text);
				ProxDetector(20.0, playerid, string,COLOR_FADE1,COLOR_FADE2,COLOR_FADE3,COLOR_FADE4,COLOR_FADE5);
				ChatLog(string);
			}
			return 0;
		}
	}
Reply
#2

go to server.cfg

add
PHP код:
chatlogging 1 
have fun : o
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)