problem with dialog
#3

There is the register,gender,age dialog, playerid 0 is really fast while registering but the other id's it takes time i dont know why.. i dont think it due to the code




pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                new name[MAX_PLAYER_NAME],str[124];
                GetPlayerName(playerid,name,sizeof(name));
                format(str,sizeof(str),"{FFFFFF}You may register this username by entering your desired password below.\n\n{FFA500}Username: {FFFFFF}%s\n\n{FFA500}Choose a Password:",name);
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Registration",str,"Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Money",PlayerInfo[playerid][pMoney] = 0);
                INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore] = 0);
                INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin] = 0);
                INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills] = 0);
                INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths] = 0);
                INI_WriteInt(File,"Skin",PlayerInfo[playerid][pSkin] = 299);
                INI_WriteInt(File,"Bank",PlayerInfo[playerid][pBank] = 0);
                INI_WriteInt(File,"Job",PlayerInfo[playerid][pJob] = 0);
                INI_WriteInt(File,"Health",PlayerInfo[playerid][pJob] = 0);
                INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted] = 0);
                INI_WriteInt(File,"MuteTime",PlayerInfo[playerid][pMuteTime] = 0);
                INI_WriteInt(File,"Hour",PlayerInfo[playerid][pHour] = 0);
                INI_WriteInt(File,"Minute",PlayerInfo[playerid][pMin] = 0);
                INI_WriteInt(File,"Second",PlayerInfo[playerid][pSec] = 0);
                INI_WriteInt(File,"VirtualWorld",PlayerInfo[playerid][pVw] = 0);
                INI_WriteInt(File,"Interior",PlayerInfo[playerid][pInt] = 0);
                INI_WriteInt(File,"Age",PlayerInfo[playerid][pAge] = 0);
                INI_WriteInt(File,"Faction",PlayerInfo[playerid][pFaction] = 0);
                INI_WriteInt(File,"Phone",PlayerInfo[playerid][pPhone] = 0);
                INI_WriteInt(File,"Helper",PlayerInfo[playerid][pHelper] = 0);
                INI_WriteInt(File,"PhoneNumber",PlayerInfo[playerid][pNumber] = 0);
                INI_WriteInt(File,"PhoneBook",PlayerInfo[playerid][ppBook] = 0);
                INI_WriteInt(File,"TotalWealth",PlayerInfo[playerid][pWealth] = 0);
                INI_WriteInt(File,"House",PlayerInfo[playerid][pHouse] = 0);
                INI_WriteFloat(File,"Health",Health[playerid] = 100);
                INI_WriteFloat(File,"Armour",Armour[playerid] = 0);
                INI_Close(File);
                ShowPlayerDialog(playerid,DIALOG_GENDER,DIALOG_STYLE_MSGBOX,"{FFA500}Downtown Roleplay - Registration","{FFFFFF}What do you want your character's gender to be?","Male","Female");
            }
        }
        case DIALOG_GENDER:
        {
            if(response)
            {
                PlayerInfo[playerid][pGender] = 0;
                ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"{FFA500}Downtown Roleplay - Registration","{FFFFFF}What do you want your character's age to be?\n\nNote: The age must be no lower than 18 and no higher than 90.","Done","");
            }
            else
            {
                PlayerInfo[playerid][pGender] = 1;
                ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"{FFA500}Downtown Roleplay - Registration","{FFFFFF}What do you want your character's age to be?\n\nNote: The age must be no lower than 18 and no higher than 90.","Done","");
            }
        }
        case DIALOG_AGE:
        {
            if(response)
            {
                new msg[254], msg2[254];
                format(msg,sizeof(msg),"{FFFFFF}ENTRY DECLINED: The age can only be from 18 to 90!\n\nWhat do you want your character's age to be?\n\nNote: The age must be no lower than 18 and no higher than 90.");
                format(msg2,sizeof(msg2),"{FFFFFF}ENTRY DECLINED: You must enter a number!\n\nWhat do you want your character's age to be?\n\nNote: The age must be no lower than 18 and no higher than 90.");
                if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"{FFA500}Downtown Roleplay - Registration",msg2,"Done","");
                else if(strval(inputtext) < 18) return ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"{FFA500}Downtown Roleplay - Registration",msg,"Done","");
                else if(strval(inputtext) > 90) return ShowPlayerDialog(playerid,DIALOG_AGE,DIALOG_STYLE_INPUT,"{FFA500}Downtown Roleplay - Registration",msg,"Done","");
                else
                {
                    SetSpawnInfo(playerid,0,PlayerInfo[playerid][pSkin],1770.7408,-1941.1985,13.5678,325.1382,0,0,0,0,0,0);
                    SpawnPlayer(playerid);
                    PlayerInfo[playerid][pAge] = strval(inputtext);
                    TextDrawHideForPlayer(playerid, Textdraw0);
                    TextDrawHideForPlayer(playerid, Textdraw1);
                    TextDrawHideForPlayer(playerid, Textdraw2);
                    TextDrawHideForPlayer(playerid, Textdraw3);
                    TextDrawHideForPlayer(playerid, Textdraw4);
                    TextDrawHideForPlayer(playerid, Textdraw5);
                    TextDrawHideForPlayer(playerid, Textdraw6);
                    TextDrawHideForPlayer(playerid, Textdraw7);
                    TextDrawHideForPlayer(playerid, Textdraw8);
                    TextDrawHideForPlayer(playerid, Textdraw9);
                    TextDrawHideForPlayer(playerid, Textdraw10);
                    TextDrawHideForPlayer(playerid, Textdraw11);
                }
            }
        }
        case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    INI_ParseFile(UserPath(playerid), "LoadUsers_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]);
                    SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
                    SetPlayerSkin(playerid,PlayerInfo[playerid][pSkin]);
                    SetPlayerHealth(playerid,Health[playerid]);
                    SetPlayerArmour(playerid,Armour[playerid]);
                    for(new i = 0; i < sizeof(HouseInfo); i++)
                    {
                        GetPlayerName(playerid, plname, sizeof(plname));
                        if(strcmp(HouseInfo[i][hOwner], plname, false ) == 0 && HouseInfo[i][hSpawn] == 1 && PlayerInfo[playerid][pHouse] == 1)
                        {
                            SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], HouseInfo[i][hEnterX],HouseInfo[i][hEnterY],HouseInfo[i][hEnterZ],0, 0, 0, 0, 0, 0, 0);
                            SpawnPlayer(playerid);
                            SetPlayerVirtualWorld(playerid,0);
                            SetPlayerInterior(playerid,0);
                            SetPlayerColor(playerid, COLOR_LIGHTBLUE);
                            IncorrectPassword[playerid] = 0;
                            TextDrawHideForPlayer(playerid, Textdraw0);
                            TextDrawHideForPlayer(playerid, Textdraw1);
                            TextDrawHideForPlayer(playerid, Textdraw2);
                            TextDrawHideForPlayer(playerid, Textdraw3);
                            TextDrawHideForPlayer(playerid, Textdraw4);
                            TextDrawHideForPlayer(playerid, Textdraw5);
                            TextDrawHideForPlayer(playerid, Textdraw6);
                            TextDrawHideForPlayer(playerid, Textdraw7);
                            TextDrawHideForPlayer(playerid, Textdraw8);
                            TextDrawHideForPlayer(playerid, Textdraw9);
                            TextDrawHideForPlayer(playerid, Textdraw10);
                            TextDrawHideForPlayer(playerid, Textdraw11);
                            new string[80 + MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
                            GetPlayerName(playerid,pname,sizeof(pname));
                            strreplace(pname,'_',' ');
                            format(string,sizeof(string),"Welcome to Downtown Roleplay, %s.",pname);
                            SendClientMessage(playerid,COLOR_ORANGE,string);
                            return 1;
                        }
                        else if(strcmp(HouseInfo[i][hOwner], plname, false ) == 0 && HouseInfo[i][hSpawn] == 0 && PlayerInfo[playerid][pHouse] == 1)
                        {
                            SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid], 0, 0, 0, 0, 0, 0);
                            SpawnPlayer(playerid);
                            SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVw]);
                            SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
                            SetPlayerColor(playerid, COLOR_LIGHTBLUE);
                            IncorrectPassword[playerid] = 0;
                            TextDrawHideForPlayer(playerid, Textdraw0);
                            TextDrawHideForPlayer(playerid, Textdraw1);
                            TextDrawHideForPlayer(playerid, Textdraw2);
                            TextDrawHideForPlayer(playerid, Textdraw3);
                            TextDrawHideForPlayer(playerid, Textdraw4);
                            TextDrawHideForPlayer(playerid, Textdraw5);
                            TextDrawHideForPlayer(playerid, Textdraw6);
                            TextDrawHideForPlayer(playerid, Textdraw7);
                            TextDrawHideForPlayer(playerid, Textdraw8);
                            TextDrawHideForPlayer(playerid, Textdraw9);
                            TextDrawHideForPlayer(playerid, Textdraw10);
                            TextDrawHideForPlayer(playerid, Textdraw11);
                            new string[80 + MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
                            GetPlayerName(playerid,pname,sizeof(pname));
                            strreplace(pname,'_',' ');
                            format(string,sizeof(string),"Welcome to Downtown Roleplay, %s.",pname);
                            SendClientMessage(playerid,COLOR_ORANGE,string);
                            return 1;
                        }
                        else if(PlayerInfo[playerid][pHouse] == 0)
                        {
                            SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin],PosX[playerid],PosY[playerid],PosZ[playerid],Angle[playerid], 0, 0, 0, 0, 0, 0);
                            SpawnPlayer(playerid);
                            SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][pVw]);
                            SetPlayerInterior(playerid,PlayerInfo[playerid][pInt]);
                            SetPlayerColor(playerid, COLOR_LIGHTBLUE);
                            IncorrectPassword[playerid] = 0;
                            TextDrawHideForPlayer(playerid, Textdraw0);
                            TextDrawHideForPlayer(playerid, Textdraw1);
                            TextDrawHideForPlayer(playerid, Textdraw2);
                            TextDrawHideForPlayer(playerid, Textdraw3);
                            TextDrawHideForPlayer(playerid, Textdraw4);
                            TextDrawHideForPlayer(playerid, Textdraw5);
                            TextDrawHideForPlayer(playerid, Textdraw6);
                            TextDrawHideForPlayer(playerid, Textdraw7);
                            TextDrawHideForPlayer(playerid, Textdraw8);
                            TextDrawHideForPlayer(playerid, Textdraw9);
                            TextDrawHideForPlayer(playerid, Textdraw10);
                            TextDrawHideForPlayer(playerid, Textdraw11);
                            new string[80 + MAX_PLAYER_NAME], pname[MAX_PLAYER_NAME];
                            GetPlayerName(playerid,pname,sizeof(pname));
                            strreplace(pname,'_',' ');
                            format(string,sizeof(string),"Welcome to Downtown Roleplay, %s.",pname);
                            SendClientMessage(playerid,COLOR_ORANGE,string);
                            return 1;
                        }
                    }
                }
                else
                {
                    new str[500], name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    strreplace(name, '_', ' ');
                    format(str,sizeof(str),"{FFFFFF}Wrong password, attemps left: 4 \n\nThat username is registered, please enter your password below.\n\n{FFA500}Username: {FFFFFF}%s \n\n{FFA500}Password:",name);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Login",str,"Login","Quit");
                    IncorrectPassword[playerid] ++;
                }
                if(IncorrectPassword[playerid] == 1)
                {
                    new str[500], name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    strreplace(name, '_', ' ');
                    format(str,sizeof(str),"{FFFFFF}Wrong password, attemps left: 3 \n\nThat username is registered, please enter your password below.\n\n{FFA500}Username: {FFFFFF}%s \n\n{FFA500}Password:",name);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Login",str,"Login","Quit");
                }
                if(IncorrectPassword[playerid] == 2)
                {
                    new str[500], name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    strreplace(name, '_', ' ');
                    format(str,sizeof(str),"{FFFFFF}Wrong password, attemps left: 2 \n\nThat username is registered, please enter your password below.\n\n{FFA500}Username: {FFFFFF}%s \n\n{FFA500}Password:",name);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Login",str,"Login","Quit");
                }
                if(IncorrectPassword[playerid] == 3)
                {
                    new str[500], name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    strreplace(name, '_', ' ');
                    format(str,sizeof(str),"{FFFFFF}Wrong password, attemps left: 1 \n\nThat username is registered, please enter your password below.\n\n{FFA500}Username: {FFFFFF}%s \n\n{FFA500}Password:",name);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Login",str,"Login","Quit");
                }
                if(IncorrectPassword[playerid] == 4)
                {
                    new str[500], name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    strreplace(name, '_', ' ');
                    format(str,sizeof(str),"{FFFFFF}Wrong password, attemps left: 0 \n\nThat username is registered, please enter your password below.\n\n{FFA500}Username: {FFFFFF}%s \n\n{FFA500}Password:",name);
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,"{FFA500}Downtown Roleplay - Login",str,"Login","Quit");
                    SendClientMessage(playerid,COLOR_ORANGE,"Wrong password, you have been kicked out automatically.");
                    Kick(playerid);
                }
            }
        }
Reply


Messages In This Thread
problem with dialog - by vernz - 25.07.2012, 18:17
Re: problem with dialog - by Rudy_ - 25.07.2012, 18:23
Re : problem with dialog - by vernz - 25.07.2012, 18:27
Re: problem with dialog - by Rudy_ - 25.07.2012, 19:18
Re : problem with dialog - by vernz - 25.07.2012, 19:24
Re : problem with dialog - by vernz - 26.07.2012, 16:41

Forum Jump:


Users browsing this thread: 4 Guest(s)