Convert from Mysql R6 to R8 Help
#1

Hello, while i was trying to update my ban system to R8 there was an issue with checking on player connect if player is banned.

Could it be with the Mysql_function_query?

My code to onplayerconnect:
pawn Код:
IsPlayerBanned(playerid);
My Code on stock IsPlayerBanned(playerid)
pawn Код:
stock IsPlayerBanned(playerid)
{
    new IP[16], String[128], Query[128], reason[64], admin[32], i[128], seconds, banid[100];
    GetPlayerIp(playerid, IP, sizeof(IP));
    format(Query, sizeof(Query), "SELECT * FROM `Bans` WHERE (`Username` = '%s' OR `IP` = '%s') AND `Banned` = 1 LIMIT 1", GetName(playerid), IP);
    mysql_function_query(g_Handle, Query, true, "", "d", playerid);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        while(mysql_fetch_row_format(Query, "|"))
        {
            mysql_fetch_field_row(i, "Reason"); format(reason, sizeof(reason), i);
            mysql_fetch_field_row(i, "Seconds"); seconds = strval(i);
            mysql_fetch_field_row(i, "Admin"); format(admin, sizeof(admin), i);
            mysql_fetch_field_row(i, "BanID"); format(banid, sizeof(banid), i);
        }
        if(seconds > gettime())
        {
            format(String, sizeof(String), "The reason why you were banned: %s", reason);
            SendClientMessage(playerid, COLOR_RED, String);
            format(String, sizeof(String), "Your ban id is: %s", banid);
            SendClientMessage(playerid, COLOR_RED, String);
            SendClientMessage(playerid, COLOR_RED, "You are still banned from this server. Do not attempt to play unless you have been unbanned.");
            format(String, sizeof(String), "You'll be unbanned in: %s.", timec(gettime()-(gettime()-seconds)));
            SendClientMessage(playerid, COLOR_RED, String);
            SendClientMessage(playerid, COLOR_RED, "If you attempt to, you might get rebanned for trying to 'ban evade.'");
            SendClientMessage(playerid, COLOR_RED, "If you feel that you have been unfairly banned, please visit our website to appeal the ban.");
            SetTimerEx("PublicKick", 1, 0, "d", playerid);
        }
        else
        {
            format(Query, sizeof(Query), "UPDATE `Bans` SET `Banned` = 0 WHERE `Username` = '%s'", GetName(playerid));
            mysql_function_query(g_Handle, Query, true, "", "d", playerid);
            format(String, sizeof(String), "%s (%i) has been unbanned from the server!", GetName(playerid), playerid);
            SendClientMessageToAll(COLOR_GREEN, String);
        }
    }
    mysql_free_result();
    return 1;
}
Does anyone see where the issue may cause?
Reply
#2

R7, R8 and some other versions support only threaded queries.
Reply
#3

But how do i change it to threaded queries? And is there any place where i can read more about threaded queries?
Reply
#4

This tutorial will help you, this is where I learned to use MySQL!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)