[HELP] How to make commands log - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] How to make commands log (
/showthread.php?tid=107841)
[HELP] How to make commands log -
makogemata - 11.11.2009
Hello..
I want a commands log to my server
like this chat log
Код:
#include <a_samp>
//--Defines
#define ChatL "Logs/Chatlog.txt" //server floder/scriptfiles..
public OnPlayerText(playerid, text[]) //by illay
{
new name[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,text);
WriteLog(Command,string); //+ Time
return 1;
}
//--Functions
stock WriteLog(const file[],const text[]) //by Goldkiller
{
new
c[128],
time[2],
File:cFile=cFile=fopen(file, io_append);
if(!cFile) return 0;
gettime(time[0],time[1]);
format(c,sizeof©,"[%02d:%02d] %s\r\n",time[0],time[1],text);
fwrite(cFile,c);
fclose(cFile);
return 1;
}
But i will want that commands log .. Is it possible ?
I will be in
Код:
Scriptfiles - logs - Commandlog
I have there Chatlog but i want command log too.. to see what commands are used in server.
Re: [HELP] How to make commands log -
makogemata - 11.11.2009
Sorry for doublepost but anybody dont know that?
Re: [HELP] How to make commands log -
bigcomfycouch - 11.11.2009
Basically the exact same way as you log OnPlayerText
Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new name[MAX_PLAYER_NAME];
new string[128];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"%s: %s",name,cmdtext);
WriteLog(Command,string);
}
Re: [HELP] How to make commands log -
makogemata - 11.11.2009
Yea. WORKS!
Thanks