How to succesfull make a 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: How to succesfull make a quiz? (
/showthread.php?tid=260383)
How to succesfull make a quiz? -
Supercop - 08.06.2011
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?
Re: How to succesfull make a quiz? -
Jack Shred - 08.06.2011
Код:
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.
Re: How to succesfull make a quiz? -
Supercop - 08.06.2011
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?