13.04.2013, 06:48
(
Последний раз редактировалось CrossUSAAF; 13.04.2013 в 09:44.
Причина: [SOLVED]
)
Hello there!
I Have activity system, that keeps log from a player, like used admin commands for target player. It uses the basic I/O system, but something might be wrong in my code. I Use "io_write", when activity file does not exist and "io_append", when activity file exists. The problem is this: it won't write to a new line, it keeps replacing the old activity from a ".log" file. Below you can see the current code:
I Have tried to change multiple things, but nothing. Thanks for your reply in advance!
I Have activity system, that keeps log from a player, like used admin commands for target player. It uses the basic I/O system, but something might be wrong in my code. I Use "io_write", when activity file does not exist and "io_append", when activity file exists. The problem is this: it won't write to a new line, it keeps replacing the old activity from a ".log" file. Below you can see the current code:
pawn Код:
// Sets the player activity:
format(string, sizeof(string), "%s.log", PlayerName(ID));
new File:activity;
if(!fexist("%s.log"))
{
activity = fopen(string, io_write);
}
else
{
activity = fopen(string, io_append);
}
if(activity )
{
format(string, sizeof(string), "Hello %s!", PlayerName(ID));
fwrite(activity , string);
fwrite(activity , "\r\n");
fclose(activity);
}