/Answer & /ask problem (Very urgent) -
Goldino - 02.02.2013
Hey guys, I've added a /ask and /answer command to my script. Here is the ask command:
Код:
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;
}
And the answer command:
Код:
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;
}
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:
Код:
SendMessageToAdmins(color,const msg[])
{
for (new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i)) if(pInfo[i][Adminlevel] > 1) SendClientMessage(i,color,msg);
}
}
Please help!
Re: /Answer & /ask problem (Very urgent) -
Goldino - 02.02.2013
Help plz
Re: /Answer & /ask problem (Very urgent) -
Roach_ - 02.02.2013
Try this:
pawn Код:
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, "us[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;
}
Re: /Answer & /ask problem (Very urgent) -
Goldino - 02.02.2013
What about ask?
Re: /Answer & /ask problem (Very urgent) -
Roach_ - 02.02.2013
You must not use 'i' specifier, but 'u'..
Re: /Answer & /ask problem (Very urgent) -
Goldino - 02.02.2013
Wait. I tried the /answer command, and it still doesn't work? You have TeamViewer or something so you can help me?
Re: /Answer & /ask problem (Very urgent) -
Goldino - 02.02.2013
Help?