02.02.2013, 08:23
Hey guys, I've added a /ask and /answer command to my script. Here is the ask command:
And the answer command:
The problem is when I do /ask and /answer, it doesn't work. Well it does work, but it says I didn't put it in the right format, and it gives me the "USAGE:" message, when I done it correctly. Please help! Also, if u need the stock for SendMessageToAdmins, here it is:
Please help!
Код:
CMD:ask(playerid, params[]) { if (sscanf(params, "s[256]", Question[playerid])) return SendClientMessage(playerid, 0x009DFFFF,"USAGE:{FFFFFF} /ask [Question]"); if(QuestionAsked[playerid] == true) return SendClientMessage(playerid, COLOR_RED, "ERROR: Wait for the response of your previous question!"); new string[128], string2[256], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, sizeof(name)); format(string2, sizeof(string2), "QUESTION: %s", Question[playerid]); SendMessageToAdmins(COLOR_GREEN, string2); format(string, sizeof(string), "INFO: %s has asked a question, use /answer %d to answer it!", name, playerid); SendMessageToAdmins(COLOR_GREEN, string); QuestionAsked[playerid] = true; return 1; }
Код:
CMD:answer(playerid, params[]) { new ID, string[256], string2[256]; if(pInfo[playerid][Adminlevel] < 1)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command"); if (sscanf(params, "is[256]", ID, string)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /answer [ID] [Answer]"); if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player is not connected!"); if(QuestionAsked[ID] != true) return SendClientMessage(playerid, COLOR_RED, "ERROR: This player has not asked a question!"); QuestionAsked[ID] = false; format(string2, sizeof(string2), "ANSWER: %s", string); SendClientMessage(ID, COLOR_GREEN, string2); return 1; }
Код:
SendMessageToAdmins(color,const msg[]) { for (new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) if(pInfo[i][Adminlevel] > 1) SendClientMessage(i,color,msg); } }