06.05.2014, 17:28
pawn Код:
CMD:pm(playerid, params[])
{
new pID, text[210], string[230],string2[250],string3[250];
if(sscanf(params, "us[110]", pID, text)) return SendClientMessage(playerid, ERROR_COLOR, "USAGE: /pm (nick/id) (message) - Enter a valid Nick / ID");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, ERROR_COLOR, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, ERROR_COLOR, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", GetName(pID), pID);
if(PlayerInfo[pID][NoPM] == 1) return SendClientMessage(playerid, ERROR_COLOR, string);
format(string2, sizeof(string2), "PM to %s: %s", GetName(pID), text);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string2);
format(string3, sizeof(string3), "PM from %s: %s", GetName(playerid), text);
SendClientMessage(pID, COLOR_LIGHTBLUE, string3);
PlayerInfo[pID][Last] = playerid;
return 1;
}
CMD:r(playerid, params[])
{
new text[128], string[128],string2[128],string3[128];
if(sscanf(params, "us[110]", text)) return SendClientMessage(playerid, ERROR_COLOR, "USAGE: /r (message) - Enter your message");
new pID = PlayerInfo[playerid][Last];
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, ERROR_COLOR, "Player is not connected.");
if(pID == playerid) return SendClientMessage(playerid, ERROR_COLOR, "You cannot PM yourself.");
format(string, sizeof(string), "%s (%d) is not accepting private messages at the moment.", GetName(pID), pID);
if(PlayerInfo[pID][NoPM] == 1) return SendClientMessage(playerid, ERROR_COLOR, string);
format(string2, sizeof(string2), "PM to %s: %s", GetName(pID), text);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string2);
format(string3, sizeof(string3), "PM from %s: %s", GetName(playerid), text);
SendClientMessage(pID, COLOR_LIGHTBLUE, string3);
PlayerInfo[pID][Last] = playerid;
return 1;
}

