SA-MP Forums Archive
Register/Login dialog Help! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Server (https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: Register/Login dialog Help! (/showthread.php?tid=364067)



Register/Login dialog Help! - alanhutch - 29.07.2012

Hi all! I'm trying to make a system for Login and Register did Dialog, but I have a problem. As soon as I put the password and I click on Login or Register disappears, and does nothing. How do I fix this?
Here's the code:
Код:
public OnPlayerRequestClass(playerid, classid)
{
    if(IsPlayerNPC(playerid)) return 1;
	if(gPlayerLogged[playerid])
	{
		SpawnPlayer(playerid);
		OnPlayerSpawn(playerid);
		return 1;
	}
	LoginDialog(playerid);
	PlayerPlaySound(playerid, 1097, 2103.4822,1683.2051,11.5562);
	SetPlayerVirtualWorld(playerid,playerid);
	SetPlayerSkin(playerid,167);
	SetPlayerPos(playerid,-1493.1396,922.3882,28.9545);
	SetPlayerFacingAngle(playerid,93.0452);
	SetPlayerCameraPos(playerid, -1500.0691,920.3263,28.8823);
	SetPlayerCameraLookAt(playerid,-1500.0691,920.3263,28.8823);
	SetTimerEx("InizioAnim",1500,false,"i",playerid);
   	return 0;
}
Код:
forward LoginDialog(playerid);
public LoginDialog(playerid)
{
        new accstring[128];
		format(accstring, sizeof(accstring), "users/%s.ini", PlayerName(playerid));
		new File: hFile = fopen(accstring, io_read);
		if (hFile)
		{
			fclose(hFile);
			new name[MAX_PLAYER_NAME];
        	GetPlayerName(playerid, name, sizeof(name));
			new girismsg[256];
			format(girismsg,256,"{54da00}Benvenuto utente,{ffffff}Digita la {ff0000}tua password:");
			ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Esci");
		}
		else
	 	{
            new name[MAX_PLAYER_NAME];
        	GetPlayerName(playerid, name, sizeof(name));
			new kayitmsg[256];
			format(kayitmsg,256,"{54da00}Benvenuto utente,{ffffff}Digita la {ff0000}password desiderata:");
			ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrazione",kayitmsg,"Registrati","Esci");
		}
    	return 1;
}
Код:
else if(dialogid == 12345)
        {
				if (response == 1)
	    		{
					if(strlen(inputtext))
					{
            			OnPlayerRegister(playerid,inputtext);
            			OnPlayerLogin(playerid,inputtext);
					}
					else if(!strlen(inputtext))
					{
						new name[MAX_PLAYER_NAME];
						GetPlayerName(playerid, name, sizeof(name));
						new kayitmsg[256];
						format(kayitmsg,256,"Benvenuto utente\nDigita la password desiderata:");
						ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT,"Registrazione",kayitmsg,"Registrati","Esci");
					}
				}
				else
    			{
     				Kick(playerid);
			 	}
     	}
     	else if(dialogid == 12346)
     	{
        		if (response == 1)
	    		{
					if(strlen(inputtext))
        			{
						OnPlayerLogin(playerid,inputtext);
					}
					else if(!strlen(inputtext))
					{
						new name[MAX_PLAYER_NAME];
        				GetPlayerName(playerid, name, sizeof(name));
						new girismsg[256];
						format(girismsg,256,"Benvenuto utente\nDigita la tua password:");
						ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Esci");
					}
        		}
          		else
    			{
     				Kick(playerid);
			 	}
        }
        return 1;
}
It's in Italian. Sorry.


Re: Register/Login dialog Help! - Emmet_ - 29.07.2012

At the end of OnDialogResponse, change:

return 1;

to:

return 0;



Re: Register/Login dialog Help! - alanhutch - 29.07.2012

I tried, but nothing changes


Re: Register/Login dialog Help! - alanhutch - 29.07.2012

I found one right on the line of the Warning Dialog recording, this is, I do not know how to solve it:
warning 225: unreachable code


Re: Register/Login dialog Help! - x96664 - 29.07.2012

Did you create the "users" folder where it must save player data ?


Re: Register/Login dialog Help! - alanhutch - 29.07.2012

Quote:
Originally Posted by x96664
Посмотреть сообщение
Did you create the "users" folder where it must save player data ?
Yes!!