18.04.2015, 09:49
pawn Код:
dcmd_pm(playerid, params[])
{
new pID, text[128], string[128];
if(sscanf(params, "us[128]", pID, text)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /pm (nick/id) (message)");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "Player is not joined.");
if(pID == playerid) return SendClientMessage(playerid, COLOR_RED, "You cant pm yourself.");
format(string, sizeof(string), "%s (%d) not accepting private messages now.", PlayerName(pID), pID);
if(PMInfo[pID][NoPM] == 1) return SendClientMessage(playerid, COLOR_RED, string);
format(string, sizeof(string), "PM Sent %s(%d): %s", PlayerName(pID),pID, text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "PM %s(%d): %s", PlayerName(playerid),playerid, text);
SendClientMessage(pID, COLOR_YELLOW, string);
for(new i = 0; i != MAX_PLAYERS; i++)
{
if(PmWatch[i][playerid] == 1) // You were checking [playerid][i] instead of this.
{
format(string, sizeof(string), "[PM Watch] %s(%d) >> %s(%d): %s", PlayerName(playerid),playerid,PlayerName(pID),pID, text);
SendClientMessage(i, COLOR_GREY, string);
}
}
PMInfo[pID][Last] = playerid;
return 1;
}