Problem with dialog box in dmv system
#1

I want to create a DMV system but the dialog boxes of DMV was intercalated with register dialog boxes

I want to know how to fix this?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"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,"Cash",1500);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"pCarLic",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0,1017.1094,-1345.6660,13.2545, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! You're now registred, do you want to see a tutorial? (/tutorial)","Alright","");
			}
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetSpawnInfo(playerid, 0, 0,1017.1094,-1345.6660,13.2545, 269.15, 0, 0, 0, 0, 0, 0);
                	SpawnPlayer(playerid);
					
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    if(dialogid == 1)
	{
		if(response)
		{
			ShowPlayerDialog(playerid,2,DIALOG_STYLE_MSGBOX,"Intrebarea numarul 1.","{77A3F0}Pe care parte trebe sa conduci mereu?","Dreapta", "Stanga");
			return 1;
		}
		SCM(playerid, COLOR_CRS3, "** Testul sa oprit pentru ca ai apasat pe iesire.");
		DMVTest[playerid] = 0;
		return 1;
	}
    if(dialogid == 2)
	{
		if(response)
		{
            ShowPlayerDialog(playerid,3,DIALOG_STYLE_MSGBOX,"Intrebarea numarul 2.","{F9F7CE}Bravo la prima intrebare ai raspuns corect.\n\n{77A3F0}Pe care parte conduci atunci cand pe partea dreapta nu se poate circula?","Dreapta", "Stanga");
			return 1;
	    }
        SCM(playerid, COLOR_CRS3, "** Imi pare rau, dar ai raspuns gresit la aceasta intrebare.");
		DMVTest[playerid] = 0;
		return 1;
	}
    if(dialogid == 3)
	{
		if(response)
		{
            ShowPlayerDialog(playerid,4,DIALOG_STYLE_MSGBOX,"Intrebarea numarul 3.","{F9F7CE}Bravo si la a doua intrebare ai raspuns corect.\n\n{77A3F0}Trebuie sa opresc masina cand imi cere un politist?","Da", "Nu");
            return 1;
        }
        SCM(playerid, COLOR_CRS3, "** Imi pare rau, dar ai raspuns gresit la aceasta intrebare.");
		DMVTest[playerid] = 0;
		return 1;
    }
    if(dialogid == 4)
	{
		if(response)
		{
            ShowPlayerDialog(playerid,5,DIALOG_STYLE_MSGBOX,"\t","{F9F7CE}Bravo si la a treia intrebare ai raspuns corect.","Urmatoarea", "");
            return 1;
        }
        SCM(playerid, COLOR_CRS3, "** Imi pare rau, dar ai raspuns gresit la aceasta intrebare.");
		DMVTest[playerid] = 0;
		return 1;
	}
    if(dialogid == 5)
	{
		if(response)
		{
            ShowPlayerDialog(playerid,6,DIALOG_STYLE_LIST,"{77A3F0}4.Ce fac daca imi fura cineva masina?","{77A3F0}Sun la politie,\n{77A3F0}Il omor pe hot,\n{77A3F0}Fug dupa el.","Urmatorul","");
            return 1;
        }
    }
    if(dialogid == 6)
	{
		if(response)
		{
		    if(listitem == 0)
	        {
	            ShowPlayerDialog(playerid,7,DIALOG_STYLE_MSGBOX,"\t","{F9F7CE}Bravo ai raspuns corect la toate intrebarile.\nPentru a continua apasa pe 'Urmatorul'.","Urmatorul", "Iesire");
			}
			if(listitem == 1)
	        {
	            SCM(playerid, COLOR_CRS3, "** Imi pare rau, dar ai raspuns gresit la aceasta intrebare.");
		        DMVTest[playerid] = 0;
			}
			if(listitem == 2)
			{
                SCM(playerid, COLOR_CRS3, "** Imi pare rau, dar ai raspuns gresit la aceasta intrebare.");
		        DMVTest[playerid] = 0;
		    }
		}
	}
    if(dialogid == 7)
	{
		if(response)
		{
			SCM(playerid, COLOR_CRS3, "** Acum dute la masina pentru a urma checkpointurile.");
			SetCameraBehindPlayer(playerid);
			SetPlayerPos(playerid, 987.8069,-1349.1521,13.5786);
			SetPlayerVirtualWorld(playerid, 0);
			DMVTest[playerid] = 1;
			return 1;
		}
		SCM(playerid, COLOR_CRS3, "** Testul sa oprit pentru ca ai apasat pe iesire.");
		DMVTest[playerid] = 0;
		return 1;
	}
    return 1;
}
PS: I'm newby in samp scripts, and sorry for my bad English.

EDITED:PUT CODE IN [code] tags . // Sorry
Reply
#2

Please put it in code form, hard to track the error
Reply
#3

check your define value in DIALOG_REGISTER and DIALOG_LOGIN, maybe its id same other dialog.
Reply
#4

you right, i now see

Код:
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define DIALOG_SUCCESS_1 3
#define DIALOG_SUCCESS_2 4
And other ask, why when i'm exit my money was reset?

Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"pCarLic",PlayerInfo[playerid][pCarLic]);
    INI_Close(File);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)