Query was empty
#1

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:

PHP код:
[OnQueryError (1065Query was empty, BanListCheck)] 
BanListCheck function:
PHP код:
function BanListCheckplayerid )
{
    
eString] = EOS;
    new 
count_rowsbField][ 512 ], query1000 ], Days];
    
cache_get_row_countcount_rows );
    if( 
count_rows )
    {
         
cache_get_value_int0"BanExpire"Days] );
        
cache_get_value_name0"Reason"bField] );
        
cache_get_value_name0"Admin"bField] );
        
cache_get_value_name0"BanDate"bField] );
        
cache_get_value_name0"BanTime"bField] );
        
Days] = gettime( );
        
Days] = Days] - Days];
        
Days] = floatround( ( ( Days] / 24 ) /60 ) / 60 );
        if( 
Days] == -)
        {
              for( new 
030++ )
                
SendClientMessageplayerid, ~1" " );
            
formateStringsizeofeString ), "{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."
PlayerNameplayerid ), GetPlayerIPExplayerid ), bField], bField], bField], bField] );
            
ShowPlayerDialogplayeridDIALOG_COMMONDIALOG_STYLE_MSGBOX"{FFFFFF}Ban Details:"eString"OK""");
            
KickExplayerid );
        }
        else if( 
gettime( ) >= Days] )
        {
            
mysql_formatdatabasequerysizeofquery ), "UPDATE `Bans` SET `BanExpire` = '0' WHERE `Name` = '%s'"PlayerNameplayerid ) );
            
mysql_tquerydatabasequery"""" );
        }
        else if( 
Days] > )
        {
              for( new 
030++ )
                
SendClientMessageplayerid, ~1" " );
              
formateStringsizeofeString ), "{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."
PlayerNameplayerid ), GetPlayerIPExplayerid ), bField], bField], bField], bField], Days]);
            
ShowPlayerDialogplayeridDIALOG_COMMONDIALOG_STYLE_MSGBOX"{FFFFFF}Ban Details:"eString"OK""");
            
KickExplayerid );
        }
    }
    return 
1;

This function is called at OnPlayerConnect public, just here:
PHP код:
public OnPlayerConnectplayerid )
{
     new 
conn_ip16 ];
    
GetPlayerIpplayeridconn_ip16 );
    new 
query1000 ];
    
mysql_formatdatabasequerysizeofquery ), "SELECT * FROM `Bans` WHERE `IP` LIKE '%%%s%%%' OR `Name` = '%s'"conn_ipPlayerNameplayerid ) );
    
mysql_tquerydatabasequery"BanListCheck""i"playerid );
    
    .
    .
    .
    
    
bla bla
    
return 1;

I don't know how to fix this. If you can help me please reply.
I am using: MySQL R41-2.
Reply
#2

Bump
Reply
#3

Someone ? I need to fix that.. please help.
Reply
#4

pawn Код:
%%%s%%%
?

And why are you using LIKE for this ?
Like will check if there are names or ips similar to the ones you are looking for.

Try this

pawn Код:
SELECT * FROM Bans WHERE IP='%e' OR Name='%e' LIMIT 1
and please provide log file if this doesn't resolve the issue.
and for the further usage use %e instead of %s parameter while formating a query, it's safer.
Reply
#5

PHP код:
%%%s%%% 
only need two in last ->
PHP код:
%%%s%% 
also print your querys to see if they contain anything

PHP код:
public OnPlayerConnectplayerid 

     new 
conn_ip16 ]; 
    
GetPlayerIpplayeridconn_ip16 ); 

    new 
query1000 ]; 
    
mysql_formatdatabasequerysizeofquery ), "SELECT * FROM `Bans` WHERE `IP` LIKE '%%%s%%' OR `Name` = '%s'"conn_ipPlayerNameplayerid ) ); 
    
printf("Query1: %s",query);
    
mysql_tquerydatabasequery"BanListCheck""i"playerid ); 
     
    . 
    . 
    . 
     
    
bla bla 
    
return 1

PHP код:
function BanListCheckplayerid 

    
eString] = EOS
    new 
count_rowsbField][ 512 ], query1000 ], Days]; 
    
cache_get_row_countcount_rows ); 

    if( 
count_rows 
    { 
         
cache_get_value_int0"BanExpire"Days] ); 
        
cache_get_value_name0"Reason"bField] ); 
        
cache_get_value_name0"Admin"bField] ); 
        
cache_get_value_name0"BanDate"bField] ); 
        
cache_get_value_name0"BanTime"bField] ); 

        
Days] = gettime( ); 
        
Days] = Days] - Days]; 
        
Days] = floatround( ( ( Days] / 24 ) /60 ) / 60 ); 

        if( 
Days] == -
        { 
              for( new 
030++ ) 
                
SendClientMessageplayerid, ~1" " ); 

            
formateStringsizeofeString ), "{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."
PlayerNameplayerid ), GetPlayerIPExplayerid ), bField], bField], bField], bField] ); 
            
ShowPlayerDialogplayeridDIALOG_COMMONDIALOG_STYLE_MSGBOX"{FFFFFF}Ban Details:"eString"OK"""); 

            
KickExplayerid ); 
        } 
        else if( 
gettime( ) >= Days] ) 
        { 
            
mysql_formatdatabasequerysizeofquery ), "UPDATE `Bans` SET `BanExpire` = '0' WHERE `Name` = '%s'"PlayerNameplayerid ) ); 
            
printf("Query 2: %s",query);
            
mysql_tquerydatabasequery"""" ); 
        } 
        else if( 
Days] > 
        { 
              for( new 
030++ ) 
                
SendClientMessageplayerid, ~1" " ); 

              
formateStringsizeofeString ), "{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."
PlayerNameplayerid ), GetPlayerIPExplayerid ), bField], bField], bField], bField], Days]); 
            
ShowPlayerDialogplayeridDIALOG_COMMONDIALOG_STYLE_MSGBOX"{FFFFFF}Ban Details:"eString"OK"""); 

            
KickExplayerid ); 
        } 
    } 
    return 
1

Reply
#6

24 hour bumps only as well.
Reply
#7

Solved. Thank your guys.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)