05.01.2012, 17:33
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; } }