Register/Login Problem
#1

I have a register/login system that works perfectly.


The problem is, i want to make it work with dialogs, but i've been looking for a very simple login/register with dialogs, but cannot find one.


Can someone quickly help me with it, or give me a link please, I've been searching for awhile now.


Login command:

pawn Код:
dcmd_login(playerid,params[])
{
    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged in");

    if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account does not exist, please use /register password");

    if (strlen(params)==0) return SystemMsg(playerid,"Usage: /login password");

    if (udb_CheckLogin(PlayerName(playerid),params)) {

        GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
        SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
        robberrank[playerid] =dUserINT(PlayerName(playerid)).("robrank");
        raperank[playerid] =dUserINT(PlayerName(playerid)).("raperank");
        tazerank[playerid] =dUserINT(PlayerName(playerid)).("tazerank");
        hitrank[playerid] =dUserINT(PlayerName(playerid)).("hitrank");
        arrestrank[playerid] =dUserINT(PlayerName(playerid)).("arrestrank");
        teamkiller[playerid] =dUserINT(PlayerName(playerid)).("teamkills");
        innocentkiller[playerid] =dUserINT(PlayerName(playerid)).("innocentkills");
        lowwantedkiller[playerid] =dUserINT(PlayerName(playerid)).("lowwantedkills");
        BankRobInsurance[playerid] =dUserINT(PlayerName(playerid)).("cashinsured");
        CanUseArmy[playerid] =dUserINT(PlayerName(playerid)).("canusearmy");
        donator[playerid] =dUserINT(PlayerName(playerid)).("donator");
        PlayerAdminLevel[playerid] =dUserINT(PlayerName(playerid)).("adminlevel");
        RegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
        JailTime[playerid] = dUserINT(PlayerName(playerid)).("jailtime");
        PLAYERLIST_authed[playerid]=true;

        return SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
    }
    return SystemMsg(playerid,"Login Attempt Failed");
}
Register command:

pawn Код:
dcmd_register(playerid,params[])
{

    new plrip[128];
    GetPlayerIp(playerid,plrip,sizeof(plrip));

    if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged into your account");

    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"This name is registered, please use /login password to log in.");

    if (RegisterLoginDisabled == 1337) return  SystemMsg(playerid,"New Account Registrations are Disabled. This is due to maintenance");
    if (strlen(params)==0) return SystemMsg(playerid,"Use: /register password to create a new account");

    if (udb_Create(PlayerName(playerid),params)) {

        dUserSetINT(PlayerName(playerid)).("money",7500);
        dUserSetINT(PlayerName(playerid)).("bankcash",5000);
        dUserSetINT(PlayerName(playerid)).("cashinsured",0);
        dUserSetINT(PlayerName(playerid)).("regplayer",0);
        dUserSetINT(PlayerName(playerid)).("score",0);
        dUserSetINT(PlayerName(playerid)).("team",0);
        dUserSetINT(PlayerName(playerid)).("skin",0);
        dUserSetINT(PlayerName(playerid)).("Jailtime",0);
        dUserSetINT(PlayerName(playerid)).("wallet",0);
        dUserSetINT(PlayerName(playerid)).("cork",0);
        dUserSetINT(PlayerName(playerid)).("drugs",0);
        dUserSetINT(PlayerName(playerid)).("HasDrugBag",0);
        dUserSetINT(PlayerName(playerid)).("adminlevel",0);
        dUserSetINT(PlayerName(playerid)).("teamkills",0);
        dUserSetINT(PlayerName(playerid)).("innocentkills",0);
        dUserSetINT(PlayerName(playerid)).("lowwantedkills",0);
        dUserSetINT(PlayerName(playerid)).("coprank",0);
        dUserSetINT(PlayerName(playerid)).("robrank",0);
        dUserSetINT(PlayerName(playerid)).("rpabusewar",0);
        dUserSetINT(PlayerName(playerid)).("deaths",0);
        dUserSetINT(PlayerName(playerid)).("finesissued",0);
        dUserSetINT(PlayerName(playerid)).("finespaid",0);
        dUserSetINT(PlayerName(playerid)).("nameban",0);
        dUserSetINT(PlayerName(playerid)).("timesinfected",0);
        dUserSetINT(PlayerName(playerid)).("timesraped",0);
        dUserSetINT(PlayerName(playerid)).("timesrobbed",0);
        dUserSetINT(PlayerName(playerid)).("timeshealed",0);
        dUserSetINT(PlayerName(playerid)).("timescured",0);
        dUserSetINT(PlayerName(playerid)).("canusearmy",0);
        dUserSetINT(PlayerName(playerid)).("donator",0);
        dUserSetINT(PlayerName(playerid)).("connectedminute",0);
        dUserSetINT(PlayerName(playerid)).("connectedhour",0);
        dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
        dUserSet(PlayerName(playerid)).("ipaddress",plrip);

        return SystemMsg(playerid,"Your Account has been created. Login with /login password now to log in (Before Spawn)");

    }
    return true;

}
Reply
#2

