Help with dialogs
#1

I got an error while i was making an drp quiz

The script is

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_QUIZ)
	{
	    if(!response) return Kick(playerid);
	    if(response)
	    {
	        if(listitem == 0)
	        {
	            SendClientMessage(playerid, -1, "Wrong Answer");
				Kick(playerid);
			}
			if(listitem == 1)
			{
			    SendClientMessage(playerid, -1, "Thats Correct Answer");
			}
			SpwanPlayer(playerid);
		}
	 }
	 return 1;
}
The errors are
Код:
C:\Users\PART\Desktop\Desktop\samp03csvr_R2-2_win32\gamemodes\larp.pwn(34) : warning 201: redefinition of constant/macro (symbol "DIALOG_QUIZ")
C:\Users\PART\Desktop\Desktop\samp03csvr_R2-2_win32\gamemodes\larp.pwn(3376) : error 017: undefined symbol "SpwanPlayer"
Reply
#2

It's SpawnPlayer not SpwanPlayer.And you #define DIALOG_QUIZ two times, so delete one.
Reply
#3

I want to create a dialog quiz for new logins. So how can i do that?
Reply
#4

https://sampforum.blast.hk/showthread.php?tid=283920
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_QUIZ)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(listitem == 0)
            {
                SendClientMessage(playerid, -1, "Wrong Answer");
                Kick(playerid);
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, -1, "Thats Correct Answer");
            }
            SpawnPlayer(playerid);
        }
     }
     return 1;
}
Press CTRL + F and search for: #define DIALOG_QUIZ and delete ONE.
Reply
#5

I did that. But I want to make a quiz for new players who registers for the first time.
Reply
#6

#define DIALOG_QUIZ 10001
Reply
#7

pawn Код:
#define DIALOG_QUIZ 5550
#define DIALOG_QUIZ1 5551
#define DIALOG_QUIZ2 5552
#define DIALOG_QUIZ3 5553
#define DIALOG_QUIZ4 5554
pawn Код:
ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
// Put it at your REGISTER command, it will show him the first question from the quiz, he have to choose from those 3 answers
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_QUIZ) // If first dialog shows up
    {
        if(!response) return Kick(playerid); // If he click "Leave Game" he will be kicked.
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer, wich is: Real Pussy
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 1) // If he choose 2nd answers, which is: Role Play (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid,DIALOG_QUIZ1,DIALOG_STYLE_LIST,"It is LOL a frequently used word in role play server?"," Yes \n No, it's a NON-RP word \n LOL I like this word!","Select","Leave Game");
                // Second question will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ1) // If second dialog shows up
    {
        if(!response) return Kick(playerid); // If he press second button he get kicked
        if(response) // If he press first button
        {
            if(listitem == 0) // If he choose first answer wich is: Yes
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: No, it's a NON-RP word (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer"); // He will get a message that he answered correct
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST,"Which /me is used correct?"," /me laughs \n /me rofl \n /me wtf","Select","Leave Game");
                // Next dialog will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ2) // If 3rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: /me laugs (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2)
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST,"What IC stands for?"," Information Centre \n In Character \n I'm Cool","Select","Leave Game");
                // Next dialog will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ3) // If 4rd dialog shows up
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answer wich is: Information Centre
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 1) // If he choose first answer wich is: In Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer!");
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
            if(listitem == 2) // If he choose first answer wich is: I'm Cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST,"What OOC stands for?"," Out of Chat \n Out of Character \n Ow ow cool","Select","Leave Game");
                // Next dialog will show up
            }
        }
    }
    if(dialogid == DIALOG_QUIZ4)
    {
        if(!response) return Kick(playerid); // If he click second button he get kicked
        if(response) // If he click first button
        {
            if(listitem == 0) // If he choose first answers wich is: Out of Chat
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong.
            }
            if(listitem == 1) // If he choose second answers wich is: Out of Character (correct one)
            {
                SendClientMessage(playerid, -1,"That's the correct answer");
            }
            if(listitem == 2) // If he choose 3rd answer wich is: Ow ow cool
            {
                SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
            }
            SpawnPlayer(playerid);
            // After the quiz is finish,the player will be spawned.
        }
    }      
    return 1;
}
Hope you get the idea.
Reply
#8

I got the idea but still if the players logs again and again he have to answer the question. I want to make a script which have that if the user already answers the quiz he don't have to answer it again when he logs in again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)