SELECT not work.
#1

The function below does not work!
To OnPlayerConnect:
Код HTML:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE IP = '%s' AND `Player` = '%e'", playerIP, GetName(playerid));
    mysql_query(MySQLCon, query);
    if(cache_num_rows())
    {
        SetTimerEx("KickPublic", 50, false, "i", playerid);
        return 1;
    }
The player is named and IP in "bans" table and but still may enter.
Reply
#2

1. Add printf( query ) and check if your query is correct
2. Make sure you have "public KickPublic()" somewhere. If is not defined anywhere, it will ignored silently.

I guess you should simply add this somewhere:
PHP код:
forward KickPublicplayerid );
public 
KickPublicplayerid ) {
    
Kickplayerid );

Reply
#3

pawn Код:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE IP = '%s' AND `Player` = '%e'", playerIP, GetName(playerid));
new Cache:result = mysql_query(MySQLCon, query);
if(cache_num_rows() > 0)
{
    SetTimerEx("KickPublic", 50, false, "i", playerid);
    return 1;
}
cache_delete(result);
Or

pawn Код:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE IP = '%s' AND `Player` = '%e'", playerIP, GetName(playerid));
mysql_tquery(MySQLCon, query, "OnBanCheck", "i", playerid);


forward OnBanCheck(playerid);
public OnBanCheck(playerid)
{
    if(cache_num_rows() > 0)
    {
        SetTimerEx("KickPublic", 50, false, "i", playerid);
        return 1;
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
pawn Код:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE IP = '%s' AND `Player` = '%e'", playerIP, GetName(playerid));
new Cache:result = mysql_query(MySQLCon, query);
if(cache_num_rows() > 0)
{
    SetTimerEx("KickPublic", 50, false, "i", playerid);
    return 1;
}
cache_delete(result);
Or

pawn Код:
mysql_format(MySQLCon, query, sizeof(query), "SELECT * FROM bans WHERE IP = '%s' AND `Player` = '%e'", playerIP, GetName(playerid));
mysql_tquery(MySQLCon, query, "OnBanCheck", "i", playerid);


forward OnBanCheck(playerid);
public OnBanCheck(playerid)
{
    if(cache_num_rows() > 0)
    {
        SetTimerEx("KickPublic", 50, false, "i", playerid);
        return 1;
    }
    return 1;
}
Thank you very much, +1 REP.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)