Another "OnDialogResponse" problem.. again
#4

You missed few brackets and I switched the dialogid because I didn't want to confuse you.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_FOOD1:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0:
                    {
                        GameTextForPlayer(playerid, "Pizza chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 99);
                        SendClientMessage(playerid, COLOR_ORANGE, "Health re-generated!");
                    }
                    case 1:
                    {
                        GameTextForPlayer(playerid, "Hamburger chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 99);
                        SendClientMessage(playerid, COLOR_ORANGE, "Health re-generated!");
                    }
                    case 2:
                    {
                        GameTextForPlayer(playerid, "Fish chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 87);
                        SendClientMessage(playerid, COLOR_RED, "The fish wasn't that good..");
                    }
                    case 3:
                    {
                        GameTextForPlayer(playerid, "Salad chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 120);
                        SendClientMessage(playerid, COLOR_ORANGE, "Healthy food made you healthier :]");
                    }
                    case 4:
                    {
                        GameTextForPlayer(playerid, "Kebab chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 95);
                        SendClientMessage(playerid, COLOR_ORANGE, "Not really the best kebab..");
                    }
                    case 5:
                    {
                        GameTextForPlayer(playerid, "Ice-Cream chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 91);
                        SendClientMessage(playerid, COLOR_BLUE, "Brain-freeze..");
                    }
                    case 6:
                    {
                        GameTextForPlayer(playerid, "Cookies chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 99);
                        SendClientMessage(playerid, COLOR_ORANGE, "COOKIE MONSTAR");
                    }
                    case 7:
                    {
                        GameTextForPlayer(playerid, "Spaghetti chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 91);
                        SendClientMessage(playerid, COLOR_ORANGE, "You should wash your mouth now..");
                    }
                    case 8:
                    {
                        GameTextForPlayer(playerid, "Indian Paratha chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 91);
                        SendClientMessage(playerid, COLOR_ORANGE, "Good good");
                    }
                    case 9:
                    {
                        GameTextForPlayer(playerid, "Indian Dosai chosen!", 3500, 1);
                        SetPlayerHealth(playerid, 95);
                        SendClientMessage(playerid, COLOR_ORANGE, "Well, not bad..");
                    }
                }
            }
        }
        case DIALOG_REGISTER:
        {
            if (!response) Kick(playerid);
            else
            {
                if(!strlen(inputtext)) ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Registration","You have entered an invalid password.\nType your password below to register a new account.","Register","Quit");
                else
                {
                    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,"Kills",0);
                    INI_WriteInt(File,"Deaths",0);
                    INI_WriteInt(File,"Score",0);
                    INI_WriteInt(File,"Muted",0);
                    INI_Close(File);
                   
                    SpawnPlayer(playerid);
                }
            }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) Kick ( playerid );
            else
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","You have successfully logged in!","Ok","");
                }
                else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
            }
        }
        case DIALOG_RULES:
        {
            if( response )
            {
                new name[MAX_PLAYER_NAME];
                new string[128];
                GetPlayerName(playerid, name, sizeof(name));
                SendClientMessage(playerid, COLOR_GREEN, "[RULES] - Since you've read and hopefully understood the rules, admins will be able to take actions against you!");
                SendClientMessage(playerid, COLOR_GREEN, "[RULES] - If you will constantly breaking rules, you may end up getting banned!");
                SendClientMessage(playerid, COLOR_GREEN, "[RULES] - Now, if you have any questions, use /helpme or /pm an admin.");//checkpoint3
                format(string, sizeof(string), "[RULES] - %s has read the rules, you may award him, and/or make sure that he follows them", name);
                SendMessageToAdmins(string);
            }
        }
        case DIALOG_CREDITS:
        {
            if( response ) SendClientMessage(playerid, COLOR_GREEN,"[CREDITS] - In-case you have any questions/suggestions, you can add Kyance on skype - patriksfr");
        }
        case DIALOG_TUNING:
        {
            if( response )
            {
                switch(listitem)
                {
                    case 0:
                    {
                        SetPlayerPos(playerid, -2688.6833,199.3060,6.6250);
                        new name[MAX_PLAYER_NAME];
                        new string[94];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(string, sizeof(string), "[TELEPORT] - %s[%d] has teleported to WAA!(Wheel Arch Angels)", name, playerid);
                        SendClientMessageToAll(COLOR_GREEN, string);
                    }
                    case 1:
                    {
                        SetPlayerPos(playerid, 2637.1890,-2011.6135,13.8139);
                        new name[MAX_PLAYER_NAME];
                        new string[94];
                        GetPlayerName(playerid, name, sizeof(name));
                        format(string, sizeof(string), "[TELEPORT] - %s[%d] has teleported to the Low-Rider car tuning!", name, playerid);
                        SendClientMessageToAll(COLOR_GREEN, string);
                    }
                }
            }
        }
        case DIALOG_VEHICLES:
        {
            if( response )
            {
                switch(listitem)
                {
                    case 0: ShowModelSelectionMenu(playerid, bikelist , "Bikes");
                    case 1: ShowModelSelectionMenu(playerid, boatlist, "Boats");
                    case 2: ShowModelSelectionMenu(playerid, convertibleslist, "Converibles");
                    case 3: ShowModelSelectionMenu(playerid, helicopterlist, "Helicopters");
                    case 4: ShowModelSelectionMenu(playerid, industriallist, "Industrial Vehicles");
                    case 5: ShowModelSelectionMenu(playerid, lowriderlist, "Low-Riders");
                    case 6: ShowModelSelectionMenu(playerid, offroadlist, "Off-road Vehicles");
                    case 7: ShowModelSelectionMenu(playerid, planelist, "Planes");
                    case 8: ShowModelSelectionMenu(playerid, publicservicelist, "Public Services");
                    case 9: ShowModelSelectionMenu(playerid, saloonlist, "Saloons");
                    case 10: ShowModelSelectionMenu(playerid, stationwagonlist, "Station Wagons");
                    case 11: ShowModelSelectionMenu(playerid, sportvehiclelist, "Sport Vehicles");
                    case 12: ShowModelSelectionMenu(playerid, trailerlist, "Trailers");
                    case 13: ShowModelSelectionMenu(playerid, uniquevehiclelist, "Unique Vehicles");
                }
            }
        }
    }
    return 1;
}
You may need to return 0 at the end like OnPlayerCommandText to force it search for that dialogid in other scripts in case it doesn't find it on it.
Reply


Messages In This Thread
Another "OnDialogResponse" problem.. again - by Kyance - 25.11.2013, 15:08
Re: Another "OnDialogResponse" problem.. again - by Konstantinos - 25.11.2013, 15:17
Re: Another "OnDialogResponse" problem.. again - by Kyance - 25.11.2013, 15:27
Re: Another "OnDialogResponse" problem.. again - by Konstantinos - 25.11.2013, 16:04
Re: Another "OnDialogResponse" problem.. again - by Kyance - 25.11.2013, 16:49

Forum Jump:


Users browsing this thread: 1 Guest(s)