Registration bug [+Rep if helped]
#1

When I log into the server, the registration dialog pops up which is correct:



Then this pops up, which is not meant to:



Code:

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

	if(dialogid == 0)
 	{
  		if (!response) return Kick(playerid);

		if(response)
		{
			if(!strlen(inputtext)) return ShowDialog(playerid, 0);

			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, "Tut", 0);
			INI_WriteInt(File, "Level", 1);
			INI_WriteInt(File, "ConnectTime", 0);
			INI_WriteInt(File, "Age", 0);
			INI_WriteInt(File, "Skin", 0);
			INI_WriteInt(File, "Internet", 0);
			INI_WriteInt(File, "HasCellphone", 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", 70);
			INI_WriteInt(File, "BankMoney", 130);

			INI_WriteInt(File, "Mask", 0);
			INI_WriteInt(File, "MaskID", 0);
			INI_WriteInt(File, "PhoneNumber", 0);
			INI_WriteInt(File, "HouseOwner", 9999);
			INI_WriteInt(File, "HouseHey", Invalid_House_ID);
			INI_WriteInt(File, "HouseKey2", Invalid_House_ID);
			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);
			ShowDialog(playerid, 2);
		}
	}
	
	else if(dialogid == 1) // Login
	{
   		if(response)
     	{
      		if(udb_hash(inputtext) == PlayerInfo[playerid][Pass])
      		{
        		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        		GivePlayerMoney(playerid, PlayerInfo[playerid][HandMoney]);
        		SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
        		SpawnPlayer(playerid);
        		SetCameraBehindPlayer(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");
       		}
        }
	}
I put on the end of Dialog - 0 (Registration) - ShowDialog(playerid, 2);
Which states to go to Male/Female, and it seems it is not doing.
Reply
#2

hmm that pics is not uploaded correctly upload them again
Edit where is the response of dialog id 2 ??
Reply
#3


Reply
#4

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

	if(dialogid == 0)
 	{
  		if (!response) return Kick(playerid);

		if(response)
		{
			if(!strlen(inputtext)) return ShowDialog(playerid, 0);

			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, "Tut", 0);
			INI_WriteInt(File, "Level", 1);
			INI_WriteInt(File, "ConnectTime", 0);
			INI_WriteInt(File, "Age", 0);
			INI_WriteInt(File, "Skin", 0);
			INI_WriteInt(File, "Internet", 0);
			INI_WriteInt(File, "HasCellphone", 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", 70);
			INI_WriteInt(File, "BankMoney", 130);

			INI_WriteInt(File, "Mask", 0);
			INI_WriteInt(File, "MaskID", 0);
			INI_WriteInt(File, "PhoneNumber", 0);
			INI_WriteInt(File, "HouseOwner", 9999);
			INI_WriteInt(File, "HouseHey", Invalid_House_ID);
			INI_WriteInt(File, "HouseKey2", Invalid_House_ID);
			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);
			ShowDialog(playerid, 2);
		}
	}
	
	else if(dialogid == 1) // Login
	{
   		if(response)
     	{
      		if(udb_hash(inputtext) == PlayerInfo[playerid][Pass])
      		{
        		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        		GivePlayerMoney(playerid, PlayerInfo[playerid][HandMoney]);
        		SetSpawnInfo(playerid, 0, 0, 0.00, 0.00, 0.00, 0.00, 0, 0, 0, 0, 0, 0);
        		SpawnPlayer(playerid);
        		SetCameraBehindPlayer(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");
       		}
        }
	}
	else if(dialogid == 2) // Male or Female
	{
	    if(response)
	    {
     		switch(listitem)
       		{
				case 0:
				{
					PlayerInfo[playerid][Gender] = 1;
					SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male.");
				}
				case 1:
				{
    				PlayerInfo[playerid][Gender] = 2;
    				SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female.");
				}
    		}
    	}
     	else
   		{
     		switch(listitem)
       		{
				case 0:
				{
					PlayerInfo[playerid][Gender] = 1;
					SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to male, pick their age from the next dialog.");
				}
				case 1:
				{
    				PlayerInfo[playerid][Gender] = 2;
				    SendClientMessage(playerid, COLOR_LIGHTRED, "SERVER: {FFFFFF}You've set your character's gender to female, pick her age from the next dialog.");
				}
    		}
      		ShowDialog(playerid, 3);
        }
	}
Reply
#5

Why does this happen?
Reply
#6

pawn Код:
if(udb_hash(inputtext) == PlayerInfo[playerid][Pass])
I wonder if they both don't have similar size, they won't work. Use strcmp.
Reply
#7

They do have similar size but I am not sure how to use strcmp could you help us?
Reply
#8

Like this
Код:
if(strcmp(udb_hash(inputtext),PlayerInfo[playerid][Pass],true))
Reply
#9

Don't I have to re-write the saving system/registration to strcmp?

I also get:

Quote:

(658-731) : error 035: argument type mismatch (argument 1)

Reply
#10

strcmp is a ctype function to compare strings if there is any need in saving /register system for comparing strings you have to use it
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)