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[playerid][i]==1)
{
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;
}
dcmd_watchpmon(playerid,params[])
{
#pragma unused params
new ID;
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Player is not joined.");
if(PmWatch[playerid][ID]==1) return SendClientMessage(playerid, COLOR_ERROR, "You have already wathing player's private messages");
PmWatch[playerid][ID]=1;
SendClientMessage(playerid,COLOR_ADMIN,"Watch PM: Turned on.");
return 1;
}
dcmd_watchpmoff(playerid,params[])
{
#pragma unused params
new ID;
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmoff (id)");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_ERROR, "Player is not joined.");
if(PmWatch[playerid][ID]==0) return SendClientMessage(playerid, COLOR_ERROR, "Wath pm have already off.");
PmWatch[playerid][ID]=0;
SendClientMessage(playerid,COLOR_ADMIN,"Watch pm: Turned off");
return 1;
}
new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)");
|
Код:
new ID; if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /watchpmon (id)"); |
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;
}