01.03.2012, 01:42
Hello, to familiarize myself with the original file functions I decided to make a simple chatlog for practice. Only problem is that whenever I type anything in the main chat my server crashes. This is my file writing code. No errors on compiling either.
This is defined at the top of my script.
OnPlayerText.
and before you ask, yes, I do have the
file in my server directory in the "Server" file. Also, my server-log shows nothing but the last text I typed.
This is defined at the top of my script.
pawn Код:
#define LOG "../Server/log.txt"
pawn Код:
public OnPlayerText(playerid, text[])
{
new pname[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, pname, sizeof(pname));
strreplace(pname,'_',' ');
format(str, sizeof(str), "(American accent) %s says: %s", pname, text);
ProxDetector(30.0, playerid, str, COLOR_WHITE);
new lstring[254],File:log = fopen(LOG,io_write);
format(lstring,254,"[chat] %s: %s",pname,text);
fwrite(log,lstring);
fclose(log);
return 0;
}
Код:
log.txt