14.01.2013, 20:49
PHP код:
#define COLOR_YELLOW 0xEAEA15C8
#define NO_PARAMS 0xBEBCD3FF
CMD:pm(playerid, params[])
{
new string[256], text[128], targetid;
if(sscanf(params, "rs[128]", targetid, text)) return SendClientMessage(playerid, NO_PARAMS, "USAGE: /pm [Id or name] [text]");//If no enough params
if(targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, ERROR, "ERROR: Invalid player ID or Name");//If player wants to PM him self or a not connected player
if(targetid == playerid) return SendClientMessage(playerid, ERROR, "ERROR: You cannot PM yourself");
format(string, sizeof(string), "PM from: %s |Text: %s", Name(playerid), text);//The format of the string
SendClientMessage(targetid, COLOR_YELLOW, string);//sending the message to the targetid
format(string, sizeof(string), "PM to: %s| Text: %s", Name(targetid), text);
SendClientMessage(playerid, COLOR_YELLOW, string);
return 1;
}