SA-MP Forums Archive
MySQL ban not loading on connect? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL ban not loading on connect? (/showthread.php?tid=425269)



MySQL ban not loading on connect? - FunnyBear - 25.03.2013

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