Issue with PutPlayerInQuiz
#1

I am having some weird issue with my script.
I made a quiz.. It should basically all work, but the thing is, it's not.

When it should poceed to the quiz with [pawn]SetTimer("PutPlayerInQuiz", 5000, 0); nothing happens.

Let me hand you the code.

pawn Код:
SetTimer("PutPlayerInQuiz", 5000, 0);
public PutPlayerInQuiz(playerid)
    {
        TogglePlayerControllable(playerid, 0);
        QuizStep[playerid] = 1;
        ClearPlayerChat(playerid);
        ShowPlayerDialog(playerid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What does MG and PG stand for?", "MadGaming & PieGaming\nMoreGaming & PopGaming\nMetagaming & Powergaming\nMyGun & PieGun", "Answer", "");
    }
And then under "OnDialogResponse"

pawn Код:
case DIALOG_QUIZ1:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What does OOC and IC stand for?", "Out of Camera & In Camera\nOut of Car & In Car\nOut of Camp & In Camp\nOut of Character & In Character", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What does OOC and IC stand for?", "Out of Camera & In Camera\nOut of Car & In Car\nOut of Camp & In Camp\nOut of Character & In Character", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            ca
Reply
#2

You need to use SetTimerEx() of course and provide a playerid another issue is what happens if the player logs off and other logs in then the timer will call that function even though that player did not want to participate in the quiz. You need to save the timer id and kill the timer when that player logs off to make sure that it doesn't happen.
Reply
#3

https://sampwiki.blast.hk/wiki/SetTimer
https://sampwiki.blast.hk/wiki/SetTimerEx

SetTimer does NOT have parameters and SetTimerEx does. The public function uses playerid as parameter and it was created with SetTimer which won't work.
Reply
#4

Thanks a lot guys, let's see if this works.
Reply
#5

Still not working, it's the exact same thing. Can someone help me out on teamviewer maybe?
Reply
#6

I had this problem when the timer freeze someone.. New timer with new timername; and then use timername = SetTimerEx(params) .. It will work 100%
Reply
#7

The weird thing is, I put: "ClearPlayerChat(playerid); and that works.. It's just the dialog that won't show up
Reply
#8

You have to use SetTimerEx like this;

pawn Код:
SetTimerEx("PutPlayerInQuiz", 5000, false,"i",playerid);
Reply
#9

It did not fix anything. There is a problem with the dialog...

If you see anything that's wrong, please tell me.. It's not showing up. The message is indeed, but the dialogs are not.

pawn Код:
case DIALOG_QUIZ1:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 3)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What does OOC and IC stand for?", "Out of Camera & In Camera\nOut of Car & In Car\nOut of Camp & In Camp\nOut of Character & In Character", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ2, DIALOG_STYLE_LIST, "What does OOC and IC stand for?", "Out of Camera & In Camera\nOut of Car & In Car\nOut of Camp & In Camp\nOut of Character & In Character", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ2:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 4)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "What does RP stand for?", "Role Play\nRed Play\nRambo Play\nRegina Roleplay", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ3, DIALOG_STYLE_LIST, "What does RP stand for?", "Role Play\nRed Play\nRambo Play\nRegina Roleplay", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ3:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST, "What is the correct purpose of /report?", "Reporting rulebreakers\nAsking admins a question\nAsking the time\nAsking a script related question", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ4, DIALOG_STYLE_LIST, "What is the correct purpose of /report?", "Reporting rulebreakers\nAsking admins a question\nAsking the time\nAsking a script related question", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ4:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "What is the correct use of /ad?", "Selling my gun $4000\nSelling my 1982 Regina for $13000", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ5, DIALOG_STYLE_LIST, "What is the correct use of /ad?", "'Selling my gun $4000'\nSelling my 1982 Regina for $13000", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ5:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 2)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ6, DIALOG_STYLE_LIST, "A roadblock has closed the road. How do you react?", "Re-route\nBarge through\nMoan and kill everyone then /q\n/report them for blocking the road", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ6, DIALOG_STYLE_LIST, "What is the correct use of /ad?", "'Selling my gun $4000'\nSelling my 1982 Regina for $13000", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ6:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 1)
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ7, DIALOG_STYLE_LIST, "What one of these rules are not official?", "You may not DM\nYou may kill the enemy that just killed you\nYou may not slander to admins", "Answer", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ7, DIALOG_STYLE_LIST, "What one of these rules are not official?", "You may not DM\nYou may kill the enemy that just killed you\nYou may not slander to admins", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
            case DIALOG_QUIZ7:
            {
                if(!response) return Kick(playerid);
                if(response)
                {  
                    if(listitem == 2)
                    {
                        new string[128];
                        format(string, sizeof(string), "You have now completed the quiz.\n\nYou will now be moved on to the tutorial process.\n\nYou scored %d/7", AnswersRight[playerid]);
                        ShowPlayerDialog(playerid, 99281, DIALOG_STYLE_MSGBOX, "You have completed the quiz", string, "Continue", "");
                    }
                    else
                    {
                        ShowPlayerDialog(playerid, DIALOG_QUIZ7, DIALOG_STYLE_LIST, "What one of these rules are not official?", "You may not DM\nYou may kill the enemy that just killed you\nYou may not slander to admins", "Answer", "");
                        AnswersRight[playerid] --;
                    }
                    if(AnswersRight[playerid] < 4)
                    {
                        KickWithMessage(playerid, RED, "You were kicked as you did not score enough points to pass the quiz.");
                    }
                }
            }
pawn Код:
ShowPlayerDialog(playerid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What does MG and PG stand for?", "MadGaming & Your mother\nMoreGaming & PopGaming\nMetagaming & Powergaming\nMyGun & PieGun", "Answer", "");
Reply
#10

Can someone help me on teamviewer?
Skype: emil.lykke
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)