SA-MP Forums Archive
trouble with Cmd 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: trouble with Cmd log (/showthread.php?tid=78563)



trouble with Cmd log - mini-d - 21.05.2009

ive been trying to get my server to right a cmd log with the cmd typed and the players name atm all it does is the cmd how do i fix it? heres code

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  CmdLog(cmdtext);
Код:
public CmdLog(string[])
{
  new entry[256];
  format(entry, sizeof(entry), "%s\n",string);
  new File:hFile;
  hFile = fopen("cmd.log", io_append);
  fwrite(hFile, entry);
  fclose(hFile);
}



Re: trouble with Cmd log - Correlli - 21.05.2009

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[64];
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername, sizeof(playername));
format(string, sizeof(string), "Player %s used %s command.", playername, cmdtext);
CmdLog(string);
return 0;
}