Implementing 24/7 shop Dialog Error
#10

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_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,"Level",1);
                INI_WriteInt(File,"Cash", 10000);
                GivePlayerMoney(playerid, 10000);
                INI_WriteInt(File,"Sex",0);
                INI_WriteInt(File,"Age",0);
                INI_WriteInt(File,"Skin",0);
                INI_WriteInt(File,"Leader",0);
                INI_WriteInt(File,"Rank",0);
                INI_WriteInt(File,"Team",0);
                INI_WriteInt(File,"Member",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"VIP",0);
                INI_WriteInt(File,"Muted",0);
                INI_WriteInt(File,"Tutorial",0);
                INI_WriteInt(File,"Mute Time",0);
                INI_WriteInt(File,"Banned",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                new sex[] = " Male \n Female ";
                ShowPlayerDialog(playerid, DIALOG_SEX, DIALOG_STYLE_LIST, "Please selecet your Gender", sex, "Select","Quit Game");
            }
        }
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,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
                }
                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;
            }
        }
case DIALOG_SEX:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if (listitem == 0)
                {
                    PlayerInfo[playerid][pSex] = 1;
                    SendClientMessage(playerid, COLOR_YELLOW2,"So you are Male");
                    ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Social Security Office:Age","Hi, Welcome to Los Santos. I just need to you fill out a few forms for me to Process your Citizenship. How old are you?","Submit","Cancel");
                }
                else if (listitem == 1)
                {
                    PlayerInfo[playerid][pSex] = 2;
                    PlayerInfo[playerid][pSkin] = 12;
                    SetPlayerSkin(playerid, 12);
                    SendClientMessage(playerid, COLOR_YELLOW2,"So you are Female");
                    ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Social Security Office:Age","Hi, Welcome to Los Santos. I just need to you fill out a few forms for me to Process your Citizenship. How old are you?","Submit","Cancel");
                }
                else
                {
                    Kick(playerid);
                }
            }
        }
case DIALOG_AGE:
    {
        if(response)
        {
            PlayerInfo[playerid][pAge] = strval(inputtext);
            new string[64];
            format(string, sizeof(string),"So you are %s years old", inputtext);
            SendClientMessage(playerid, COLOR_YELLOW2, string);
            if(strval(inputtext) <= 15)
            {
                    SendClientMessage(playerid, COLOR_WHITE, "SERVER: This is a 16+ Only Server, Grow up and Come Back.");
                    Kick(playerid);
                    return 1;
            }
            if(strval(inputtext) >= 101)
            {
                    SendClientMessage(playerid, COLOR_WHITE, "George: Im sorry our records indicate thats not valid");
                    ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Social Security Office:Age","How Old did you say you were again?","Submit","Cancel");
                    return 1;
            }
            SetSpawnInfo(playerid, 0, 0, 1481.0886, -1756.8551, 17.5313, 359.6866, 0, 0, 0, 0, 0, 0);
            SpawnPlayer(playerid);
        }
        else
        {
            Kick(playerid);
        }
    }
case DIALOG_STORE:
    {
        if( !response ) return 0;
        if( response )
        {
            switch( listitem )
            {
                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);
                }
            }
        }
    }
    // Next dialogs
    return 1;
}
Reply


Messages In This Thread
Implementing 24/7 shop Dialog Error - by SantarioLeone - 15.10.2011, 13:42
AW: Implementing 24/7 shop Dialog Error - by Drebin - 15.10.2011, 13:51
Re: Implementing 24/7 shop Dialog Error - by SantarioLeone - 15.10.2011, 13:56
Re: Implementing 24/7 shop Dialog Error - by SmiT - 15.10.2011, 14:02
AW: Implementing 24/7 shop Dialog Error - by Drebin - 15.10.2011, 14:02
Re: Implementing 24/7 shop Dialog Error - by SantarioLeone - 15.10.2011, 14:11
Re: Implementing 24/7 shop Dialog Error - by SmiT - 15.10.2011, 14:20
Re: Implementing 24/7 shop Dialog Error - by SantarioLeone - 15.10.2011, 14:28
Re: Implementing 24/7 shop Dialog Error - by SmiT - 15.10.2011, 14:29
Re: Implementing 24/7 shop Dialog Error - by SantarioLeone - 15.10.2011, 14:30

Forum Jump:


Users browsing this thread: 1 Guest(s)