04.11.2011, 20:27
(
Последний раз редактировалось Join7; 05.11.2011 в 19:08.
)
To this PM command. I want to make the Reply command (/reply [text]). When someone writes the command /reply directly responsible, not to write long /pm [playerid] [text]
Код:
if(strcmp(cmd, "/pm", true) == 0) { if(IsPlayerConnected(playerid)) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, GRAY, "USE: /pm [playerid] [text]"); return 1; } giveplayerid = strval(tmp); if (IsPlayerConnected(giveplayerid)) { if(giveplayerid!= INVALID_PLAYER_ID) { GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[256]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, GRAY, "USE: /pm [playerid] [text]"); return 1; } for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { format(string, sizeof(string), "* PM from %s(ID: %d): %s", PlayerName(playerid), playerid, (result)); SendClientMessage(giveplayerid, YELLOW, string); } } format(string, sizeof(string), "* PM for %s(ID: %d): %s", giveplayer, giveplayerid, (result)); SendClientMessage(playerid, YELLOW, string); return 1; } } else { format(string, sizeof(string), "%d is not active player.", giveplayerid); SendClientMessage(playerid, GRAY, string); } } return 1; }