Dialogs?
#1

Hey everyone.

Currently I have a weird register system that I do not like at all. When you at the first time join the server, you will have to write in your password and press "Register" and you will spawn at the spawn point I have made.

I want it to proceed through more dialogs after they have written in their password they will proceed to next dialog which asks about their gender. They can either write in male or female, everything depends on their character gender. After that they will have to press next and another dialog will popup and ask for age. They will have to write in their age in the dialog and then proceed to next step, and there they will be asked for origin. They may write in their origin and press register. After they have gone through all the dialogs they will spawn and they will be registerd in the system.

I am using https://sampforum.blast.hk/showthread.php?tid=273088 this register system at the moment and I would like to edit it so it have to go through more dialogs. But when they are registered and logs onto the server they will just have to write in their password and they'll spawn.

OnPlayerConnect I do have this code:
pawn Код:
public OnPlayerConnect(playerid)
{

    if(!IsValidName(playerid))
    {
        SendClientMessage(playerid,COLOR_LIGHTRED,"Please change your name into the following format: Firstname_Lastname");
        SetTimerEx("KickPlayer", 6, false, "d", playerid);
    }
   
    SetOriginalColor(playerid);
   
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_GREY1"Welcome to My Role Play Server",""COLOR_GREY1"SERVER: You have 60 seconds to login \n NOTICE: We are currently under beta testing \n so if you find any bugs, let us know \n\n    Enter Your Password:","Login","Cancel");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COLOR_GREY1"Welcome to My Role Play Server",""COLOR_GREY1"Type your password below to register a new account. \n HINT: Do not give out your password to anyone else","Register","Cancel");
    }
    return 1;
}
On OnPlayerDialogResponse I do have this code:
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, ""COLOR_GREY1"Welcome to My Role Play Server",""COLOR_GREY1"You have entered an invalid password.\n"COLOR_GREY1"Type your password below to register a new account.","Register","Cancel");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",5000);
                INI_WriteInt(File,"VIP",0);
                PlayerInfo[playerid][pVIP] = 0;
                INI_WriteInt(File,"Banned",0);
                PlayerInfo[playerid][pBanned] = 0;
                INI_WriteInt(File,"Warns",0);
                PlayerInfo[playerid][pWarns] = 0;
                INI_WriteInt(File,"Muted",0);
                PlayerInfo[playerid][pMuted] = 0;
                PlayerInfo[playerid][pMuteTime] = 0;
                INI_WriteInt(File,"MuteTime",0);
                INI_WriteInt(File,"Admin",0);
                PlayerInfo[playerid][pAdmin] = 0;
                INI_WriteInt(File,"Kills",0);
                PlayerInfo[playerid][pKills] = 0;
                INI_WriteInt(File,"Deaths",0);
                PlayerInfo[playerid][pDeaths] = 0;
                INI_WriteInt(File,"Model",264);
                PlayerInfo[playerid][pModel] = 264;
                INI_WriteInt(File,"Level",1);
                PlayerInfo[playerid][pLevel] = 1;
                INI_WriteInt(File,"Experience",0);
                PlayerInfo[playerid][pExp] = 0;
                INI_WriteInt(File,"Faction",0);
                PlayerInfo[playerid][pFaction] = 0;
                INI_WriteInt(File,"Rank",0);
                PlayerInfo[playerid][pRank] = 0;
                INI_WriteInt(File,"Phonenumber",0);
                PlayerInfo[playerid][pNumber] = 0;
    INI_Close(File);

                SetPlayerScore(playerid, 1);
                GivePlayerMoney(playerid, 5000);
                SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pModel], 1686.1014, -2332.1179, -2.6797, 355.4632, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
                        }
        }



        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]);
                    SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
                    SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pModel], 1686.1014, -2332.1179, -2.6797, 355.4632, 0, 0, 0, 0, 0, 0);
                    SpawnPlayer(playerid);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COLOR_GREY1"Login",""COLOR_GREY1"Password does not match.\n\n"COLOR_GREY1"SERVER: You have 60 seconds to login\n NOTICE: We are still under beta testing\n\n  Enter Your Password:","Login","Cancel");
                }
                return 1;
            }
        }
    }
    return 1;
}
And actually it feels like I have tried everything, but it doesn't work. But I have seen it on other servers so it should work on mine too. I am a newbie scripter so do not expect that I know everything. So if you would like to explain and give me examples I would really appreciate it and of course you will get a positive reputation if you helped me.

In advance, thank you.
Reply
#2

If I've interpreted what you mean, you'll want to add another ShowPlayerDialog just before where it says SetSpawnInfo.
Reply
#3

Quote:
Originally Posted by Jack.7331
Посмотреть сообщение
If I've interpreted what you mean, you'll want to add another ShowPlayerDialog just before where it says SetSpawnInfo.
I have tried that but the problem is that the dialog won't show up and it might fuck up the login (incorrect) password thing. Mind giving me an example or hit me up on skype? dwerig is my skype name if you want to see what's actually happening. I am not houndred percent sure where I shall place the new showplayerdialog, I have tried to make a new case, placed it underneath the register dialog and moved spawn thingy to after age just to try, didn't work at all.
Reply
#4

Remove the SpawnPlayer and SetSpawnInfo. And replace it with the showplayerdialog for the Gender/Age dialog.
And put the SpawnPlayer and SetSpawnInfo at the very end. If you want i have a snippet from my gm.
Reply
#5

Quote:
Originally Posted by Facerafter
Посмотреть сообщение
Remove the SpawnPlayer and SetSpawnInfo. And replace it with the showplayerdialog for the Gender/Age dialog.
And put the SpawnPlayer and SetSpawnInfo at the very end. If you want i have a snippet from my gm.
Already did that but it still doesn't work. The dialog after the register dialog doesn't show up. Add me on skype if you want to see it over screenshare or whatever it's called
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)