13.03.2015, 15:01
(
Последний раз редактировалось Sc0pion; 14.03.2015 в 20:21.
)
Fixed!
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;
}
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); MessageLog(msg); return 1; }
forward MessageLog(msg[]); public MessageLog(msg[]) { new entry[256]; format(entry,sizeof(entry),"%s\r\n",msg); new File:rFile; rFile = fopen("PM.txt",io_append); fwrite(rFile,entry); fclose(rFile); }
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;
}
new File:file=fopen("PM.log", io_append);
new File:file=fopen("/database/PM.log", io_append);
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;
}