SA-MP Forums Archive
how does i make auto login and login before spawn ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: how does i make auto login and login before spawn ? (/showthread.php?tid=145399)



how does i make auto login and login before spawn ? - reddead15 - 02.05.2010

how does i make auto login and login before spawn ?
my register sys from here
http://forum.sa-mp.com/index.php?topic=126584.0
help ?


Re: how does i make auto login and login before spawn ? - cloud9 - 02.05.2010

When they Join server Get their IP, and compare them with a IP saved in their file(you should do this when they register), if both are same the make them singin, if they are not prompt them for password, and when they successfully type the password change their last ip in the file to present ip.


Re: how does i make auto login and login before spawn ? - reddead15 - 02.05.2010

can give me some scripit 2 see how it looks



Re: how does i make auto login and login before spawn ? - reddead15 - 02.05.2010

pliz help



Re: how does i make auto login and login before spawn ? - DarrenReeder - 02.05.2010

Save the IP when they register... (and update when they login)...

then OnPlayerConnect, check if their ip is the same as one of the registerd account.. tis was explained by cloud9


Re: how does i make auto login and login before spawn ? - Deji - 02.05.2010

Replace all the dini code with whatever method you use for reading from files.

I assume you already have /register and /login commands. If not, try making them first.

Code:
	GetPlayerName(playerid, name, sizeof(name));	// Store the players name.
	format(file, sizeof(file), "%s.ini", name);	// Get .ini filename according to player name
	if(fexist(file))	// If the file exists...
	{
	  GetPlayerIp(playerid, ip, sizeof(ip));	// Get the players IP.
	  tmp = dini_Get(file, "ip");		// This one uses dini for simplicity. Replace with your own read_file code.
	  if(strval(tmp) != strval(ip))		// If the current IP does not == the one from the file...
	  {
		  SendClientMessage(playerid, COLOR_YELLOW, "That nick is registered. Please change name or /login");	// Tell them they need to log in manually.
		}
		else
		{
		  gPlayerLogged[playerid] = 1;	// Logged in variable.
		  SendClientMessage(playerid, COLOR_SUCCESS, "You have been automatically logged in.");	// Tell them they have been logged in.
		}
	}



Re: how does i make auto login and login before spawn ? - geerdinho8 - 02.05.2010

Im sure he will get error: Undefined Symbol name, nice copy and paste work fooll...


Re: how does i make auto login and login before spawn ? - Deji - 03.05.2010

Fool? At least I provided an example.. Not just a method that they probably won't understand.

All that needs doing is adding a couple of "new" commands. And I'm pretty sure they will already exist in the script anyway.