Tryin to make a quiz work
#1

Hello,
I want to know how to make a quiz when the player has logged in..
This is the 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 the dialog:
Код:
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_QUIZ1:
        {
			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!");
				}
			}
		}
But these are the error's I'm getting...
Код:
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 Код:
if(response)
{
    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* MadeMan attempts to punch John\n* MadeMan 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;
        }
    }
}
Reply
#3

I get more errors :/
Код:
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(293) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(298) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(304) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : warning 217: loose indentation
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 014: invalid statement; not in switch
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : warning 215: expression has no effect
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 001: expected token: ";", but found ":"
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : fatal error 107: too many error messages on one line

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


7 Errors.
Reply
#4

Quote:
Originally Posted by HarrySidwell
Посмотреть сообщение
I get more errors :/
Код:
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(293) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(298) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(304) : error 035: argument type mismatch (argument 2)
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : warning 217: loose indentation
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 014: invalid statement; not in switch
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : warning 215: expression has no effect
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 001: expected token: ";", but found ":"
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : error 029: invalid expression, assumed zero
C:\Users\Jordan\Desktop\0.3e Server\gamemodes\Gamemode.pwn(310) : fatal error 107: too many error messages on one line

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


7 Errors.
Show these lines.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)