Help please.. Need help.. + rep Wit Quiz..
#1

So the problem is it shows up when you need to login but I need it when player is registered before login it shows up and player need to answer questions.

And another question how I can save that player is answered all questions and he didn't have to do again...

On my player saving.. and loading maybe you can help me out..

Код:
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Quiz",PlayerInfo[playerid][pQuiz]);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Quiz",PlayerInfo[playerid][pQuiz]);
    INI_Close(File);
    return 1;
}
Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
        SendClientMessage(playerid, -1,"You will have to pass through a quiz"); // Added -1 color as default.
		ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
		QuizAnswers[playerid] = 0; // We set the player quiz answers to 0 when he connects.
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registering...",""COL_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    return 1;
}
Reply
#2

Please some one... It's really needed... Please Help me out.. I just want to solve it faster to go forward. I'm thinking maybe need to make switch or something... Please Help me out.. I know I bumped but please help me...
Reply
#3

https://sampforum.blast.hk/showthread.php?tid=283920

He said : So, if you have a registration/login system, add the next code after the player registers/login (or how you wish), or you can add it at one of your command, you decide when the role play quiz will start. your dialog isnt at the right place.
Reply
#4

Yeah All works but the prob is.. I need it to save in when player is done the quiz... + it shows before login and player cant login.. So how I can do it when player register first is registration and then quiz...?
Reply
#5

Remove your dialog from OnPlayerConnect, each time they will logged in the quiz will apear it must be under your /register command or under your register dialog like that:

pawn Код:
case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_BLUE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_BLUE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Money",PlayerInfo[playerid][pMoney] = 0);
                INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore] = 0);
                INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin] = 0);
                INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills] = 0);
                INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths] = 0);
                INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin] = 0);
                INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge] = 0);
                INI_WriteInt(File,"Born",PlayerInfo[playerid][pBorn] = 0);
                INI_WriteInt(File,"Month",PlayerInfo[playerid][pMonth] = 0);
                INI_WriteInt(File,"Day",PlayerInfo[playerid][pDay] = 0);
                INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank] = 0);
                INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted] = 0);
                INI_WriteInt(File,"MuteTime",PlayerInfo[playerid][pMuteTime] = 0);
                INI_Close(File);
                ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What does RP stands for?"," Real Pussy \n Role Play \n Real Money","Select","Leave Game");
                QuizAnswers[playerid] = 0; // We set the player quiz answers to 0 when he connects.

            }
        }
and then:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case 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
            {
                switch(listitem) // We switch the available answers
                {
                    case 0:// If he choose first answer, wich is: Real Pussy
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                    case 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
                    }
                    case 2:
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                }
            }
        }
        case 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
            {
                switch(listitem) // We switch the available answers
                {
                    case 0: // If he choose first answer wich is: Yes
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                    case 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
                    }
                    case 2:
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                }
            }
        }
        case 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
            {
                switch(listitem) // We switch the available answers
                {
                    case 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
                    }
                    case 1:
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                    case 2:
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers
                {
                    SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                    Kick(playerid); // He will be kicked
                }
            }
        }
        case 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
            {
                switch(listitem) // We switch the available answers
                {
                    case 0: // If he choose first answer wich is: Information Centre
                    {
                        SendClientMessage(playerid, -1,"Wrong answer!"); // He will get a message that he answered wrong
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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
                    }
                    case 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
                    }
                    case 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
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                        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(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
                {
                    SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                    Kick(playerid); // He will be kicked
                }
            }
        }
        case DIALOG_QUIZ4: // If 5 dialog shows up
        {
            if(!response) return Kick(playerid); // If he click second button he get kicked
            if(response) // If he click first button
            {
                switch(listitem) // We switch the available answers
                {
                    case 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
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                    }
                    case 1: // If he choose second answers wich is: Out of Character (correct one)
                    {
                        SendClientMessage(playerid, -1,"That's the correct answer");
                    }
                    case 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
                        QuizAnswers[playerid] += 1; // His quiz answers will be increased with 1 point.
                    }
                }
                if(QuizAnswers[playerid] >= 3) // If he reached 3 wrong answers or more
                {
                    SendClientMessage(playerid, -1,"Sorry mate, you answered 3 times wrong.Maybe another time");
                    Kick(playerid); // He will be kicked
                }
                else // If he didn't have at least 3 wrong answers
                {
                    SendClientMessage(playerid, -1,"Congratulations, you have passed the RP quiz!");
                    SpawnPlayer(playerid);
                    // After the quiz is finish,the player will be spawned, you can change here.
                }
            }
        }
    }
    return 1;
}
Edit it as you like and if you want them to spawn use SetSpawnInfo and SpawnPlayer at the last question.
Reply
#6

Thank you mate :* :* :* (No HOMO)
Reply
#7

Working ?
Reply
#8

Yeah all works grate Thanks a lot
Reply
#9

Your welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)