09.01.2012, 18:49
pawn Код:
if(!strcmp("/pm", cmdtext, true))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /PM [playerid] [text]");
new player1 = strval(tmp), text = strrest(cmdtext, idx), playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
if(!strlen(text)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /PM [playerid] [text]");
if(!IsPlayerConnected(player1)) return SendClientMessage(playerid, COLOR_YELLOW, "That player is not connected!");
GetPlayerName(player1, playername, sizeof(playername));
GetPlayerName(playerid, adminname, sizeof(adminname));
format(string, sizeof(string), ">> (PM) To %s: %s", playername, player1, text);
SendClientMessage(playerid, COLOR_YELLOW, string);
format(string, sizeof(string), "<< (PM) From %s: %s", adminname, playerid, text);
SendClientMessage(player1, COLOR_YELLOW, string);
printf("%s has PMed: %s(%s)", adminname, playername, text);
return 1;
}