Need help with my gamemode
#7

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER_PASSWORD:
        {
            if(response)
            {
                if(strlen(inputtext) >= 1 && strlen(inputtext) <= 20)
                {
                    SetPVarString(playerid,"TEMP_PASSWORD",inputtext);
                    ShowPlayerDialog(playerid,DIALOG_REGISTER_EMAIL,DIALOG_STYLE_INPUT,"Master Account Registration - Step Two","Email Address:\n( No more or less than 25 characters )","Finish","Cancel");
                }
                else
                {
                    ShowPlayerDialog(playerid,DIALOG_REGISTER_PASSWORD,DIALOG_STYLE_PASSWORD,"Master Account Registration - Step One","Password:\n( No more or less than 20 characters )","Continue","Cancel");
                }
            }
            else
            {
                Kick(playerid);
            }
        }
        case DIALOG_REGISTER_EMAIL:
        {
            if(response)
            {
                if(strlen(inputtext) >= 1 && strlen(inputtext) <= 30)
                {
                    SetPVarString(playerid,"TEMP_EMAIL",inputtext);
                    if(MasterAccountRegister(playerid))
                    {
                        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Master Account - Login","Account already registered, please enter your password to continue.","Login","Cancel");
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_RED, "ERROR.");
                        Kick(playerid);
                    }
                }
                else
                {
                    ShowPlayerDialog(playerid,DIALOG_REGISTER_EMAIL,DIALOG_STYLE_INPUT,"Master Account Registration - Step Two","Email Address:\n( No more or less than 25 characters )","Finish","Cancel");
                }
            }
            else
            {
                Kick(playerid);
            }
        }
        case DIALOG_LOGIN:
        {
            if(response)
            {
                MasterAccountLogin(playerid, inputtext);
            }
        }
        case DIALOG_MAIN_MENU:
        {
            if(response)
            {
                new count = PlayerCharacterCount(playerid);
                if(count == 0)
                {
                    SendClientMessage(playerid, COLOR_WHITE, "[I:] No characters available to spawn with.");
                    ShowMenuDialog(playerid);
                }
                else
                {
                    LoadCharacter(playerid, InsertPlayerUnderscoreString(GetMenuDialogCharacterOrder(playerid, listitem+1)));
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_MAIN_MENU_OPTIONS, DIALOG_STYLE_LIST, "Main Menu - Options", "Create New Character\nDelete Character\nChange Password\nDisconnect", "Continue", "Go Back");
            }
        }
        case DIALOG_MAIN_MENU_OPTIONS:
        {
            if(response)
            {
                switch(listitem)
                {
                    case 0: // Create New Character
                    {
                        if(PlayerCharacterCount(playerid) < MAX_CHARACTER_SLOTS)
                        {
                            ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CREATE_CHARACTER_NAME,DIALOG_STYLE_INPUT,"Master Account - New Character","What do you want your character to be called?\n(Firstname Lastname format).","Continue","Go Back");
                        }
                        else
                        {
                            ShowMenuDialog(playerid);
                            SendClientMessage(playerid, COLOR_RED, "[I:] You have exceeded your character limit, and cannot create anymore.");
                        }
                    }
                    case 1: // Delete Character
                    {
                        ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CHARACTER_DELETE,DIALOG_STYLE_INPUT,"Master Account - Delete Character","What is the name of the character you wish to delete?\nYou will not be able to recover it after it has been deleted!\n(Firstname Lastname format)","Delete","Go Back");
                    }
                    case 2: // Change Password
                    {
                        ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CHANGE_PASSWORD,DIALOG_STYLE_INPUT,"Master Account - Change Password","Type your new desired password:","Change","Go Back");
                    }
                    case 3: // Disconnect
                    {
                        SendClientMessage(playerid, COLOR_WHITE, "[I:] You have safely disconnected.");
                        Kick(playerid);
                    }
                }
            }
            else
            {
                ShowMenuDialog(playerid);
            }
        }
        case DIALOG_MAIN_MENU_CHARACTER_DELETE:
        {
            if(response)
            {
                if(strlen(inputtext) >= 1)
                {
                    if(CharacterExists(inputtext))
                    {
                        new escapedstring[50];
                        mysql_real_escape_string(InsertPlayerUnderscoreString(inputtext), escapedstring);
                        if(PlayerOwnsCharacter_Name(playerid, escapedstring))
                        {
                            new query[128];
                            format(query, sizeof(query), "DELETE FROM `Character` WHERE `cName` = '%s'", InsertPlayerUnderscoreString(inputtext)); //(InsertPlayerUnderscoreString(inputtext) //2464
                           
                            format(query, sizeof(query), "[I:] You have successfully deleted character: %s.", inputtext);
                            SendClientMessage(playerid, COLOR_YELLOW, query);
                            ShowMenuDialog(playerid);
                        }
                        else
                        {
                            ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CHARACTER_DELETE,DIALOG_STYLE_INPUT,"Master Account - Delete Character","What is the name of the character you wish to delete?\nYou will not be able to recover it after it has been deleted!\n(Firstname Lastname format)","Delete","Go Back");
                        }
                    }
                    else
                    {
                         ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CHARACTER_DELETE,DIALOG_STYLE_INPUT,"Master Account - Delete Character","What is the name of the character you wish to delete?\nYou will not be able to recover it after it has been deleted!\n(Firstname Lastname format)","Delete","Go Back");
                    }
                }
                else
                {
                     ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CHARACTER_DELETE,DIALOG_STYLE_INPUT,"Master Account - Delete Character","What is the name of the character you wish to delete?\nYou will not be able to recover it after it has been deleted!\n(Firstname Lastname format)","Delete","Go Back");
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_MAIN_MENU_OPTIONS, DIALOG_STYLE_LIST, "Main Menu - Options", "Create New Character\nDelete Character\nChange Password\nDisconnect", "Continue", "Go Back");
            }
        }
        case DIALOG_MAIN_MENU_CREATE_CHARACTER_NAME:
        {
            new firstname[MAX_PLAYER_NAME], lastname[MAX_PLAYER_NAME];
            if(response)
            {
                if(strlen(inputtext) >= 1 && strlen(inputtext) <= MAX_PLAYER_NAME)
                {
                    if(!CharacterExists(InsertPlayerUnderscoreString(inputtext)))
                    {
                        if(RPName(InsertPlayerUnderscoreString(inputtext), firstname, lastname))
                        {
                            SetPVarString(playerid,"TEMP_C_NAME",InsertPlayerUnderscoreString(inputtext)); //2501
                        }
                        else
                        {
                            ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CREATE_CHARACTER_NAME,DIALOG_STYLE_INPUT,"Master Account - New Character","The character name you entered is not a valid roleplay name.\n(Firstname Lastname format).","Continue","Go Back");
                        }
                    }
                    else
                    {
                        ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CREATE_CHARACTER_NAME,DIALOG_STYLE_INPUT,"Master Account - New Character","A character with that name is already registered, please choose another name.\n(Firstname Lastname format).","Continue","Go Back");
                    }
                }
                else
                {
                    ShowPlayerDialog(playerid,DIALOG_MAIN_MENU_CREATE_CHARACTER_NAME,DIALOG_STYLE_INPUT,"Master Account - New Character","What do you want your character to be called?\n(Firstname Lastname format).","Continue","Go Back");
                }
                CreateCharacter(playerid, inputtext, Character[playerid][cCash], Character[playerid][cBank], Character[playerid][cSkin]),
                GetPVarStringEx(playerid, "TEMP_C_NAME"),
               
               
                DeletePVar(playerid, "TEMP_C_NAME");
                ShowMenuDialog(playerid);
                SpawnPlayer(playerid);
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOG_MAIN_MENU, DIALOG_STYLE_LIST, "Master Account - New Character","What do you want your character to be called?\n(Firstname Lastname format).","Continue","Go Back");
            }   // Go back.
        }
    } //2540
    return 1;
}
Reply


Messages In This Thread
Need help with my gamemode - by AMouldyLemon - 28.06.2014, 06:58
Re: Need help with my gamemode - by rickisme - 28.06.2014, 08:33
Re: Need help with my gamemode - by AMouldyLemon - 28.06.2014, 08:50
Re: Need help with my gamemode - by rickisme - 28.06.2014, 09:04
Re: Need help with my gamemode - by AMouldyLemon - 28.06.2014, 09:08
Re: Need help with my gamemode - by rickisme - 28.06.2014, 09:13
Re: Need help with my gamemode - by AMouldyLemon - 28.06.2014, 09:26
Re: Need help with my gamemode - by rickisme - 28.06.2014, 09:32
Re: Need help with my gamemode - by AMouldyLemon - 28.06.2014, 09:47
Re: Need help with my gamemode - by AMouldyLemon - 28.06.2014, 13:08

Forum Jump:


Users browsing this thread: 1 Guest(s)