13.03.2015, 15:40
This will store date and time:
If you want to change the directory, just change this line:
to:
or anything.
PHP код:
CMD:pm(playerid,params[])
{
new targetid, msg[128];
if(sscanf(params, "us[128]", targetid, msg)) return SendClientMessage(playerid, LIGHTBLUE,"[ USAGE: /pm (name/id) (Message) ]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, red, "[ ERROR: Player is not online! ]");
if(pm[targetid] == false) return SendClientMessage(playerid, red,"[ ERROR: Player has blocked private messages! ]");
if(targetid == playerid) return SendClientMessage(playerid, red, "[ ERROR: You can't pm yourself! ]");
new string[128], Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name1, sizeof(Name1));
GetPlayerName(targetid, Name2, sizeof(Name2));
format(string, sizeof(string),"Private Message from %s (%d): %s", Name1, playerid, msg);
SendClientMessage(targetid,COLOR_PINK, string);
format(string, sizeof(string),"Private Message sent to %s (%d): %s", Name2, targetid, msg);
SendClientMessage(playerid,COLOR_PINK, string);
new File:file=fopen("PM.log", io_append), hour, minute, second, year, month, day;
Gettime(hour, minute, second);
Getdate(year, month, day);
format(string, sizeof(string), "[%d/%d/%d, %d:%d:%d] %s to %s: %s\r\n", day, month, year, hour, minute, second, Name1, Name2, msg);
fwrite(file, string);
fclose(file);
return 1;
}
PHP код:
new File:file=fopen("PM.log", io_append);
PHP код:
new File:file=fopen("/database/PM.log", io_append);