Register Age
#1

I have made a Registration System and added 'Age' into it and when I register in game, the AGE dialog does not pop up after Gender.

Code:

Код:
    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, "ConnectTime", 0);
			    INI_WriteInt(File, "Age", 0);
			    INI_WriteInt(File, "Skin", 0);
			    INI_WriteInt(File, "Exp", 0);
			    INI_WriteInt(File, "Gender", 0);
			    INI_WriteInt(File, "Registered", 0);

				INI_WriteFloat(File, "Armour", 10);
				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", 0);
			    INI_WriteInt(File, "PhoneNumber", 0);
			    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) == PlayerInfo[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, PlayerInfo[playerid][lvDay], PlayerInfo[playerid][lvMonth], PlayerInfo[playerid][lvYear], PlayerInfo[playerid][lvHour], PlayerInfo[playerid][lvMinute], PlayerInfo[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;
            }
        }

		case DIALOG_GENDER:
		{
			if(response)
	        {
	            switch(listitem)
	            {
	                case 0:
					{
						PlayerInfo[playerid][Gender] = 1;
						SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You have defined your gender to be male.");
						SetPlayerSkin(playerid, 291);
					}

	                case 1:
					{
						PlayerInfo[playerid][Gender] = 2;
						SendClientMessage(playerid, 0x46E850FF, "SERVER:{FFFFFF} You have defined your gender to be female.");
						SetPlayerSkin(playerid, 233);
					}
	            }
    	        new stringdiag[410];
	        	ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_LIST, "{33CCFF}What is your characters age? - BlueBerry Roleplay", stringdiag, "Submit", "");
	        }
		}
		
		case DIALOG_AGE:
	    {
		    if(response)
		    {
				new stringdiag2[410];
				new tmp2[256];
				new playername2[MAX_PLAYER_NAME];
				for(new x=1;x<11;x++)
				{
					format(stringdiag2, sizeof(stringdiag2), "%s%d\n", stringdiag2, x);
				}
	      		PlayerInfo[playerid][Age] = listitem+15;
				format(string, sizeof(string), "Ok, so you are %d year old.",PlayerInfo[playerid][Age]);
				SendClientMessage(playerid, COLOR_LIGHTRED, string);
				format(tmp2, sizeof(tmp2), "~w~Welcome~n~~y~%s~n~~h~~b~BlueBerryRoleplay.com", playername2);
				GameTextForPlayer(playerid, tmp2, 5000, 1);
			}
			else
			{
			    ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_LIST, "{33CCFF}What is your characters age? - BlueBerry Roleplay", string, "Submit", "");
			}
		}
Reply
#2

You're not calling the dialog. Use ShowPlayerDialog (https://sampwiki.blast.hk/wiki/ShowPlayerDialog).
Also, don't use udb_hash. It's insecure and easy to crack.
Reply
#3

Could you help me then, VIA teamviewer or such?
Reply
#4

Because, it seems I cannot get this to work.
Reply
#5

All you have to do is instead of spawning the player at the end of the register dialog, you spawn him at the end of the gender or age dialog. You then call the age or gender dialog at the end of the register dialog.
Reply
#6

All I have to do is place, SpawnPlayer(playerid); at the end of the AGE dialog? But when I do, nothing comes up when I register
Reply
#7

Because you have to add ShowPlayerDialog at the end of the register dialog. You have to call the dialog for it to show.

> Finish register dialog
> Call next dialog
> Finish next dialog
> Call another or spawn
> ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)