how does i make auto login and login before spawn ?
#6

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.
		}
	}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)