How to succesfull make a quiz?
#1

I want this:

If you type a certain command, then a quiz has to pop-up.

It has to display the question, below that three answers and you have to answer by typing a, b or c.

If you have one wrong, you get rejected from it, if you succed, you have to be added to a group (level 1 of pFreecop)

Can anybody help me, please?
Reply
#2

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/quiz", cmdtext, true, 4) == 0)
	{
		ShowPlayerDialog(playerid, 5000, DIALOG_STYLE_INPUT, "Quiz", "Question here\nA.) Answer1\nB.) Answer2\nC.) Answer3\nPlease type A, B or C.", "Cancel", "Continue");
		return 1;
	}
        return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if (dialogid == 5000)
	{
	    if(!response)
	    {
	    }
	    else
	    {
	    	if(!strcmp(inputtext, "A", true)) // WRONG ANSWER
	    	{
	    	    SendClientMessage(playerid, 0xFF0000AA, "[QUIZ]: Wrong answer!");
			}
			else if(!strcmp(inputtext, "B", true)) // GOOD ANSWER
			{
			    SendClientMessage(playerid, 0xFF0000AA, "[QUIZ]: Good answer!");
			    pFreeCop[playerid] = 1;
			}
			else if(!strcmp(inputtext, "C", true)) // WRONG ANSWER
			{
			    SendClientMessage(playerid, 0xFF0000AA, "[QUIZ]: Wrong answer!");
			}
			else
			{
			    SendClientMessage(playerid, 0xFF0000AA, "[ERROR]: You need to use A, B or C!");
			}
		}
		return 1;
	}
        return 1;
}
A is wrong, B is correct and C is wrong.
Make sure you choose the right answers.
Reply
#3

Where to put this? Just as a normal command? And how to add more questions with it, and add the player to a custom group if succeeds?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)