Password
#3

Oh yea sorry
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new string[128], pname[MAX_PLAYER_NAME+1];
	GetPlayerName(playerid, pname, sizeof(pname));

    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);

            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Register", "Type your password below to register a new account.", "Register", "Quit");

                new INI:File = INI_Open(UserPath(playerid));

				new rand1 = random(99999), rand2 = random(99999);

                INI_SetTag(File, "Player Data");
                
                INI_WriteInt(File, "Password", udb_hash(inputtext));
			    INI_WriteInt(File, "Admin", 0);
			    INI_WriteInt(File, "Level", 1);
			    INI_WriteInt(File, "Skin", 0);
			    INI_WriteInt(File, "Exp", 0);
			    INI_WriteInt(File, "Gender", 0);
			    INI_WriteInt(File, "Registered", 0);

				INI_WriteFloat(File, "Armour", 0);
				INI_WriteFloat(File, "Health", 100);
				
			    INI_WriteInt(File, "Faction", 0);
			    INI_WriteInt(File, "FactionTier", 0);
			 	INI_WriteString(File, "FactionRank", "None");

				INI_WriteInt(File, "HandMoney", 0);
				INI_WriteInt(File, "BankMoney", 0);
				
				INI_WriteInt(File, "Mask", 0);
			    INI_WriteInt(File, "MaskID", rand1);
			    INI_WriteInt(File, "PhoneNumber", rand2);
			    INI_WriteInt(File, "HouseOwner", 9999);
			    INI_WriteInt(File, "VehicleOwner", 9999);
			    INI_WriteInt(File, "BizOwner", 9999);

			    INI_WriteInt(File, "Weapon1", 0);
			    INI_WriteInt(File, "Wep1Ammo", 0);
			    INI_WriteInt(File, "Weapon2", 0);
			    INI_WriteInt(File, "Wep2Ammo", 0);
			    INI_WriteInt(File, "Weapon3", 0);
			    INI_WriteInt(File, "Wep3Ammo", 0);
			    INI_WriteInt(File, "Weapon4", 0);
			    INI_WriteInt(File, "Wep4Ammo", 0);
			    INI_WriteInt(File, "Weapon5", 0);
			    INI_WriteInt(File, "Wep5Ammo", 0);

			    INI_WriteInt(File, "lvDay", 0);
			    INI_WriteInt(File, "lvMonth", 0);
			    INI_WriteInt(File, "lvYear", 0);
			    INI_WriteInt(File, "lvHour", 0);
			    INI_WriteInt(File, "lvMinute", 0);
			    INI_WriteInt(File, "lvSecond", 0);

				INI_WriteInt(File, "LastPos", 0);
				INI_WriteInt(File, "LastVW", 0);
				INI_WriteInt(File, "LastInt", 0);
			    INI_WriteFloat(File, "LastX", 0);
			    INI_WriteFloat(File, "LastY", 0);
			    INI_WriteFloat(File, "LastZ", 0);

                INI_Close(File);

				format(string, sizeof(string), "SERVER:{FFFFFF} Welcome to the server, %s!", pname);
				SendClientMessage(playerid, 0x46E850FF, string);

				SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
                SpawnPlayer(playerid);
			}
        }

        case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);

            if(response)
            {
                if(udb_hash(inputtext) == pInfo[playerid][Pass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

					format(string, sizeof(string), "SERVER:{FFFFFF} Welcome back, %s! You last logged in at %d/%d/%d %d:%d:%d.", pname, pInfo[playerid][lvDay], pInfo[playerid][lvMonth], pInfo[playerid][lvYear], pInfo[playerid][lvHour], pInfo[playerid][lvMinute], pInfo[playerid][lvSecond]);
					SendClientMessage(playerid, 0x46E850FF, string);

					Logged[playerid] = true;

					SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
                	SpawnPlayer(playerid);
                }

                else ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", "{FFFFFF}You have entered an {C44B4B}incorrect{FFFFFF} password.\nType your password below to login.", "Login", "Quit");

                return 1;
            }
        }
Reply


Messages In This Thread
Password - by CSLangdale - 06.04.2016, 18:43
Re: Password - by Lucky13 - 06.04.2016, 18:48
Re: Password - by CSLangdale - 06.04.2016, 18:56
Re: Password - by Lucky13 - 06.04.2016, 19:00
Re: Password - by CSLangdale - 06.04.2016, 19:08
Re: Password - by Lucky13 - 06.04.2016, 19:09
Re: Password - by CSLangdale - 06.04.2016, 19:14
Re: Password - by Lucky13 - 06.04.2016, 19:16
Re: Password - by CSLangdale - 06.04.2016, 19:19
Re: Password - by Lucky13 - 06.04.2016, 19:24

Forum Jump:


Users browsing this thread: 2 Guest(s)