SA-MP Forums Archive
Issue with command logging. - 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: Issue with command logging. (/showthread.php?tid=619026)



Issue with command logging. - UnholyBeast - 12.10.2016

So. Recently. I decided to make a basic command log, and for some reason it keeps outputting like this

Код:
UnholyBeast(0) has used the command /test.UnholyBeast(0) has used the command /test.
Here's the code

Код:
CMD:test(playerid, params[])
{
	new log_string[144];
	format(log_string, sizeof(log_string), "%s(%d) has used the command /test.", PlayerName(playerid), playerid);
	SendCommandToLog(log_string);
	return 1;
}

stock SendCommandToLog(command_string[])
{
	new File:cmd_log = fopen("/server_files/command_log.txt", io_append);
	fwrite(cmd_log, command_string);
        fwrite(cmd_log, "\n");
	fclose(cmd_log);
	return 1;
}
Not sure if it has something to do with the way fwrite was made, or if I am just using it incorrectly.


Re: Issue with command logging. - Konstantinos - 12.10.2016

Similar problem: https://sampforum.blast.hk/showthread.php?pid=3780893#pid3780893


Re: Issue with command logging. - UnholyBeast - 12.10.2016

Thank you.