Need help with registration systems...
#1

Hello there!

I'm running light edited version from LVRCR 1.8, but now I have problems with registration systems. I just installed dialog registration / log in system, looks like that is working, but old one is still in here. First when you are logged in, or registered to dialog, then you need log in to chat with /login (password) command, huh? You need to log in / register two times to get spawned.

I have no idea how to use just the dialog system. Chat command registration and log in system are so old, so I hope you guys can help me with this thing.

There is some codes in player connect:

Код:
public OnPlayerRequestSpawn(playerid)
{
    if(udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid]) {
	GameTextForPlayer(playerid,"~w~ THIS PLAYER NAME IS REGISTERED~n~~r~!- YOU ARE NOT LOGGED IN -!~n~~w~ USE ~g~/LOGIN (PASSWORD)",5000,3);
	return 0;
}
	if(!udb_Exists(PlayerName(playerid)) && !PLAYERLIST_authed[playerid]) {
	GameTextForPlayer(playerid,"~w~ PLAYER NAME NOT REGISTERED~n~~r~!- YOU ARE NOT REGISTERED -!~n~~w~ USE ~g~/REGISTER (PASSWORD)",5000,3);
	return 0;
}
	if(gTeam[playerid] == TEAM_ARMY && CanUseArmy[playerid] == 0) {
    GameTextForPlayer(playerid,"~w~You cannot use this class/skill~n~You do not have the required permissions to play as~n~~b~Las Venturas army",5000,3);
	return 0;
}

 	return 1;
}

