26.09.2012, 11:39
I need help with /pm command
I am i suppose to add hmm.. such as if someone PM it should be like this They can either enter their (ID) or (Partoftheirname) or fullname..
Here is the code :
I am i suppose to add hmm.. such as if someone PM it should be like this They can either enter their (ID) or (Partoftheirname) or fullname..
Here is the code :
Код:
CMD:pm(playerid, cmdtext[]) { new idx = strfind(cmdtext, " ", true); if((cmdtext[0] == EOS) || ((cmdtext[0] == '\1') && (cmdtext[1] == EOS)) || (idx == -1)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /pm [ID] [MESSAGE]"); return 1; } if(cmdtext[idx + 1] == EOS) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"Usage: /pm [ID] [MESSAGE]"); return 1; } cmdtext[idx++] = EOS; new id = strval(cmdtext); if(!IsPlayerConnected(id)) { SendClientMessage(playerid,COLOR_LIGHTBLUE,"/pm : Wrong Player ID"); return 1; } if(playerid == id) { SendClientMessage(playerid,COLOR_YELLOW,"You cannot PM yourself."); return 1; } new string[256]; GetPlayerName(id, string, MAX_PLAYER_NAME); format(string, sizeof string, "[PM] Message send to %s(%d): %s", string, id, cmdtext[idx]); SendClientMessage(playerid, COLOR_LIGHTBLUE, string); GetPlayerName(playerid, string, MAX_PLAYER_NAME); format(string, sizeof string, "[OOCPM] Message from %s(%d): %s", string, playerid, cmdtext[idx]); SendClientMessage(id, COLOR_LIGHTBLUE, string); PlayerPlaySound(id, 1057, 0.0, 0.0, 0.0); printf("PM: %s", cmdtext[idx]); return 1; }