Код:
public OnPlayerConnect( playerid )
{
format( gsQuery, 128, "SELECT * FROM `Banlist` WHERE `IP` = '%s' OR `Name` = '%s'", GetPlayerIPEx( playerid ), PlayerName( playerid ) );
mysql_function_query( g_Handle, gsQuery, true, "BanListCheck", "i", playerid );
return 1;
}
Callback:
Код:
SQL_Function BanListCheck( playerid )
{
if ( !IsPlayerConnected( playerid ) )
return 1;
new count_rows, fields;
cache_get_data( count_rows, fields, g_Handle );
if ( !count_rows )
OnPlayerConnectEx( playerid );
else
{
new bField[ 6 ][ 128 ];
cache_get_field_content( 0, "Reason", bField[ 0 ] );
cache_get_field_content( 0, "Admin", bField[ 1 ] );
cache_get_field_content( 0, "BanDate", bField[ 2 ] );
cache_get_field_content( 0, "BanTime", bField[ 3 ] );
cache_get_field_content( 0, "BanDays", bField[ 4 ] );
cache_get_field_content( 0, "Aproove", bField[ 5 ] );
if ( strval( bField[ 4 ] ) < getdate( ) )
OnPlayerConnectEx( playerid );
else
{
if ( strval( bField[ 5 ] ) != 0 )
OnPlayerConnectEx( playerid );
else
{
TextDrawShowForPlayer( playerid, Ban_Backround );
TextDrawShowForPlayer( playerid, Ban_Info );
TextDrawShowForPlayer( playerid, Ban_Message );
TextDrawShowForPlayer( playerid, Ban_Details_TD );
TextDrawShowForPlayer( playerid, Ban_Mistake );
format( gsString, 512, "~y~~h~Banned by Administrator: %s~n~Ban Date: %s~n~Ban Time: %s~n~Ban Reason: %s", bField[ 1 ], bField[ 2 ], bField[ 3 ], bField[ 0 ] );
TextDrawSetString( Ban_Details[ playerid ], gsString );
TextDrawShowForPlayer( playerid, Ban_Details[ playerid ] );
SetTimerEx( "KickPlayer", 3500, false, "e", playerid );
}
}
}
return 1;
}
- After this callback is called, my server getting a nice crash ...