13.07.2011, 08:29
Well I'm trying to make it so when you /report you have to do /report admin name text.
At the moment, if you just do "/report" it sends the help message, but if you put anything else after "/report" it says Unknown Command.
It's meant to send a message to giveplayerid and the message is meant to be the Result.
At the moment, if you just do "/report" it sends the help message, but if you put anything else after "/report" it says Unknown Command.
Код:
if(strcmp(cmd, "/report", true) == 0) { if(IsPlayerConnected(playerid)) { if(JustReported[playerid] == 1) { SendClientMessage(playerid, COLOR_GREY, "Wait 10 seconds after sending a next report!"); return 1; } giveplayerid = ReturnUser(tmp); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); GetPlayerName(playerid, sendername, sizeof(sendername)); if(AdminDutyStatus[giveplayerid] = 0) { SendClientMessage(playerid, COLOR_WHITE,"That admin is not on duty! See /admins"); return 1; } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[96]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "[Help] /report [admin name] [text]"); return 1; } JustReported[playerid] = 1; SetTimerEx("ReportReset", 10000, false, "i", playerid); format(string, sizeof(string), "Report from [%d]%s: %s",playerid, sendername, (result)); SendClientMessage(giveplayerid,COLOR_LIGHTYELLOW,string); SendClientMessage(playerid, COLOR_YELLOW, "Your Report Message was sent to the Admins."); } return 1; }