Different log per each player - 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: Different log per each player (
/showthread.php?tid=438132)
Different log per each player -
Face9000 - 18.05.2013
Hello, i know this would sound impossible but i need to know if there is a way to create a single file log for every single player and every single action they do.
Something like:
[CHAT]LoggedPlayer: hi
[PM]LoggedPlayer:
And so on.
Is possible?
Re: Different log per each player -
Dragony92 - 18.05.2013
Join Date: Jan 2010
Posts: 2,859
Reputation: 180
Scripting for $$ - Pm me for more info.
And you are asking is that posible? Of course it is, and it's very easy, just think about it a little......
Re: Different log per each player -
Richie© - 18.05.2013
Create stock LogPlayerAction or something, name the file after the playername and write your logs.
Re: Different log per each player -
Face9000 - 18.05.2013
Quote:
Originally Posted by Richie©
Create stock LogPlayerAction or something, name the file after the playername and write your logs.
|
I'll try.
Quote:
Originally Posted by Dragony92
Join Date: Jan 2010
Posts: 2,859
Reputation: 180
Scripting for $$ - Pm me for more info.
And you are asking is that posible? Of course it is, and it's very easy, just think about it a little......
|
I know it's very easy because i tried and i wanna know if there are different ways then mine.
Re: Different log per each player -
DaRk_RaiN - 18.05.2013
Yes you can, but it will consume alot of space.
OnPlayerText should take care of the PMs and chat, and you could get the executed commands via OnPlayerCommandReceived.
After that comes the saving part.
AW: Re: Different log per each player -
HurtLocker - 18.05.2013
Quote:
Originally Posted by Face9000
Hello, i know this would sound impossible but i need to know if there is a way to create a single file log for every single player and every single action they do.
Is possible?
|
Quote:
Originally Posted by Face9000
I know it's very easy because i tried and i wanna know if there are different ways then mine.
|
? Lol
Re: Different log per each player -
SupremeCommander - 18.05.2013
Like this perhaps?
PHP код:
OnPlayerText()
{
LogPlayer(playerid, string); // Use this in OnPlayerCommandText too
}
LogPlayer(playerid, str[])
{
new log[200];
new dd, mm, yy, sec, min, hr;
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, 25);
new filepath[40];
format(filepath, sizeof(filepath), "%s.log", pname);
new File: fileHandle = fopen(filepath, io_append);
getdate(yy, mm, dd);
gettime(hr, min, sec);
format(log, sizeof(log), "[%i/%i/%i - %i:%i:%i] %s\r\n", dd, mm, yy, hr, min, sec, str);
fwrite(fileHandle, log);
fclose(fileHandle);
return 1;
}