30.10.2014, 22:38
pawn Код:
CMD:w(playerid, params[]) return cmd_whisper(playerid, params);
CMD:whisper(playerid, params[])
{
new string[128], message[128], targetid;
if(sscanf(params, "us[128]", targetid, message)) return SendClientMessageEx(playerid, COLOR_GREY, "Usage: /w(hisper) [playerid] [message]");
else if(!IsPlayerConnectedEx(targetid)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
else if(!IsPlayerInRangeOfPlayer(playerid, targetid) && PlayerInfo[playerid][pAdminLevel] < 2) return SendClientMessageEx(playerid, COLOR_GREY, "You must be near the specified player to use this command!");
else if(playerid == targetid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot use this command on yourself!");
format(string, sizeof(string), "(ID %d) %s whispers to you: %s", playerid, GetPlayerNameEx(playerid), message);
SendClientMessageEx(targetid, COLOR_YELLOW, string);
format(string, sizeof(string), "You whispered to (ID %d) %s: %s", targetid, GetPlayerNameEx(targetid), message);
SendClientMessageEx(playerid, COLOR_YELLOW, string);
return 1;