Help with dialogs
#1

pawn Код:
if(dialogid == 7)
    {
        if(response)
        {
            if(!strlen(inputtext))
                ShowPlayerDialog(playerid, 198, DIALOG_STYLE_INPUT, "SKIN", "Please input a skin ID to change your skin:", "Send", "Close");
            if(strval(inputtext) < 0 || strval(inputtext) > 299)
                ShowPlayerDialog(playerid, 198, DIALOG_STYLE_INPUT, "SKIN", "Invalid Skin ID. Choose another:", "Send", "Close");
            SetPlayerSkin(playerid, strval(inputtext));
            new str[64];
            format(str, 128, "New skin: %d", strval(inputtext));
            SendClientMessage(playerid, 0xFFFF00FF, str);
        }
    }
needs to be added to
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,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Telefoninumber", 0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Annetaja",0);
                INI_WriteInt(File,"Sugu",1);
                INI_WriteInt(File,"Vanus",0);
                INI_WriteInt(File,"Hoiatusi",0);
                INI_WriteInt(File,"P2rit",1);
                INI_WriteInt(File,"Lukus",0);
                INI_Close(File);

                new randphone = 500000 + random(599999);
                PlayerInfo[playerid][pNumber] = randphone;
                Mobile[playerid] = 255;
                SetSpawnInfo(playerid, 0, 0,-1464.5887,2590.8757,55.8359,0.5974,0,0,0,0,0,0);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Хnnestus!",""COL_GREEN"Sa logisid sisse.\n "COL_GREEN"Serveri nimi: "COL_WHITE"aCe' Gamingu Rollimдngu server [0.3c]\n "COL_GREEN"IP:"COL_WHITE"88.196.165.136\n "COL_GREEN"TS:"COL_WHITE"88.196.165.136","Okei","");
            }
        }

        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]);
                    Mobile[playerid] = 255;
                    SetSpawnInfo(playerid, 0, 0,-1464.5887,2590.8757,55.8359,0.5974,0,0,0,0,0,0);
                    SpawnPlayer(playerid);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Хnnestus!",""COL_GREEN"Sa logisid sisse.\n "COL_WHITE"Serveri nimi: aCe' Gamingu Rollimдngu server [0.3c]\n IP:88.196.165.136\n TS:88.196.165.136","Okei","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Sa sisestasid vale parooli.\n"COL_WHITE"Sisesta oma parool, et sisse logida","Logi sisse","Lahku");
                }
                return 1;
            }
        }

    }
    return 1;
}
It would be cool if during the registering it will let you to choose your skin.
Reply
#2

Just show the dialog when the player registers (case DIALOG_REGISTER) ?
Reply
#3

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,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Telefoninumber", 0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Annetaja",0);
                INI_WriteInt(File,"Sugu",1);
                INI_WriteInt(File,"Vanus",0);
                INI_WriteInt(File,"Hoiatusi",0);
                INI_WriteInt(File,"P2rit",1);
                INI_WriteInt(File,"Lukus",0);
                INI_Close(File);

                new randphone = 500000 + random(599999);
                PlayerInfo[playerid][pNumber] = randphone;
                Mobile[playerid] = 255;
                ShowPlayerDialog(playerid, 198, DIALOG_STYLE_INPUT, "SKIN", "Please input a skin ID to change your skin:", "Send", "Close");
            }
        }

        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]);
                    Mobile[playerid] = 255;
                    SetSpawnInfo(playerid, 0, 0,-1464.5887,2590.8757,55.8359,0.5974,0,0,0,0,0,0);
                    SpawnPlayer(playerid);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Хnnestus!",""COL_GREEN"Sa logisid sisse.\n "COL_WHITE"Serveri nimi: aCe' Gamingu Rollimдngu server [0.3c]\n IP:88.196.165.136\n TS:88.196.165.136","Okei","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"Sa sisestasid vale parooli.\n"COL_WHITE"Sisesta oma parool, et sisse logida","Logi sisse","Lahku");
                }
                return 1;
            }
        }
        case 198:
        {
            if(response)
            {
                if(!strlen(inputtext))
                    ShowPlayerDialog(playerid, 198, DIALOG_STYLE_INPUT, "SKIN", "Please input a skin ID to change your skin:", "Send", "Close");
                if(strval(inputtext) < 0 || strval(inputtext) > 299)
                    ShowPlayerDialog(playerid, 198, DIALOG_STYLE_INPUT, "SKIN", "Invalid Skin ID. Choose another:", "Send", "Close");
                SetPlayerSkin(playerid, strval(inputtext));
                new str[64];
                format(str, 128, "New skin: %d", strval(inputtext));
                SendClientMessage(playerid, 0xFFFF00FF, str);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Хnnestus!",""COL_GREEN"Sa logisid sisse.\n "COL_GREEN"Serveri nimi: "COL_WHITE"aCe' Gamingu Rollimдngu server [0.3c]\n "COL_GREEN"IP:"COL_WHITE"88.196.165.136\n "COL_GREEN"TS:"COL_WHITE"88.196.165.136","Okei","");
                SetSpawnInfo(playerid, 0, 0,-1464.5887,2590.8757,55.8359,0.5974,0,0,0,0,0,0);
                SpawnPlayer(playerid);
            }
        }
    }
    return 1;
}
Reply
#4

Lol, i didnt meant this but it helped a lot.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)