Random Questions with Answers
#1

Hello Guys!

I am trying to create Questions and Answers with Dialogs, let me give one example:

Will open one Dialog style Input with this question:
Код:
What is your level?
The player need to write the answer:
Код:
2
The Main question is: how can i create multiple variables with the Questions and the respectively answers?
And how can i introduce this in ShowPlayerDialog?
Reply
#2

pawn Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#include <foreach>

#define DIALOG_LEVEL 1

new PlayerLevel[MAX_PLAYERS];

CMD:question(playerid, params[]){
    foreach(Player, i){
        ShowPlayerDialog(i, DIALOG_LEVEL, DIALOG_STYLE_INPUT, "Question", "What is your level?", "Ok", "Cancel");
    }    
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]){
    if(dialogid == DIALOG_LEVEL){
        if(response){
            if(strval(inputtext) == PlayerLevel[playerid]){
                //Code for correct here
            }
            else {
                //Code for incorrect here
            }
        }
        else return 1;
    }
    return 0;
}
Reply
#3

My idea is to do something like this:

Код:
new RandomQuestions [3][][] { // dont know how to use this :P
{5, "QUestion 1", "Answer 1"), // Where 5 is the DialogID, and the String is the question, and next string is the  correctly answer of the first quest.
{6, "QUestion 2", "Answer 2"),
{7, "QUestion 3", "Answer 4")
}
MIXED with the function: random.

Randomize the lines of the array:
Or use the line of DialogID 5
Or use the line of DialogID 6
Or use the line of DialogID 7
Reply
#4

upppppppppp
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)