I also need the same thing
Reply
#3

Torran's Registration System will work.
Reply
#4

Quote:
Originally Posted by DJDhan
Посмотреть сообщение
I read his, I can't look at it, and change mine to a dialog
Reply
#5

If your having a RP server my suggestion if alot of your player use binds to not use dialogs, Bind problems will cause problems in dialogs if any of there bind keys are in there password.
Reply
#6

Try his first version, it's pretty basic. He added more features in the newer releases.
If you still can't figure it out, have a look at the Scripting Tutorials Section and learn how to make dialogs and a register system.
Reply
#7

Thank you DJ. I took a look at his first version, it is a bit easier, The problem is hes using Fexist and dini. I'm trying to use dudb since most of my script uses it (banks etc)

You guys know any tutorials, or scripts with dudb? DJ, it would be awesome if you made one for the tutorials section
Reply
#8

Anyone have a quick tut, or a good way of changing mine into dialog? It's the same as "ruckfules99"
Reply
#9

You can give this a try... (Not tested)

pawn Код:
#define REGDIAG 9861

public OnPlayerConnect(playerid)
{
    if(udb_Exists(PlayerName(playerid)))
    {
        ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "This name is registered!\nPlease enter your password below!", "Login", "Exit");
    }
    else
    {
        ShowPlayerDialog(playerid, REGDIAG+1, DIALOG_STYLE_INPUT, "Account", "This name is not registered!\nPlease enter a password below", "Register", "Exit");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == REGDIAG) //Login
    {
        if(response)
        {
            if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid, "You are already logged in");
            if (!udb_Exists(PlayerName(playerid))) return ShowPlayerDialog(playerid, REGDIAG+1, DIALOG_STYLE_INPUT, "Account", "This name is not registered!\nPlease enter a password below", "Register", "Exit");
            if (!strlen(inputtext)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: You must enter your password!\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");

            if(udb_CheckLogin(PlayerName(playerid),inputtext))
            {

                GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
                SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
                robberrank[playerid] =dUserINT(PlayerName(playerid)).("robrank");
                raperank[playerid] =dUserINT(PlayerName(playerid)).("raperank");
                tazerank[playerid] =dUserINT(PlayerName(playerid)).("tazerank");
                hitrank[playerid] =dUserINT(PlayerName(playerid)).("hitrank");
                arrestrank[playerid] =dUserINT(PlayerName(playerid)).("arrestrank");
                teamkiller[playerid] =dUserINT(PlayerName(playerid)).("teamkills");
                innocentkiller[playerid] =dUserINT(PlayerName(playerid)).("innocentkills");
                lowwantedkiller[playerid] =dUserINT(PlayerName(playerid)).("lowwantedkills");
                BankRobInsurance[playerid] =dUserINT(PlayerName(playerid)).("cashinsured");
                CanUseArmy[playerid] =dUserINT(PlayerName(playerid)).("canusearmy");
                donator[playerid] =dUserINT(PlayerName(playerid)).("donator");
                PlayerAdminLevel[playerid] =dUserINT(PlayerName(playerid)).("adminlevel");
                RegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
                JailTime[playerid] = dUserINT(PlayerName(playerid)).("jailtime");
                PLAYERLIST_authed[playerid] = true;
                return SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
            }
            return SystemMsg(playerid,"Login Attempt Failed");
        }
        return 1;
    }
    else if(dialogid == REGDIAG+1) //Register
    {
        if(response)
        {
            new plrip[100];
            GetPlayerIp(playerid,plrip,sizeof(plrip));

            if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged into your account");
            if (udb_Exists(PlayerName(playerid))) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "This name is registered!\nPlease enter your password below!", "Login", "Exit");

            if (RegisterLoginDisabled == 1337) return SystemMsg(playerid,"New Account Registrations are Disabled. This is due to maintenance");
            if (!strlen(params)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: You must enter a password\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");

            if (udb_Create(PlayerName(playerid),params))
            {
                dUserSetINT(PlayerName(playerid)).("money",7500);
                dUserSetINT(PlayerName(playerid)).("bankcash",5000);
                dUserSetINT(PlayerName(playerid)).("cashinsured",0);
                dUserSetINT(PlayerName(playerid)).("regplayer",0);
                dUserSetINT(PlayerName(playerid)).("score",0);
                dUserSetINT(PlayerName(playerid)).("team",0);
                dUserSetINT(PlayerName(playerid)).("skin",0);
                dUserSetINT(PlayerName(playerid)).("Jailtime",0);
                dUserSetINT(PlayerName(playerid)).("wallet",0);
                dUserSetINT(PlayerName(playerid)).("cork",0);
                dUserSetINT(PlayerName(playerid)).("drugs",0);
                dUserSetINT(PlayerName(playerid)).("HasDrugBag",0);
                dUserSetINT(PlayerName(playerid)).("adminlevel",0);
                dUserSetINT(PlayerName(playerid)).("teamkills",0);
                dUserSetINT(PlayerName(playerid)).("innocentkills",0);
                dUserSetINT(PlayerName(playerid)).("lowwantedkills",0);
                dUserSetINT(PlayerName(playerid)).("coprank",0);
                dUserSetINT(PlayerName(playerid)).("robrank",0);
                dUserSetINT(PlayerName(playerid)).("rpabusewar",0);
                dUserSetINT(PlayerName(playerid)).("deaths",0);
                dUserSetINT(PlayerName(playerid)).("finesissued",0);
                dUserSetINT(PlayerName(playerid)).("finespaid",0);
                dUserSetINT(PlayerName(playerid)).("nameban",0);
                dUserSetINT(PlayerName(playerid)).("timesinfected",0);
                dUserSetINT(PlayerName(playerid)).("timesraped",0);
                dUserSetINT(PlayerName(playerid)).("timesrobbed",0);
                dUserSetINT(PlayerName(playerid)).("timeshealed",0);
                dUserSetINT(PlayerName(playerid)).("timescured",0);
                dUserSetINT(PlayerName(playerid)).("canusearmy",0);
                dUserSetINT(PlayerName(playerid)).("donator",0);
                dUserSetINT(PlayerName(playerid)).("connectedminute",0);
                dUserSetINT(PlayerName(playerid)).("connectedhour",0);
                dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
                dUserSet(PlayerName(playerid)).("ipaddress",plrip);
                return SystemMsg(playerid,"Your Account has been created. Login with /login password now to log in (Before Spawn)");
            }
            return 1;
        }
    }
    return 0;
}
Reply
#10

THANKS FOR HELPING ME!!

But

2 errors, both the same errors on different lines.


undefined symbol "params"
undefined symbol "params"

On
pawn Код:
if (!strlen(params)) return ShowPlayerDialog(playerid, REGDIAG, DIALOG_STYLE_INPUT, "Account", "ERROR: You must enter a password\n\nThis name is registered!\nPlease enter your password below!", "Login", "Exit");
and

pawn Код:
if (udb_Create(PlayerName(playerid),params))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)