Auto login
#1

Hello,

My OnPlayerAutoLogin funtion doesn't work. It will show the "Enter password" dialog if I join the server.

I think this is wrong: if(!strcmp(AccountInfo[playerid][aIP], PlayerIP))

Thanks for helping!

Battleman


OnPlayerConnect
Код:
public OnPlayerConnect(playerid)
{
	GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
	AccountInfo[playerid][aIP]=PlayerIP;

	return 1;
}
OnPlayerRequestClass
Код:
public OnPlayerRequestClass(playerid, classid)
{
	if(IsUserNameAvailable(PlayerName[playerid]))
	{
	    if(OnPlayerAutoLogin(playerid))
	    {
         	LoadPlayer(playerid);
	        return SpawnPlayer(playerid);
	    }
		ShowPlayerDialog(playerid,DIALOGID+1,DIALOG_STYLE_MSGBOX,ServerInfo[sName],"The system found an account by your nickname. \nYou have to login to continue.","Login","Quit");
	}else{
		ShowPlayerDialog(playerid,DIALOGID+2,DIALOG_STYLE_MSGBOX,ServerInfo[sName],"The system didn't found an account by your nickname. You can play with or without an account. \nIf you don't register, you stats won't be restored. If you register your stats will be stored. \nPlease make your choice.","Register","Don't Reg.");
	}
	return 1;
}
My OnPlayerAutoLogin
Код:
stock OnPlayerAutoLogin(playerid)
{
	format(File, sizeof(File), "/accountfiles/%s.sav", PlayerName[playerid]);
	AutoLogin = dini_Int(File, "AutoLogin");
	if(AutoLogin)
	{
		GetPlayerIp(playerid, PlayerIP, sizeof(PlayerIP));
		AccountInfo[playerid][aIP] = dini_Int(File, "IP");
		if(!strcmp(AccountInfo[playerid][aIP], PlayerIP))
		{
			return 1;
		}
	}
	return 0;
}
Reply


Messages In This Thread
Auto login - by Battleman - 01.01.2011, 22:52
Re: Auto login - by Marty_Alex - 01.01.2011, 22:57
Re: Auto login - by Battleman - 01.01.2011, 23:59
Re: Auto login - by Ironboy - 02.01.2011, 05:37
Re: Auto login - by Yagoda - 02.01.2011, 06:15
Re: Auto login - by Battleman - 02.01.2011, 12:50
Re: Auto login - by BlackBank - 02.01.2011, 14:04
Re: Auto login - by JaTochNietDan - 02.01.2011, 14:09
Re: Auto login - by Battleman - 02.01.2011, 22:48
Re: Auto login - by JaTochNietDan - 02.01.2011, 22:53

Forum Jump:


Users browsing this thread: 4 Guest(s)