03.08.2009, 13:33
hello,i got 2 commands ,one is /ask and one is /answer,how i can make answer for admins and how i can make ask that only admins see it?
please help THANKS
please help THANKS
Quote:
if(strcmp(cmd, "/ask", true) == 0) { if(IsPlayerConnected(playerid)) { GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /ask [Question]"); return 1; } format(string, sizeof(string), " %s asks : %s", sendername, (result)); ABroadCast(COLOR_YELLOW,string,1); SendClientMessage(playerid, COLOR_YELLOW, "Your Question Message was sent to the Admins."); } return 1; } if(strcmp(cmd, "/answer", true) == 0 || strcmp(cmd, "/ans", true) == 0) { if(IsPlayerConnected(playerid)) { if(gPlayerLogged[playerid] == 0) { SendClientMessage(playerid, COLOR_GREY, " You havent logged in yet !"); return 1; } tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/ans)wer [playerid/PartOfName] [Answer]"); return 1; } giveplayerid = ReturnUser(tmp); if (IsPlayerConnected(giveplayerid)) { if(giveplayerid != INVALID_PLAYER_ID) { GetPlayerName(playerid, sendername, sizeof(sendername)); GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer)); if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, " You can't answer yourself"); } new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/ans)wer [playerid/PartOfName] [Answer]"); return 1; } format(string, sizeof(string), "%s answers: %s", sendername, (result)); SendClientMessage(giveplayerid, COLOR_GREEN, string); format(string, sizeof(string), "Answer sent to %s.", giveplayer); SendClientMessage(playerid, COLOR_GREEN, string); return 1; } } else { format(string, sizeof(string), " %d is not an active player.", giveplayerid); SendClientMessage(playerid, COLOR_GRAD1, string); } } return 1; } |