SA-MP Forums Archive
problem with this quiz - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: problem with this quiz (/showthread.php?tid=248681)



problem with this quiz - mrcoolballs - 15.04.2011

Hello forum,
I'm trying to make a simple quiz, in which it asks you questions and you have to give the correct answer, but I am having a few problems.

pawn Код:
new thing;
new StartQuestions[2][2] =
{
    {"How many horns does a unicorn have?","one"},// Line 8
    {"How many thumbs does a normal human being have?","two"}
};
That creates the questions with the answer next to it.

pawn Код:
new str[128];
thing = StartQuestions[random(2)];//Line 23
format(str,sizeof(str),"%s",thing);
SendClientMessageToAll(0,str);
Then this should send a random question out of the 2 provided to everyone.
The problem being is that I get these errosr:

Код:
(8) : error 018: initialization data exceeds declared size
(23) : error 006: must be assigned to an array
If anyone could give me a hand I will be very thankfull


Re: problem with this quiz - xir - 15.04.2011

maybe this

pawn Код:
new StartQuestions[][52] =
{
    {"How many horns does a unicorn have?","one"},// Line 8
    {"How many thumbs does a normal human being have?","two"}
};



Re: problem with this quiz - mrcoolballs - 15.04.2011

How would I check if what the player typed is the correct answer, the way I was trying to do it before was, under OnPlayerText I would compare the Text and StartQuestion[thing][2], with 2 being the second parameter of the string.


Re: problem with this quiz - MadeMan - 15.04.2011

pawn Код:
new thing;
new StartQuestions[2][2][] =
{
    {"How many horns does a unicorn have?","one"},
    {"How many thumbs does a normal human being have?","two"}
};
pawn Код:
new str[128];
thing = random(2);
format(str,sizeof(str),"%s",StartQuestions[thing][0]);
SendClientMessageToAll(0,str);
OnPlayerText
pawn Код:
if(strcmp(text, StartQuestions[thing][1]) == 0)
{
    // right answer
}