Код:
CMD:pm(playerid, params[])
{
new string[256], target, final_string[184];
if(sscanf(params, "us[256]", target, string)) return SendClientMessage(playerid, -1, "{B96EDB}INFO: {FFFFFF}/pm (playerid) (message)");
if(target == playerid) return SendClientMessage(playerid, -1, "{B96EDB}INFO: {FFFFFF}Cannot PM yourself!");
format(final_string, sizeof(final_string), "{EDE740}PM from {BFBB39}%s{EDE740} (%d):{FFFFFF} %s", GetName(playerid), playerid, string);
SendClientMessage(target, -1, final_string);
format(final_string, sizeof(final_string), "{EDE740}PM sent to {BFBB39}%s{EDE740} (%d):{FFFFFF} %s", GetName(target), target, string);
SendClientMessage(playerid, -1, final_string);
format(final_string, sizeof(final_string), "{EDE740}PM from {BFBB39}%s {EDE740}(%d) to {BFBB39}%s {EDE740}(%d): {FFFFFF}%s", GetName(playerid), playerid, GetName(target), target, string);
return 1;
}
pawn Код:
CMD:pm(playerid, params[])
{
new giveplayerid, whisper[128];
if(gPlayerLogged{playerid} == 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not logged in.");
return 1;
}
if(sscanf(params, "us[128]", giveplayerid, whisper))
{
SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /pm [playerid] [text]");
return 1;
}
if (IsPlayerConnected(giveplayerid))
{
if(HidePM[giveplayerid] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "That player is blocking whispers!");
return 1;
}
new giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME], string[128];
sendername = GetPlayerNameEx(playerid);
giveplayer = GetPlayerNameEx(giveplayerid);
if(giveplayerid == playerid)
}
if(ProxDetectorS(5.0, playerid, giveplayerid) || PlayerInfo[playerid][pAdmin] >= 2)
{
format(string, sizeof(string), "%s (ID %d) whispers to you: %s", GetPlayerNameEx(playerid), playerid, whisper);
if(strlen(string) > 92)
{
new firstline[128], secondline[128];
strmid(firstline, string, 0, 88);
strmid(secondline, string, 88, 128);
format(firstline, sizeof(firstline), "%s ...", firstline);
SendClientMessageEx(giveplayerid, COLOR_YELLOW, firstline);
SendClientMessageEx(giveplayerid, COLOR_YELLOW, secondline);
}
else SendClientMessageEx(giveplayerid,COLOR_YELLOW, string);
format(string, sizeof(string), "You whispered to %s: %s", GetPlayerNameEx(giveplayerid),whisper);
if(strlen(string) > 92)
{
new firstline[128], secondline[128];
strmid(firstline, string, 0, 88);
strmid(secondline, string, 88, 128);
format(firstline, sizeof(firstline), "%s ...", firstline);
SendClientMessageEx(playerid, COLOR_YELLOW, firstline);
SendClientMessageEx(playerid, COLOR_YELLOW, secondline);
}
else SendClientMessageEx(playerid,COLOR_YELLOW, string);
return 1;
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
}
return 1;
}