Upon typing a command, a log is made.
#1

Hi there. Could someone help me with a simple log system? For example, if a command is typed, it saves in a specific folder, as a .txt, and for example: [name] [command] [variables] <- could anyone help me or give me a example on how to do it?
Reply
#2

Wrong section.
Must be on Script Request Thread.

Btw, here's the snippet.

PHP код:
new File:cmdlog;
public 
OnPlayerCommandText(playerid,cmdtext[])
{
  new 
string[128];
  new 
Lname[MAX_PLAYER_NAME];
  
GetPlayerName(playerid,Lname,sizeof(Lname));
  
format(string,sizeof(string),"%s has used the command (%s) \r\n"Lnamecmdtext);
  
cmdlog fopen("CMD_Logs.txt"io_append);
  
fwrite(cmdlog,string);
  
fclose(cmdlog);
  return 
0;

Reply
#3

I only asked for a example, but thanks! ^^
Reply
#4

Np, btw I edited my snippet because the previous one will save the text like this :
Код:
Lordz has used the command (/example) Lordz has used the command (/example2)
The edited one will be saving like this:
Код:
Lordz has used the command (/example)
Lordz has used the command (/example2)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)