SA-MP Forums Archive
Problem with my register/login - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Problem with my register/login (/showthread.php?tid=126806)



Problem with my register/login - kmzr - 10.02.2010

Okay, so what i got so far kinda works it's not saving the stuff below. I tried changing the register system from a standard dcmd /login /register system to use Dialogs. And you can enter any random letters into the password box and it takes me to class selection :/

Anyways, here's my code.
pawn Код:
Entry(playerid)
{
    if (!udb_Exists(PlayerName(playerid)))
        {
            new kayitmsg[256];
            new name[MAX_PLAYER_NAME];
            format(kayitmsg,256,"Welcome to the server\n\n%s please open a new account\n\nEnter the new password:",name);
            ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Register",kayitmsg,"Register","Quit");
            register[playerid] = 1;
            login[playerid] = 0;
        }
        else if (udb_Exists(PlayerName(playerid)))
        {
            new girismsg[256];
            new name[MAX_PLAYER_NAME];
            format(girismsg,256,"Welcome to Esperanza Roleplay\n\n\nEnter your password:",name);
            ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Quit");
            register[playerid] = 0;
            login[playerid] = 1;
        }
    return 1;
}
// The code above is my dialog.

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
  if (response == 1)
  {
        if(dialogid == 12345)
        {
    if (udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account already exists.");
    if (strlen(inputtext)==0) return Entry(playerid);
    if (udb_Create(PlayerName(playerid),inputtext)) return SystemMsg(playerid,"Account successfully created.") && SetPlayerJob(playerid, 1);
    }
    }
    if(dialogid == 12346)
    {
    Encrypt(inputtext);
    if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"[ ! ] Account doesn't exist, please use '/register password'.");
  if (udb_CheckLogin(PlayerName(playerid),inputtext)) {
    GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("Money")-GetPlayerMoney(playerid));
    GivePlayerAdminz(playerid,dUserINT(PlayerName(playerid)).("Admin")-GetPlayerAdminz(playerid));
    SetPlayerInterior(playerid,dUserINT(PlayerName(playerid)).("Interior")-GetPlayerInterior(playerid));
    SetPlayerJob(playerid,dUserINT(PlayerName(playerid)).("Job")-IsPlayerJob(playerid));
    Logged[playerid]=true;
    return SendClientMessage(playerid,ADMIN_MSG,"[ ! ] Access granted ! You're now logged in !");
      }
  if(!strlen(inputtext))
    {
  Entry(playerid);
    return 1;
    }
  }
  return 1;
}



Re: Problem with my register/login - kmzr - 10.02.2010

Anyone?


Re: Problem with my register/login - MadeMan - 10.02.2010

If you want to save these things you you need to save them.

You don't do it in this script.