Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

Adding a quiz system

$
0
0
Hello SAMP.

So, i seem to be having some trouble, my brain is just completelty scrammbled at the moment, I'm trying to add a quiz style to the DayZ 9.1 script i've obviously begun putting things into place like:

Code:

#define DIALOG_QUIZ 7771
#define DIALOG_QUIZ1 7772
#define DIALOG_QUIZ2 7773
#define DIALOG_QUIZ3 7774
#define DIALOG_QUIZ4 7775

I've also declared a new variable so that if they get 3 answers wrong they will get kicked.

Code:

new QuizAnswers[MAX_PLAYERS];
The first dialog set up is:

Code:

ShowPlayerDialog(playerid,DIALOG_QUIZ,DIALOG_STYLE_LIST,"What is our Server Name??"," Rogue Nation\n Real Nation \n Rope Nation","Select","Leave Game");
And then after that there is the OnPlayerConnect callback and then OnDialogResponse

My actual problem is where to put the dialog so that it shows only on your first visit IE when registering your account, so the general idea is, Register, then your shown the menu Start your story, options, VIP ect i want it to only show when you click start your story and no other time.

Code:

function DayZSA_ShowMenuForPlayer(playerid)
{
    SelectTextDraw(playerid, 0x00FF00FF);
        PlayerTextDrawShow(playerid, MenuLogo[playerid]);
        PlayerTextDrawShow(playerid, MenuBG[playerid]);

        if(gRegistred[playerid] == 0)
        {
            PlayerTextDrawSetString(playerid, MenuPlay[playerid], "      START YOUR STORY");
        }

        PlayerTextDrawShow(playerid, MenuPlay[playerid]);
        PlayerTextDrawShow(playerid, MenuOptions[playerid]);
        PlayerTextDrawShow(playerid, MenuPremium[playerid]);
        PlayerTextDrawShow(playerid, MenuCredits[playerid]);
        PlayerTextDrawShow(playerid, MenuURL[playerid]);
        //PlayerTextDrawShow(playerid, MenuBlackLayer1[playerid]);
        //PlayerTextDrawShow(playerid, MenuBlackLayer2[playerid]);
        PlayerTextDrawShow(playerid, GeneralInfo[playerid]);


        PlayAudioStreamForPlayer(playerid, "http://rnsamp.com/dayzsa/dayzmenu.mp3");
        /*SetPlayerCameraLookAt(playerid, -1054.3846,-1157.3766,133.2800);
        SetPlayerCameraPos(playerid, -1054.3846,-1157.3766,133.2800);
        SetPlayerPos_Allow(playerid,-1037.0377,-1318.6061,143.1855);*/

        SetPlayerPos_Allow(playerid, -2820.2588,-1530.7047,144.9823);
        SetPlayerFacingAngle(playerid,299.6856);
        SetPlayerCameraPos(playerid, -2867.5381,-1556.2440,140.2921);
        SetPlayerCameraLookAt(playerid,  -2820.2588,-1530.7047,144.9823);

        defer MeowShow(playerid);

        isPlayerInMenu[playerid] = 1;
        return 1;
}

timer MeowShow[1800](playerid)
{
        SetPlayerPos_Allow(playerid, -2820.2588,-1530.7047,144.9823);
        SetPlayerFacingAngle(playerid,299.6856);
        SetPlayerCameraPos(playerid, -2867.5381,-1556.2440,140.2921);
        SetPlayerCameraLookAt(playerid,  -2820.2588,-1530.7047,144.9823);
        return 1;
}

function DayZSA_HideMenuForPlayer(playerid)
{
        StopAudioStreamForPlayer(playerid);
    CancelSelectTextDraw(playerid);
        PlayerTextDrawHide(playerid, MenuLogo[playerid]);
        PlayerTextDrawHide(playerid, MenuBG[playerid]);
        PlayerTextDrawHide(playerid, MenuPlay[playerid]);
        PlayerTextDrawHide(playerid, MenuOptions[playerid]);
        PlayerTextDrawHide(playerid, MenuPremium[playerid]);
        PlayerTextDrawHide(playerid, MenuCredits[playerid]);
        PlayerTextDrawHide(playerid, MenuURL[playerid]);
        PlayerTextDrawHide(playerid, MenuBlackLayer1[playerid]);
        PlayerTextDrawHide(playerid, MenuBlackLayer2[playerid]);
        PlayerTextDrawHide(playerid, GeneralInfo[playerid]);
        isPlayerInMenu[playerid] = 0;
        return 1;
}

timer loadingSpawn[2500](playerid)
{
    SetSpawnInfo(playerid, 0, 285, 0.0, 0.0, 0.0, 0.0, 0,0,0,0,0,0);
    TogglePlayerSpectating(playerid, 0);
    return 1;
}

public OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid)
{
        if(playertextid == MenuPlay[playerid])
    {

        GameTextForPlayer(playerid,"~w~loading...", 2500, 4);
        DayZSA_HideMenuForPlayer(playerid);
        if(pInfo[playerid][DefaultGender] == 0)
        {
            //ShowPlayerDialog(playerid, DIALOG_GENDEROPTION_2, DIALOG_STYLE_MSGBOX, "DayZ - Gender Selection", "Please, select the default gender you wish to spawn with.\n** Please note you can change this anytime via Options Menu **", "Male", "Female");
                        pInfo[playerid][DefaultGender] = 1;
                }
                  PlayerTextDrawShow(playerid, PlayerBlood[playerid]);
                PlayerTextDrawShow(playerid, PlayerThirst[playerid]);
                PlayerTextDrawShow(playerid, PlayerNoise[playerid]);
                PlayerTextDrawShow(playerid, PlayerEye[playerid]);
                PlayerTextDrawShow(playerid, playerBandit[playerid]);
                PlayerTextDrawShow(playerid, PlayerTemp[playerid]);
//                PlayerTextDrawShow(playerid, HudBG_1[playerid]);
                TextDrawShowForPlayer(playerid, DebugBox);
                PlayerTextDrawShow(playerid, DebugMonitor_Text[playerid]);
                PlayerTextDrawShow(playerid, WebsiteLogo[playerid]);
                PlayerTextDrawShow(playerid, Debug_GunInfo[playerid]);
                PlayerTextDrawShow(playerid, DebugInfo[playerid]);
                defer loadingSpawn(playerid);
    }

          else if(playertextid == MenuOptions[playerid])
    {
                ShowPlayerDialog(playerid, DIALOG_OPTIONS, DIALOG_STYLE_LIST, "DayZ - Options Menu", "Default Gender Selection\nAmbient Background", "Select", "Cancel");
    }

          else if(playertextid == MenuPremium[playerid])
    {
            SendClientMessage(playerid, -1, ""chat" Soon to be added!");
    }

          else if(playertextid == MenuCredits[playerid])
    {
                SendClientMessage(playerid, -1, ""chat" Soon to be added!");
    }

    else if(playertextid == GeneralInfo[playerid])
    {
                SendClientMessage(playerid, -1, ""chat" Soon to be added!");
        }
    return 1;
}

Any help is welcomed and needed.

Posted this in the wrong section earlier, hopefully it will get deleted.

Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>