Nützlich zum erstellen von Logs :
stock Log(logname[],input[])
{
new hour,minute,second;
gettime(hour,minute,second);
new File:Logfile,saveformat[64],dataformat[256];
format(saveformat,64,"%s.txt",logname);
if(!fexist(saveformat))
{
Logfile = fopen(saveformat,io_write);
}
Logfile = fopen(saveformat,io_append);
format(dataformat,256,"[%i:%i:%i] %s\r\n",hour,minute,second,input);
fwrite(Logfile,dataformat);
fclose(Logfile);
return 1;
}
Beispiel:
public OnPlayerText(playerid, text[])
{
new string[128],name[20];
GetPlayerName(playerid,name,20);
format(string,128,"%s: %s",name,text);
Log("Chatlog",string);
return 1;
}