public OnPlayerConnect(playerid)
{
    KilledHimself[playerid] =0;
    SpamStrings[playerid] =0;
    GotCopBriberecently[playerid] =0;
    CanUseArmy[playerid] =0;
    PlayerAdminLevel[playerid] =0;
    AdminKilled[playerid] =0;
    TimeToMoveTwoFourSeven[playerid] =999;
    RobbedCash[playerid] =0;
    BankCashReturns[playerid] =0;
    BankRobInsurance[playerid] =0;
    AbandonedCopCar[playerid] =1;
    HasCried[playerid] =0;
    IsSpawned[playerid] =0;
    zoneupdates[playerid] = 0;
    player_zone[playerid] = -1;
    Jailed[playerid] =0;
    Frozen[playerid] =0;
    cuffed[playerid] =0;
    Kicking[playerid] =0;
    Chlamydia[playerid] =0;
    Banning[playerid] =0;
    PlayerRobwwait[playerid] =1;
    Tazed[playerid] =0;
    hastazer[playerid] =0;
    LawEnforcementRadio[playerid] =0;
    HasLawEnforcementRadio[playerid] =0;
    ReqBk[playerid] =0;
    ReqBkRecent[playerid] =0;
    ReportedRecent[playerid] =0;
    wantsheal[playerid] =0;
    wantscure[playerid] =0;
    wantsmechanic[playerid] =0;
    RecentAskedMechanic[playerid] =0;
    RobbedCasRecent[playerid] =0;
    RobbedPlyRecent[playerid] =0;
    Wantsfood[playerid] =0;
    sellfoodrecently[playerid] =1;
    Salmonella[playerid] =0;
    askedforfood[playerid] =0;
    askedforweapons[playerid] =0;
    Wantsguns[playerid] =0;
    OfferedGuns[playerid] =0;
    Muted[playerid] =0;
    PlayerDrugs[playerid] =0;
    wantsdrugs[playerid] =0;
    solddrugsrecent[playerid] =0;
    JailTime[playerid] =0;
    StoleCopCarRecent[playerid] =0;
    playerondrugs[playerid] =0;
    playertookdrugs[playerid] =0;
    HasDrugBag[playerid] =0;
    triedtoescaperecent[playerid] =0;
    cannotescapejail[playerid] =0;
    CopWaitBetweenRefills[playerid] =0;
    VisitReq[playerid] =0;
    EscapedConvict[playerid] =0;
    VisitReqExpires[playerid] =0;
    HasHitOnHim[playerid] =0;
    InAlcatraz[playerid] =0;
    PLAYERLIST_authed[playerid]=false;
    loginchances[playerid] =0;
    BankCash[playerid] =0;
    UsedBankRecently[playerid] =0;
    InBank[playerid] =0;
    Playerrobbedbankrecent[playerid] =0;
    InDerby[playerid] =0;
    commitedcrimerecently[playerid] =0;
    copshavevc[playerid] =0;
    fixedcarrecent[playerid] =0;
    //NewCash[playerid] =0;
    OldCash[playerid] =0;
    RegularPlayer[playerid] =0;
    InAdminHQ[playerid] =0;
    autobahnowner[playerid] =0;
    drunkplayer[playerid] =0;
    lastcardrove[playerid] =999;
    InAdminMode[playerid] =0;
    HasC4[playerid] =0;
    PlantingC4[playerid] =0;
    RobbedCaligs[playerid] =0;
    HasWallet[playerid] =0;
    TrashDeliveryTime[playerid] =0;
    TrashDeliveryEarnings[playerid] =0;
    GunDeliveryLevel[playerid] =0;
    OnDelMission[playerid] =0;
    GunsDeliveryTime[playerid] =0;
    DeliveringGuns[playerid] =0;
    RobbedBank[playerid] =0;
    DeliveringCash[playerid] =0;
    totalcashdelivered[playerid] =0;
    Driveronduty[playerid] =0;
    pmsoff[playerid] =0;
    carwin[playerid] =0;
    beenrobbedrecently[playerid] =0;
    AllowPlayerTeleport(playerid,0);
    canchooseskill[playerid] =0;
    robberrank[playerid] =0;
    teamkiller[playerid] =0;
    innocentkiller[playerid] =0;
    lowwantedkiller[playerid] =0;
    CasSecLastPlayerCuffed[playerid] =999;
    LeftTwoFourSeven[playerid] =999;
    InShamal[playerid] = 0;

    new str[100], str2[100], string[100];
    GetPlayerName(playerid, str, 24);
    format(str2, 100, "\2;%s(%d) Has Joined **** v%s\2;", str,playerid,sversion);
    format(str, 100, "%s(%d) Has Joined **** v%s", str,playerid,sversion);
    printf("%s",str);
    for(new i=0; i<MAX_PLAYERS_; i++)
    {
        if(IsPlayerConnected(i) && i != playerid)
        {
        SendClientMessage(i,0x808080AA, str);
        GiveScoreTimer[playerid] = SetTimerEx ("GivePlayerScore", 1000*60, true, "d", playerid);
        }
    }


    TogglePlayerClock(playerid,true);

    SetPlayerColor(playerid,COLOR_DEADCONNECT);

    SetPlayerVirtualWorld(playerid,0);
    format(string, sizeof(string), "**** - Script Version %s",sversion);
    SendClientMessage(playerid,COLOR_WHITE, string);
    SendClientMessage(playerid,0x87CEEBAA, "This is NOT a deathmatch server. Please do not randomly kill players in here");
    SendClientMessage(playerid,0x87CEEBAA, "Visit our website to report bugs, give suggestions, complaints and etc.");
    SendClientMessage(playerid,0x87CEEBAA, "There is a full list of commands/rules and other information on our website, so you should visit." );
    SendClientMessage(playerid,0x87CEEBAA, "Visit our website at: ****");
    format(string, sizeof(string), "~w~Welcome to~n~****~n~~b~version %s!",sversion);
    GameTextForPlayer(playerid,string, 6000, 0);

    if(udb_Exists(PlayerName(playerid))) {
    SendClientMessage(playerid,0x9ACD32AA,"This Playername is Registered. Please login before you can spawn");
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    SendClientMessage(playerid,COLOR_RED,"Please use command /login (password) to login before you can spawn");
    }
    else
    if(!udb_Exists(PlayerName(playerid))) {
    SendClientMessage(playerid,0x9ACD32AA,"This Playername has not yet been registered. You must register on this server before you can play.");
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registration",""COL_WHITE"Enter the password below to register","Register","Exit");
    SendClientMessage(playerid,COLOR_RED,"Please use /register (password) to register before you can spawn");
    }

    SetPlayerMapIcon( playerid, 1, 3834.0366,462.8921,40.4060, 30, 0 );
    SetPlayerMapIcon( playerid, 2, 2347.7432,1561.8536,36.9063, 52, 0 ); // bank
    SetPlayerMapIcon( playerid, 3, 1137.7289,2088.1465,11.0625, 52, 0 ); // atm 1
    SetPlayerMapIcon( playerid, 4, 2540.4976,2266.2742,10.8203, 52, 0 ); // atm 2
    SetPlayerMapIcon( playerid, 5, 2192.8577,1975.1671,12.2894, 52, 0 ); // atm 3
    SetPlayerMapIcon( playerid, 6, 2231.5820,958.6937,10.8203, 52, 0 ); // atm 4
    SetPlayerMapIcon( playerid, 7, 2174.4482,1398.4165,11.4234, 55, 0 ); // autobahn
    SetPlayerMapIcon( playerid, 8, 2283.0537,2437.0647,46.9775, 30, 0 ); // lvpd
    SetPlayerMapIcon( playerid, 9, 2196.3389,1677.1106,12.3672, 25, 0 ); //casino  enter 1
    SetPlayerMapIcon( playerid, 10, 2020.5496,1007.7546,10.8203, 25, 0 ); //casino enter 2
    SetPlayerMapIcon( playerid, 11, 2166.1421,2164.9917,10.8203, 25, 0 ); //casino enter 3
    SetPlayerMapIcon( playerid, 12, 2162.9590,2070.8481,10.8203, 25, 0 ); //casino enter 4
    //SetPlayerMapIcon( playerid, 13, 2440.9717,2376.7434,11.2572, 40, 0 ); // lvpd
    return 1;
}

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_PASSWORD, ""COL_WHITE"Registration",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Enter your password below to register","Register","Exit");
                //DO whatever you do in /register
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully registered!","Ok","");
            }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if(response)
            {
                //Check for password and make login system
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");
            }
        }
    }
    return 1;
}
I found something interesting from my script down too:

Код:
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);
    
	
	return SystemMsg(playerid,"Your Account has been created. Login with /login password now to log in (Before Spawn)");
    
      } 
	return true;

 }
 
  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");
        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");

        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");
 }
Thanks for your reply and help in advance.

Sincerely: CrossUSAAF.
Reply
#2

This looks like impossible, nobody knows.
Reply
#3

I'm so sorry, but, I think I need to give up this scripting. I'm so tired.

Sincerely: CrossUSAAF.
Reply
#4

I'M SO SORRY I CANT HELP YOU
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)