15.06.2010, 15:29
Код:
if(!strcmp(cmd, "/pm", true)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, RedCol, "USAGE: /pm [playerid] [message]"); new ID = strval(tmp); if(!IsNumeric(ID)) return SendClientMessage(playerid,RedCol,"ERROR: Invalid player ID."); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,RedCol,"ERROR: Player is not connected."); if(ID == playerid) return SendClientMessage(playerid,RedCol,"ERROR: You cannot PM yourself."); tmp = strrest(cmdtext, idx); if(!strlen(tmp)) return SendClientMessage(playerid, RedCol, "USAGE: /pm [playerid] [message]"); new name[24],mString[190]; GetPlayerName(playerid,name,24); format(mString,sizeof(mString),"Message from %s(%d): %s",name,playerid,tmp); SendClientMessage(ID,YellowCol,mString); GetPlayerName(ID,name,24); format(mString,sizeof(mString),"Message succesfully sent to %s.",name); SendClientMessage(playerid,Yellow2Col,mString); return 1; }