CMD:pm(playerid, params[])
{
new pID, Message[60], string[128], string2[128], aMessage[128];
if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, -1, "usage :/Pm [ID] [Message]");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID not found ");
format(string, sizeof(string), "Private Message From %s (%d): %s", GetPlayerNameEx(playerid), playerid, Message);
format(string2, sizeof(string2), "Private Message %s (%d): %s", GetPlayerNameEx(pID), pID, Message);
SendClientMessage(playerid, -1, string2);
SendClientMessage(pID, -1, string);
PlayerPlaySound(playerid, 4202, 0.0, 0.0, 0.0);
PlayerPlaySound(pID, 4202, 0.0, 0.0, 0.0);
format(aMessage, sizeof aMessage, "%s (%d) To %s (%d): %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(pID), pID, Message);
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i))SendClientMessage(i, -1, aMessage);
}
return 1;
}
new reply[MAX_PLAYERS];
CMD:pm(playerid, params[])
{
new pID, Message[60], string[128], string2[128], aMessage[128];
if(sscanf(params, "us[60]", pID, Message)) return SendClientMessage(playerid, -1, "usage :/Pm [ID] [Message]");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,-1,"ID not found ");
format(string, sizeof(string), "Private Message From %s (%d): %s", GetPlayerNameEx(playerid), playerid, Message);
format(string2, sizeof(string2), "Private Message %s (%d): %s", GetPlayerNameEx(pID), pID, Message);
SendClientMessage(playerid, -1, string2);
SendClientMessage(pID, -1, string);
PlayerPlaySound(playerid, 4202, 0.0, 0.0, 0.0);
PlayerPlaySound(pID, 4202, 0.0, 0.0, 0.0);
reply[pID] = playerid;
format(aMessage, sizeof aMessage, "%s (%d) To %s (%d): %s", GetPlayerNameEx(playerid), playerid, GetPlayerNameEx(pID), pID, Message);
for(new i; i < MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i))
{
if(PlayerInfo[playerid][pAdmin] < PlayerInfo[i][pAdmin])
{
SendClientMessage(i, -1, aMessage);
}
}
}
return 1;
}
CMD:r(playerid, params[])
{
new pID = reply[playerid], Message[60], string[128], string2[128], aMessage[128];
if(sscanf(params, "s[60]", Message)) return SendClientMessage(playerid, -1, "usage :/r [Message]");
// ... Just do the same process with pID, which was already defined on the last message player's sent.
}
PHP код:
|
for(new i; i < MAX_PLAYERS; i++) { //Checks if the player receiving the PM isn't the one who is sending if( i != playerid ) { if(PlayerInfo[i][pAdmin] >=1 || IsPlayerAdmin(i)) { if(PlayerInfo[playerid][pAdmin] < PlayerInfo[i][pAdmin]) { SendClientMessage(i, -1, aMessage); } } } }