MySQL ban not loading on connect?
#1

Hello,

I just recently added a new MySQL ban system to my server. It works, but theres a problem. When I banned a person, they can still join and play on the server when they reconnect. I tried to fix it, but I can't seem to find the problem@

pawn Код:
stock CheckBan(playerid)
{
    new query[126], IP[16];
    GetPlayerIp(playerid, IP, sizeof(IP));
    format(query,sizeof(query),"SELECT * FROM 'bans' WHERE ('Name'  = '%s' OR 'IP' = '%s') AND 'Status' = 1", GetName(playerid), IP );
    mysql_query(query);
    mysql_store_result();

    new rows = mysql_num_rows();
    if(rows == 1)
    {
        new bReason[128], bannedBy[MAX_PLAYER_NAME], Dialog[128];
        while(mysql_fetch_row_format(query,"|"))
        {
            mysql_fetch_field_row(bReason, "Reason");
            mysql_fetch_field_row(bannedBy, "BannedBy");
            format(Dialog, sizeof(Dialog), "{FF0000}You are banned from this server! \n{FF0000}Name:{FFFFFF} %s \n{FF0000}Reason:{FFFFFF} %s \n{FF0000}Banned By:{FFFFFF} %s", GetName(playerid), bReason, bannedBy);
            ShowPlayerDialog(playerid, DIALOG_BAN, DIALOG_STYLE_MSGBOX, "{FF0000}Banned", Dialog, "Close", "");
        }
        return 1;
    }
    mysql_free_result();
    return 0;
}
Under onplayerconnect I have this:

pawn Код:
CheckBan(playerid);
So here is my problem. I tried banning myself, and the data goes to the database. But If I connect again, it just continues to play! So the ban is not loading! Please help

Please help me! Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)