easyDialog
#1

i made log/reg system by using easyDialog.inc and by reading this https://sampforum.blast.hk/showthread.php?tid=524344 tutorial as a guide.

now, my problem is that everything is bugged af. when i want to press quit, server doesnt kick me. it just continues to another dialog.

for example, I have an intro dialog to say hi to the player and etc. if the player wants to continue with registration process he should press 'Go'

Код:
public OnPlayerConnect(playerid)
{
    TogglePlayerSpectating(playerid, 1);
    if(fexist(UserPath(playerid))) 
    {
        LoginAttempts[playerid] = 0;
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); 
        Dialog_Show(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Login", "Type in your password below in order to login.", "Login", "Quit");
    }
    else
    {
        Dialog_Show(playerid, DialogIntro, DIALOG_STYLE_MSGBOX, "Hello", "Welcome to our server. Press 'Go' in order to start registration!", "Go", "Quit");
    }
    return 1;
}
and if the player decides to leave he should press quit, of course...

but in my situation both of the buttons continue with dialogs.

dialogs dont even check my input for password, age, gender... I can just spam enter on my keyboard without any input until it stops on Age dialog - where of course nothing happens.

is the easyDialog.inc bugged or is it just my bad?

registration process should go like this: intro dialog > password > gender > age

btw thanks a lot guys for helping me, i hope im not annoying

here is my code:

Код:
Dialog:DialogAge(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return Kick(playerid);
    if(response)
    {
        if(!strlen(inputtext)) Dialog_Show(playerid, DialogAge, DIALOG_STYLE_INPUT, "Choose your character's age [3/3]", "Type in your age!\nValid age: "#MIN_AGE" - "#MAX_AGE"", "End", "Quit");
        if(strlen(inputtext))
        {
            new age = strval(inputtext);
            if(age < MIN_AGE || age > MAX_AGE)
            {
                Dialog_Show(playerid, DialogAge, DIALOG_STYLE_INPUT, "Choose your character's age [3/3]", "Type in your age!\nValid age: "#MIN_AGE" - "#MAX_AGE"", "End", "Quit");
            }
            else
            {
                PlayerInfo[playerid][Age] = age;
                new string[64];
                format(string, sizeof(string), ""SERVER"Your age is %d", age);
                SendClientMessage(playerid, -1, string);
                SaveAccountStats(playerid);
                GivePlayerMoney(playerid, STARTING_MONEY);
                SendClientMessage(playerid, -1, ""SERVER"You got "#STARTING_MONEY" as starting money!");
            }
        }
    }
    return 1;
}

Dialog:DialogGender(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return Kick(playerid);
    if(response)
    {
        if(!strlen(inputtext))
        {
             Dialog_Show(playerid, DialogGender, DIALOG_STYLE_INPUT, "Choose your character's gender [2/3]", "Type in your gender!\nValid genders: 'male' ; 'female'", "Next", "Quit");     
        } 
        if (!strcmp(inputtext, "male"))
        {
            PlayerInfo[playerid][Gender] = 1; 
            SendClientMessage(playerid, -1, "You are a male");
            Dialog_Show(playerid, DialogAge, DIALOG_STYLE_INPUT, "Choose your character's age [3/3]", "Type in your age!\nValid age: "#MIN_AGE" - "#MAX_AGE"", "End", "Quit");
        }
        else if (!strcmp(inputtext, "female"))
        {
            PlayerInfo[playerid][Gender] = 2;
            SendClientMessage(playerid, -1, "You are a female");
            Dialog_Show(playerid, DialogAge, DIALOG_STYLE_INPUT, "Choose your character's age [3/3]", "Type in your age!\nValid age: "#MIN_AGE" - "#MAX_AGE"", "End", "Quit");
        }
        else
        {
            return Dialog_Show(playerid, DialogGender, DIALOG_STYLE_INPUT, "Choose your character's gender [2/3]", "Type in your gender!\nValid genders: 'male' ; 'female'", "Next", "Quit");
        }
    }
    return 1;
} 


Dialog:DialogPassword(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return Kick(playerid);
    if(response)
    {
        if (!(MIN_PASSWORD_LENGTH <= strlen(inputtext) <= MAX_PASSWORD_LENGTH))
        {
            Dialog_Show(playerid, DialogPassword, DIALOG_STYLE_PASSWORD, "Choose your password [1/3]", "You typed in an invalid password!", "Next", "Quit");
            SendClientMessage(playerid, -1, "Invalid password length, must be between "#MIN_PASSWORD_LENGTH" - "#MAX_PASSWORD_LENGTH" characters.");
        }

        new hash[129]; 
        new INI:File = INI_Open(UserPath(playerid)); 

        INI_SetTag(File,"data"); 
        WP_Hash(hash, sizeof(hash), inputtext); 
        INI_WriteString(File,"Password", hash);
        INI_WriteInt(File,"Admin", 0);
        INI_WriteInt(File,"Gender", 0);
        INI_WriteInt(File,"Age", 0);
        INI_WriteInt(File,"Money", 0);
        INI_WriteFloat(File,"PosX", 0);
        INI_WriteFloat(File,"PosY", 0);
        INI_WriteFloat(File,"PosZ", 0);
        INI_WriteInt(File,"InteriorID", 0);
        INI_WriteInt(File,"Skin", 0);
        INI_WriteInt(File,"Kills", 0);
        INI_WriteInt(File,"Deaths", 0);
        INI_Close(File);
        
        pNewlyRegged[playerid] = true;

        Dialog_Show(playerid, DialogGender, DIALOG_STYLE_INPUT, "Choose your character's gender [2/3]", "Type in your gender!\nValid genders: 'male' ; 'female'", "Next", "Quit");

     }
    return 1;
}

Dialog:DialogIntro(playerid, dialogid, response, listitem, inputtext[])
{
    if(!response) return Kick(playerid);
    if(response)
    {
        SendClientMessage(playerid, -1, "You accepted our rules and began registration process.");
        Dialog_Show(playerid, DialogPassword, DIALOG_STYLE_PASSWORD, "Choose your password [1/3]", "Type in your password!\nBe careful!", "Next", "Quit");
    }
    return 1;
}
Reply


Messages In This Thread
easyDialog - by v4yne1 - 16.03.2019, 16:04
Re: easyDialog - by antixgaming - 16.03.2019, 18:32
Re: easyDialog - by v4yne1 - 16.03.2019, 18:45
Re: easyDialog - by antixgaming - 16.03.2019, 18:48
Re: easyDialog - by v4yne1 - 16.03.2019, 19:06
Re: easyDialog - by antixgaming - 16.03.2019, 19:09
Re: easyDialog - by v4yne1 - 16.03.2019, 19:27
Re: easyDialog - by antixgaming - 16.03.2019, 20:49
Re: easyDialog - by v4yne1 - 16.03.2019, 23:06

Forum Jump:


Users browsing this thread: 1 Guest(s)