Command Log
#4

What the person above me said, OR if you want commands in specific files:
pawn Код:
stock LogCommand(event[])
{
  new File:log = fopen("command_log.txt", io_append);
  fwrite(log, event);
  fwrite(log, "\n");
  fclose(log);
}
Should work by 'LogCommand();', however I did not test the code.

Example usage:

pawn Код:
COMMAND:heal(playerid, params[])
{
  new target;
  if(sscanf(params, "u", target)) return SendClientMessage(playerid, 0x00ff0f00, "Usage: /heal [playerid/name]");
  else if(target == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0x00ff0f00, "Invalid player!");
  SetPlayerHealth(target, 100);
  new gName[MAX_PLAYER_NAME], string[128];
  GetPlayerName(target, gName, MAX_PLAYER_NAME);
  GetPlayerName(playerid, string, MAX_PLAYER_NAME);
  format(string, sizeof string, "[HEAL] %s has healed %s", string, gName); //Important: Formats the string to log
  CommandLog(string); //Log the string
  return 1;
}
Hope that kind of explained it to you.
Reply


Messages In This Thread
Command Log - by SanAndreasVille - 24.02.2011, 21:56
Re: Command Log - by maramizo - 24.02.2011, 21:57
Re: Command Log - by dice7 - 24.02.2011, 22:04
Re: Command Log - by Hiddos - 24.02.2011, 22:25
Re: Command Log - by SanAndreasVille - 24.02.2011, 23:17
Re: Command Log - by pawn_ - 24.02.2011, 23:21
Re: Command Log - by SanAndreasVille - 26.02.2011, 15:04
Re: Command Log - by MP2 - 26.02.2011, 15:16
Re: Command Log - by SanAndreasVille - 26.02.2011, 15:26
Re: Command Log - by MP2 - 26.02.2011, 15:31

Forum Jump:


Users browsing this thread: 2 Guest(s)