LVRCR Login Dialog
#1

I am running a heavily edited version of LVRCR, but we are still using the initial dudb login system.

I am trying to create a dialog register/login, but it's evading me, could anyone give me a hand and help me off?

Login Code:
pawn Код:
dcmd_login(playerid,params[]) {


  // The command shouldn't work if we already are authed
  if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged in");

  // The command shouldn't work if an account with this
  // nick does not exists
  if (!udb_Exists(PlayerName(playerid))) return SystemMsg(playerid,"Account does not exist, please use /register password");

  // Did he forgot the password?
  if (strlen(params)==0) return SystemMsg(playerid,"Usage: /login password");

  if (udb_CheckLogin(PlayerName(playerid),params)) {
    // Login was correct

    // Following thing is the same like the missing SetPlayerCommand
        GivePlayerMoney(playerid,dUserINT(PlayerName(playerid)).("money")-GetPlayerMoney(playerid));
    SetPlayerScore(playerid,dUserINT(PlayerName(playerid)).("score")-GetPlayerScore(playerid));
    robberrank[playerid] =dUserINT(PlayerName(playerid)).("robrank");
    coprank[playerid] =dUserINT(PlayerName(playerid)).("coprank");
    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");
    PlayerAdminLevel[playerid] =dUserINT(PlayerName(playerid)).("adminlevel");
    RegularPlayer[playerid] =dUserINT(PlayerName(playerid)).("RegularPlayer");
    TrustedRegular[playerid] =dUserINT(PlayerName(playerid)).("TrustedRegular");
    HasDrugHouseKeys[playerid] =dUserINT(PlayerName(playerid)).("HasDrugHouseKeys");
    ColdFireOwner[playerid] =dUserINT(PlayerName(playerid)).("ColdFireOwner");
    ColdFireMember[playerid] =dUserINT(PlayerName(playerid)).("ColdFireMember");
    CarbonMufOwner[playerid] =dUserINT(PlayerName(playerid)).("CarbonMufOwner");
    CarbonMufMember[playerid] =dUserINT(PlayerName(playerid)).("CarbonMufMember");
    Friend[playerid] =dUserINT(PlayerName(playerid)).("Friend");
    Owner[playerid] =dUserINT(PlayerName(playerid)).("Owner");
    PLAYERLIST_authed[playerid]=true;

    return SystemMsg(playerid,"You are now logged in. Your stats will be auto-saved when you disconnect");
  }
  // Login was incorrect
  return SystemMsg(playerid,"Login Attempt Failed");
 }
Register Code:
pawn Код:
dcmd_register(playerid,params[]) {

  // The command shouldn't work if we already are authed
  if (PLAYERLIST_authed[playerid]) return SystemMsg(playerid,"You are already logged into your account");

  // The command shouldn't work if an account with this
  // nick already exists
  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");
  // Did he forgot the password?
  if (strlen(params)==0) return SystemMsg(playerid,"Use: /register password to create a new account");

  // We save the money to the accstate
  if (udb_Create(PlayerName(playerid),params)) {

  dUserSetINT(PlayerName(playerid)).("money",7500);
  dUserSetINT(PlayerName(playerid)).("bankcash",5000);
  dUserSetINT(PlayerName(playerid)).("loancash",0);
  dUserSetINT(PlayerName(playerid)).("cashinsured",0);
  dUserSetINT(PlayerName(playerid)).("autobahnowner",0);
  dUserSetINT(PlayerName(playerid)).("regplayer",0);
  dUserSetINT(PlayerName(playerid)).("carwinner",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)).("drugs",0);
  dUserSetINT(PlayerName(playerid)).("drugbagy",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)).("casinorob",0);
  dUserSetINT(PlayerName(playerid)).("cashfromcasninorob",0);
  dUserSetINT(PlayerName(playerid)).("atmsrobbed",0);
  dUserSetINT(PlayerName(playerid)).("cashfromatmsrobbed",0);
  dUserSetINT(PlayerName(playerid)).("crimsarrested",0);
  dUserSetINT(PlayerName(playerid)).("timesarrested",0);
  dUserSetINT(PlayerName(playerid)).("totaljailtime",0);
  dUserSetINT(PlayerName(playerid)).("timesparoled",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)).("hitsplaced",0);
  dUserSetINT(PlayerName(playerid)).("hitsplacedonyou",0);
  dUserSetINT(PlayerName(playerid)).("timessearched",0);
  dUserSetINT(PlayerName(playerid)).("drugssiezedbycops",0);
  dUserSetINT(PlayerName(playerid)).("canusearmy",0);
  dUserSetINT(PlayerName(playerid)).("connectedminute",0);
  dUserSetINT(PlayerName(playerid)).("connectedhour",0);
  dUserSetINT(PlayerName(playerid)).("timesfuckedoff",0);
  dUserSetINT(PlayerName(playerid)).("storesrobbed",0);
  dUserSetINT(PlayerName(playerid)).("cashfromstorerob",0);
  dUserSetINT(PlayerName(playerid)).("RegularPlayer",0);
  dUserSetINT(PlayerName(playerid)).("AirPortOwner",0);
  dUserSetINT(PlayerName(playerid)).("DrugHouseOwner",0);
  dUserSetINT(PlayerName(playerid)).("HasDrugHouseKeys",0);



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

   }
    return true;

 }
Reply


Messages In This Thread
LVRCR Login Dialog - by Rhemsis - 24.11.2009, 05:14
Re: LVRCR Login Dialog - by Rhemsis - 26.11.2009, 07:32
Re: LVRCR Login Dialog - by Rhemsis - 10.07.2010, 23:09
Re: LVRCR Login Dialog - by sn11pah - 15.11.2010, 21:45

Forum Jump:


Users browsing this thread: 1 Guest(s)