23.05.2017, 15:12
Hello there i have a problem with this query.
When a player join the server the system will
check automatically if he/she is banned or not.
So the problem is that now, when a player join the
server in my server-log.txt appears this error:
BanListCheck function:
This function is called at OnPlayerConnect public, just here:
I don't know how to fix this. If you can help me please reply.
I am using: MySQL R41-2.
When a player join the server the system will
check automatically if he/she is banned or not.
So the problem is that now, when a player join the
server in my server-log.txt appears this error:
PHP код:
[OnQueryError (1065, Query was empty, BanListCheck)]
PHP код:
function BanListCheck( playerid )
{
eString[ 0 ] = EOS;
new count_rows, bField[ 4 ][ 512 ], query[ 1000 ], Days[ 4 ];
cache_get_row_count( count_rows );
if( count_rows )
{
cache_get_value_int( 0, "BanExpire", Days[ 0 ] );
cache_get_value_name( 0, "Reason", bField[ 0 ] );
cache_get_value_name( 0, "Admin", bField[ 1 ] );
cache_get_value_name( 0, "BanDate", bField[ 2 ] );
cache_get_value_name( 0, "BanTime", bField[ 3 ] );
Days[ 1 ] = gettime( );
Days[ 2 ] = Days[ 0 ] - Days[ 1 ];
Days[ 3 ] = floatround( ( ( Days[ 2 ] / 24 ) /60 ) / 60 );
if( Days[ 0 ] == -1 )
{
for( new i = 0; i < 30; i ++ )
SendClientMessage( playerid, ~1, " " );
format( eString, sizeof( eString ), "{FF1C1C}You are banned on this server !\n\n{FFFFFF}Nickname: {41C63F}%s\n\n{FFFFFF}IP: {D6D6D6}%s\n\n{FFFFFF}Banned by: {FF1C1C}%s\n\n{FFFFFF}Reason: {41C63F}%s\n\n\
{FFFFFF}Ban Date: {41C63F}%s\n\n{FFFFFF}Ban Time: {41C63F}%s\n\n{FFFFFF}Ban Days: {41C63F}Permanent\n\n{FFFFFF}If you want to get unbanned visit {FF1C1C}<< www.hype-zone.ro >>\n{FF1C1C}** {FFFFFF}Take a screenshot to this dialog.", PlayerName( playerid ), GetPlayerIPEx( playerid ), bField[ 1 ], bField[ 0 ], bField[ 2 ], bField[ 3 ] );
ShowPlayerDialog( playerid, DIALOG_COMMON, DIALOG_STYLE_MSGBOX, "{FFFFFF}Ban Details:", eString, "OK", "");
KickEx( playerid );
}
else if( gettime( ) >= Days[ 0 ] )
{
mysql_format( database, query, sizeof( query ), "UPDATE `Bans` SET `BanExpire` = '0' WHERE `Name` = '%s'", PlayerName( playerid ) );
mysql_tquery( database, query, "", "" );
}
else if( Days[ 3 ] > 0 )
{
for( new i = 0; i < 30; i ++ )
SendClientMessage( playerid, ~1, " " );
format( eString, sizeof( eString ), "{FF1C1C}You are banned on this server !\n\n{FFFFFF}Nickname: {41C63F}%s\n\n{FFFFFF}IP: {D6D6D6}%s\n\n{FFFFFF}Banned by: {FF1C1C}%s\n\n{FFFFFF}Reason: {41C63F}%s\n\n\
{FFFFFF}Ban Date: {41C63F}%s\n\n{FFFFFF}Ban Time: {41C63F}%s\n\n{FFFFFF}Banned for: {41C63F}%d day(s)\n\n\
{FFFFFF}If you want to get unbanned visit {FF1C1C}<< www.hype-zone.ro >>\n{FF1C1C}** {FFFFFF}Take a screenshot to this dialog.", PlayerName( playerid ), GetPlayerIPEx( playerid ), bField[ 1 ], bField[ 0 ], bField[ 2 ], bField[ 3 ], Days[ 3 ]);
ShowPlayerDialog( playerid, DIALOG_COMMON, DIALOG_STYLE_MSGBOX, "{FFFFFF}Ban Details:", eString, "OK", "");
KickEx( playerid );
}
}
return 1;
}
PHP код:
public OnPlayerConnect( playerid )
{
new conn_ip[ 16 ];
GetPlayerIp( playerid, conn_ip, 16 );
new query[ 1000 ];
mysql_format( database, query, sizeof( query ), "SELECT * FROM `Bans` WHERE `IP` LIKE '%%%s%%%' OR `Name` = '%s'", conn_ip, PlayerName( playerid ) );
mysql_tquery( database, query, "BanListCheck", "i", playerid );
.
.
.
bla bla
return 1;
}
I am using: MySQL R41-2.