problem with this quiz
#1

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
Reply
#2

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"}
};
Reply
#3

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.
Reply
#4

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
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)