Hey guys! Another V-Admin problem
#1

Ok, I need another help:
*Auto login isn't working
*It's marks my account unregistered, but I still can login.
*And maybe you'll find another mistakes..
Please help:
Код:
 	if(fexist(connect))
	{
	  #if AUTO_LOGIN_ENABLED
		new tmp[50],tmp2[256]; GetPlayerIp(playerid,tmp,50); tmp2 = dini_Get(connect,"IP");
		if(!strcmp(tmp,tmp2,true))
		{
		  format(string, sizeof(string), "Welcome back %s ! You have been automatically logged in by your IP. ", playrname);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			gPlayerLogged[playerid] = 1;
			new playername2[MAX_PLAYER_NAME];
  		GetPlayerName(playerid, playername2, sizeof(playername2));
			format(string2, sizeof(string2), "V-Admin/Users/%s.ini", playername2);
			new File: UserFile = fopen(string2, io_read);
			if ( UserFile )
			{
	  		new PassData[256];
	  		new keytmp[256], valtmp[256];
	  		 	fread( UserFile , PassData , sizeof( PassData ) );
	  		keytmp = ini_GetKey( PassData );
	  		if( strcmp( keytmp , "Password" , true ) == 0 )
				{
					valtmp = ini_GetValue( PassData );
					strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
			  		new key[ 256 ] , val[ 256 ];
			  		new Data[ 256 ];
			  		while ( fread( UserFile , Data , sizeof( Data ) ) )
					{
						key = ini_GetKey( Data );
			  			if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
			  			if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarns] = strval( val ); }
			  			if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
			  			if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
			    		if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
			    		if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
			    		if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
			    		if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
			   		if( strcmp( key , "TimesConnected" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTimes] = strval( val ); }
			    		if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHours] = strval( val ); }
			    		if( strcmp( key , "PlayingMinutes" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMins] = strval( val ); }
			    		if( strcmp( key , "DayRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate1] = strval( val ); }
		    			if( strcmp( key , "MonthRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate2] = strval( val ); }
		    		if( strcmp( key , "YearRegistered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDate3] = strval( val ); }
		    	}//end while
    				fclose(UserFile);//close the file after everything has been read in the while
    				gPlayerLogged[playerid] = 1;
				}
			}
		}
		else
		{
			gPlayerAccount[playerid] = 1;
			format(string, sizeof(string), "Welcome back %s ! Please use /login [password]", playrname);
			SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
			gPlayerLogged[playerid] = 0;
			return 1;
		}
	}
	else
	{
		gPlayerAccount[playerid] = 0;
    	format(string, sizeof(string),"Account %s does not exsits. Please use /register [password]", playrname);
		SendClientMessage(playerid, COLOR_LIGHTBLUE,string);
		gPlayerLogged[playerid] = 0;
		return 1;
	}
	#endif
	return 1;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)