Users Get Kicked Whether Banned Or Not
#1

Hello,

I am scripting a MySQL ban system for my server, and I am having an issue. It bans them properly, but upon logging in, it's supposed to check whether or not their name or IP is banned. If their ip or name is banned, they get kicked, if not, they are allowed to login.

My issue is that it is kicking players whether mysql_num_rows returns 0 or 1, so nobody is allowed to login.

pawn Код:
stock CheckIPBan(playerip[])
{
    new string[50];
    format(string,sizeof(string) ,"SELECT * FROM `Bans` WHERE `IP` = '%s'",playerip);
    mysql_function_query(MySQL, string, false, "SendQuery", "");
    if(mysql_num_rows ( ) != 0)
    {
        return 0;
    }
    else return 1;
}

stock CheckNameBan(playername[])
{
    new string[50], escape[MAX_PLAYER_NAME];
    mysql_real_escape_string(playername, escape);
    format(string, sizeof(string), "SELECT * FROM `Bans` WHERE `Username` = '%s'",escape);
    mysql_function_query(MySQL, string, false, "SendQuery", "");
    if(mysql_num_rows ( ) != 0)
    {
        return 0;
    }
    else return 1;
}

stock CheckBan(playerid)
{
    if(CheckNameBan(GetPName(playerid)) || CheckIPBan(PlayerIP[playerid]))
    {
        Kick(playerid);
    }
}
Thank you for having a look.
Reply


Messages In This Thread
Users Get Kicked Whether Banned Or Not - by Camacorn - 13.02.2013, 00:14
Re: Users Get Kicked Whether Banned Or Not - by FUNExtreme - 13.02.2013, 04:17

Forum Jump:


Users browsing this thread: 1 Guest(s)