SA-MP Forums Archive
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(playeridstring); // Use this in OnPlayerCommandText too
}
LogPlayer(playeridstr[])
{
     new 
log[200]; 
     new 
ddmmyysecminhr;
     new 
pname[MAX_PLAYER_NAME];
     
GetPlayerName(playeridpname25);
     new 
filepath[40];
     
format(filepathsizeof(filepath), "%s.log"pname);
     new 
FilefileHandle fopen(filepathio_append);
     
getdate(yymmdd);
     
gettime(hrminsec);
     
format(logsizeof(log), "[%i/%i/%i - %i:%i:%i] %s\r\n"ddmmyyhrminsecstr);
     
fwrite(fileHandlelog);
     
fclose(fileHandle);
     return 
1;