13.03.2015, 15:16
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);
format(string, sizeof(string), "%s to %s: %s\r\n", Name1, Name2, msg);
fwrite(file, string);
fclose(file);
return 1;
}