How to log chat - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to log chat (
/showthread.php?tid=624876)
How to log chat -
AndreiWow - 24.12.2016
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:
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;
}
}
Re: How to log chat -
Yaa - 24.12.2016
go to server.cfg
add
have fun : o