13.11.2009, 18:22
pawn Код:
#define Prvmsgs "Logs/Prvmsgs.txt" //server floder/scriptfiles..
public OnPlayerPrivmsg (playerid, recieverid, text[])
{
new name[MAX_PLAYER_NAME];
new rname[MAX_PLAYER_NAME];
new string[256];
GetPlayerName(playerid,name,sizeof(name));
GetPlayerName(recieverid,rname,sizeof(rname));
format(string,sizeof(string),"%s to %s: %s",name,rname,text);
WriteLog(Prvmsgs,string); //+ Time
return 1;
}
stock WriteLog(const file[],const text[]) //by Goldkiller
{
new
c[128],
time[2],
File:cFile=cFile=fopen(file, io_append);
if(!cFile) return 0;
gettime(time[0],time[1]);
format(c,sizeof(c),"[%02d:%02d] %s\r\n",time[0],time[1],text);
fwrite(cFile,c);
fclose(cFile);
return 1;
}
pawn Код:
WriteLog(Prvmsgs,string);
I'm unsure if this works, but in my opinion it should be alright. Correct me if i'm wrong and a "Thanks" (if this works ) wouldn't be bad, either... XD
Cheers,
DeathOnaStick