23.08.2010, 21:40
pawn Код:
CMD:pm(playerid, params[])
{
new str[128], str2[128], id, Name1[MAX_PLAYER_NAME], Name2[MAX_PLAYER_NAME];
if(sscanf(params, "us[128]", id, str2)) SendClientMessage(playerid, 0xFF0000FF, "Usage: /pm <id/name> <message>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: That player is not connected!");
if(playerid != id) return SendClientMessage(playerid, 0xFF0000FF, "ERROR: You cannot pm yourself!");
GetPlayerName(playerid, Name1, sizeof(Name2)); //The Sender's Name so we use (playerid).
GetPlayerName(id, Name2, sizeof(Name2)); //The Receiver's Name so we use (id).
format(str, sizeof(str), "PM To %s(ID %d): %s", Name2, id, str2);
SendClientMessage(playerid, 0xFF0000FF, str);
format(str, sizeof(str), "PM From %s(ID %d): %s", Name1, playerid, str2);
SendClientMessage(id, 0xFF0000FF, str);
return 1;
}