[MySql] Players boot data
#1

Is this code neat? Or for errors, if any, that you can submit revised code

Код:
stock LoginPlayer( playerid, password[ ] )
{
	// Funckija LoginPlayer( playerid, password[ ] )
	// Priskiriame zaidejui kintamuosius is duomenu bazes, jei irasytas
	// slaptazodis yra teisingas, jei ne, isspiriame ji is zaidimo.
	new
	    string	   [ 1000 ],
		pKey       [ 128  ],
		trash      [ 30 ],
		money,
		score,
		SQLID = MySQLNameCheck( PlayerName2( playerid ) );

	format( string, 2024, "SELECT * FROM `players` WHERE `id`=%d LIMIT 1", SQLID );

	mysql_query       ( string );
	mysql_store_result( );
	
	if ( !mysql_fetch_row( string ) )
	{
	    SendClientMessage( playerid, red, "Prisijungimo klaida #001" );
	    SendClientMessage( playerid, red, "Nerasti MySQL duomenys." );
		Kick( playerid );
	}
	
	sscanf( string, "p<|>{ds[24]}s[129]s[1000]", pKey,
	        string );
	        
	if ( !strcmp( pKey, password, true ) )
	{
		if ( sscanf( string, "p<|>s[20]ddddddddddddfffdd",
			trash,
			PlayerInfo[playerid][banned],
			PlayerInfo[playerid][Level],
			PlayerInfo[playerid][SEELevel],
			money,
   			score,
			PlayerInfo[playerid][Kills],
			PlayerInfo[playerid][Deaths],
   			PlayerInfo[playerid][GTLLevel],
   			PlayerInfo[playerid][SMPLevel],
   			PlayerInfo[playerid][LSTLevel],
   			PlayerInfo[playerid][TSGLevel],
   			PlayerInfo[playerid][eLevel],
   			PlayerInfo[playerid][Exp],
   			PlayerInfo[playerid][pos_x],
   			PlayerInfo[playerid][pos_y],
   			PlayerInfo[playerid][pos_z],
   			PlayerInfo[playerid][FavSkin],
   			PlayerInfo[playerid][rBan]
		 ) ) print ( "SSCANF FAIL" );
		 
		ResetPlayerMoney( playerid );
		GivePlayerMoney ( playerid, money );
		SetPlayerScore ( playerid, score );
		
		PlayerInfo[playerid][LoggedIn] = 1;
		PlayerInfo[playerid][Registered] = 1;
		return true;
	}
	else
	{
		return false;
	}
}
Reply


Messages In This Thread
[MySql] Players boot data - by [LTU]mindux9[TCS] - 05.01.2012, 17:33
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 06:49
Re: [MySql] Players boot data - by Joe_ - 06.01.2012, 09:16
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 10:44
Re: [MySql] Players boot data - by Joe_ - 06.01.2012, 11:03
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 11:10
Re: [MySql] Players boot data - by [HiC]TheKiller - 06.01.2012, 11:27
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 14:56
Re: [MySql] Players boot data - by [LTU]mindux9[TCS] - 06.01.2012, 14:59

Forum Jump:


Users browsing this thread: 4 Guest(s)