This variable dont work? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: This variable dont work? (
/showthread.php?tid=508481)
This variable dont work? -
Blackazur - 22.04.2014
Hello, why this dont work, it says "this player has not asked a question" even if he does?
Код:
if(QuestionAsked[playerid] != true) return SendClientMessage(playerid, -1,""chat""COL_RED" This player has not asked a question!");
Re: This variable dont work? -
Konstantinos - 22.04.2014
Even if he does, does the system know that as long as you don't set
QuestionAsked[playerid] to true? No.
AW: This variable dont work? -
Blackazur - 22.04.2014
it is set to true here are the commands:
Код:
CMD:ask(playerid, params[])
{
new string[128], string2[256];
if (sscanf(params, "s[256]", Question[playerid])) return SendClientMessage(playerid, -1,""chat" Usage: /ask [question]");
if(QuestionAsked[playerid] == true) return SendClientMessage(playerid, -1,""chat""COL_RED" Wait for the response of your previous question!");
SendClientMessage(playerid,-1,""chat""COL_RED" Your question has been successfully sent to admins!");
format(string, sizeof(string),""chat" {FF0000}%s (%d) has asked a question, use /answer %d to answer it!", PlayerName(playerid),playerid,playerid);
SendMessageToAllAdmins(string, -1);
format(string2, sizeof(string2),""chat" {FF0000}Question: %s", Question[playerid]);
SendMessageToAllAdmins(string2, -1);
QuestionAsked[playerid] = true;
return 1;
}
CMD:answer(playerid, params[])
{
new targetid, string[256], string2[256];
if (sscanf(params, "is[256]", targetid, string)) return SendClientMessage(playerid,-1,""chat" Usage: /answer [playerid] [answer]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, -1,""chat""COL_RED" Player is not connected/online.");
if(QuestionAsked[playerid] != true) return SendClientMessage(playerid, -1,""chat""COL_RED" This player has not asked a question!");
QuestionAsked[playerid] = false;
SendClientMessage(playerid,-1,""chat""COL_RED" Your answer has been successfully sent!");
format(string2, sizeof(string2),""chat""COL_RED" Answer: %s", string);
SendClientMessage(targetid, -1, string2);
SendClientMessage(targetid,-1,""chat""COL_RED" Your question got answered.");
return 1;
}
Re: This variable dont work? -
Konstantinos - 22.04.2014
You need to check and set the variable for the
targetid, not the
playerid.
pawn Код:
if(QuestionAsked[targetid] != true) return SendClientMessage(playerid, -1,""chat""COL_RED" This player has not asked a question!");
QuestionAsked[targetid] = false;