MySQL problem
#1

Hey, So. I have a ban command which updates the database when it's called. I've set it so it checks if someone is banned before they can connect. This works if the player is banned, If you're not banned. It's doesn't actually do anything. It just does nothing.

pawn Код:
mysql_format(SQL, query, sizeof(query), "SELECT * FROM `players` WHERE `username` = '%e' LIMIT 1", Player[playerid][Name]);
    mysql_tquery(SQL, query, "OnBanCheck", "d", playerid);
I have that, which leads to this.

pawn Код:
forward OnBanCheck(playerid);
public OnBanCheck(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, SQL);
    if(rows)
    {
        cache_get_field_content(0, "bannedby", Player[playerid][BannedBy], SQL, 24);
        cache_get_field_content(0, "reason", Player[playerid][BanReason], SQL, 20);
        Player[playerid][Banned] = cache_get_field_content_int(0, "banned");
       
        CheckBans(playerid);
    }
    return 1;
}
Then to this,

pawn Код:
stock CheckBans(playerid)
{
    if(Player[playerid][Banned] == 1)
    {
        new msg[24];
        SendClientMessage(playerid, -1, "SERVER: You're still banned!");
        format(msg, 24, "| Ban Reason: %s | Banned By: %s |", Player[playerid][BanReason],Player[playerid][BannedBy]);
        SendClientMessage(playerid, -1, msg);
        DelayedKick(playerid);
    }
    else if(Player[playerid][Banned] == 0)
    {
        new query[200];
        mysql_format(SQL, query, sizeof(query), "SELECT * FROM `players` WHERE `username` = '%e' LIMIT 1", Player[playerid][Name]);
        mysql_tquery(SQL, query,"OnPlayerDataLoaded", "dd", playerid, MysqlRaceCheck[playerid]);
    }
    return 1;
}
I think it's the query in the last part of the CheckBans stock. Anyone know the issue? It's like it doesn't call the OnPlayerDataLoaded callback.
Reply


Messages In This Thread
MySQL problem - by Keyhead - 02.11.2013, 21:47
Re: MySQL problem - by iJumbo - 02.11.2013, 22:01
Re: MySQL problem - by Keyhead - 02.11.2013, 22:03
Re: MySQL problem - by iJumbo - 02.11.2013, 22:07
Re: MySQL problem - by Keyhead - 02.11.2013, 22:14
Re: MySQL problem - by iJumbo - 02.11.2013, 22:17
Re: MySQL problem - by Keyhead - 02.11.2013, 22:22
Re: MySQL problem - by iJumbo - 02.11.2013, 22:45
Re: MySQL problem - by Keyhead - 02.11.2013, 22:57
Re: MySQL problem - by iJumbo - 02.11.2013, 23:02

Forum Jump:


Users browsing this thread: 2 Guest(s)