How to make this work?
#1

I defined the quiz Dialogs

Код:
#define DIALOG_QUIZ 5
#define DIALOG_QUIZ_1 6
My OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_WHITE"Type your password below to login.","Login","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Registering...",""COLOR_WHITE"Type your password below to register a new account.","Register","Quit");
    }
    if(fexist(UserPath(playerid)))
    {
        ShowPlayerDialog(playerid, DIALOG_QUIZ, DIALOG_STYLE_LIST, "What is RP?", "Roleplay\nRevenge Player\nI dont know", "Continue", "Exit");
    }
    return 1;
}
and this is my OnDialogResponse
Код:
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_PASSWORD, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_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",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"Congratulations, you have successfully made an account!\nYou will now go through a Quiz to test you RP skills!","Ok","");
            }
        }
        
        case DIALOG_QUIZ:
        {
            if(!response) return Kick ( playerid );
            if(response)
            {
                case 0:
					SendClientMessage(playerid, COLOR_RED, "You have successfully entered the correct answer!");
					ShowPlayerDialog(playerid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What is the correct /me", "/me GIMME YOUR MONEY\n/me attempts to punch John\n/me BRB NEWB", "Continue" ,"Cancel");
				}
				case 1:
				    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
				    Kick(playerid);
				    return 0;
				}
				case 2:
				    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
				    Kick(playerid);
				    return 0;
				}
			}
		}
				
        case DIALOG_QUIZ_1:
        {
			if(!response) return Kick ( playerid );
			if(response)
			{
			    case 0:
			        SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
			        Kick(playerid);
			        return 0;
				}
				case 1:
			        SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
			        Kick(playerid);
			        return 0;
				}
				case 2:
				    SendClientMessage(playerid, COLOR_WHITE, "You have entered the correct Answer!");
				}
			}
		}
        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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
I want the quiz to display after they have entered there password.

Errors:
Код:
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 014: invalid statement; not in switch
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : warning 215: expression has no effect
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 001: expected token: ";", but found ":"
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

pawn Код:
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_PASSWORD, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_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",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"Congratulations, you have successfully made an account!\nYou will now go through a Quiz to test you RP skills!","Ok","");
            }
        }

        case DIALOG_QUIZ:
        {
            if(!response) return Kick ( playerid );
            if(response)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have successfully entered the correct answer!");
                    ShowPlayerDialog(playerid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What is the correct /me", "/me GIMME YOUR MONEY\n* ViniBorn attempts to punch John\n* ViniBorn BRB NEWB", "Continue" ,"Cancel");
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 2:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
            }
        }

        case DIALOG_QUIZ_1:
        {
            if(!response) return Kick ( playerid );
            if(response)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 2:
                    SendClientMessage(playerid, COLOR_WHITE, "You have entered the correct Answer!");
            }
        }
        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]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply
#3

Код:
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 014: invalid statement; not in switch
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : warning 215: expression has no effect
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 001: expected token: ";", but found ":"
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(289) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

pawn Код:
//Making dialog
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)// They pressed the first button.
    {
    switch(dialogid)// If you only have one dialog, then this isn't required, but it's neater for when you implement more dialogs.
        {
        case 1:// Our dialog!
            {
            switch(listitem)// Checking which listitem was selected
            {
                case 0:// The first item listed
                {
                    if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -1);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_SPRUNK);
                }
                case 1: // The second item listed
                {
                    if(GetPlayerMoney(playerid) < 2) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -2);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_BEER);
                }
                case 2: // The third item listed
                {
                    if(GetPlayerMoney(playerid) < 3) return SendClientMessage(playerid, 0xFFFFFF, "You don't have enough cash.");
                    GivePlayerMoney(playerid, -3);
                    SetPlayerSpecialAction(playerid, SPECIAL_ACTION_DRINK_WINE);
                }
            }
            }
    }
    }
    return 1;
}
you missed switch(listitem)
Reply
#5

pawn Код:
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_PASSWORD, "Registering...","You have entered an invalid password.\nType 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",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);

                SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Congratulations, you have successfully made an account!\nYou will now go through a Quiz to test you RP skills!","Ok","");
            }
        }

        case DIALOG_QUIZ:
        {
            if(!response) return Kick ( playerid );
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have successfully entered the correct answer!");
                    ShowPlayerDialog(playerid, DIALOG_QUIZ1, DIALOG_STYLE_LIST, "What is the correct /me", "/me GIMME YOUR MONEY\n* ViniBorn attempts to punch John\n* ViniBorn BRB NEWB", "Continue" ,"Cancel");
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 2:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
            }
        }

        case DIALOG_QUIZ_1:
        {
            if(!response) return Kick ( playerid );
            switch(listitem)
            {
                case 0:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 1:
                {
                    SendClientMessage(playerid, COLOR_RED, "You have entered the wrong answer!");
                    Kick(playerid);
                    return 0;
                }
                case 2:
                    SendClientMessage(playerid, COLOR_WHITE, "You have entered the correct Answer!");
            }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            switch(listitem)
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COLOR_WHITE"Login",""COLOR_RED"You have entered an incorrect password.\n"COLOR_WHITE"Type your password below to login.","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: