#1

pawn Код:
if(mysql_num_rows() >= 1) {
                while(mysql_retrieve_row())
                {
                    new result[256], string[256];
                    mysql_fetch_field_row(result,"playerBanReason");
                    mysql_get_field("playerBanReason",result);
                    format(string,sizeof(string),"%s.",result);
                    SendClientMessage(extraid,COLOR_LIGHTRED,string);
                    Kick(extraid);
                }
            }

I just want to say the reason for ban . What's wrong with it?
Reply
#2

What's wrong with it?
Reply
#3

It doesn't show me the reason. Just "."[dot] .
Reply
#4

pawn Код:
format(queryString, sizeof(queryString), "SELECT `banID` FROM `bans` WHERE `IPBanned` = '%s'", playerIP);
    mysql_query(queryString, THREAD_CHECK_BANS_LIST, playerid);
And from OnQueryFinish:

pawn Код:
case THREAD_CHECK_BANS_LIST: {
            mysql_store_result();

            if(!IsPlayerConnected(extraid))
                return mysql_free_result();

            if(mysql_num_rows() >= 1) {
                new result[256], string[256], querySz[256], ipban[64];
                GetPlayerIp(extraid, ipban, sizeof(ipban));
                format(querySz, sizeof(querySz), "SELECT playerBanReason FROM bans WHERE IPBanned = '%s'", ipban);
                mysql_query(querySz);
                mysql_store_result();
                mysql_fetch_field_row(result,"playerBanReason");
                mysql_get_field("playerBanReason",result);
                format(string,sizeof(string),"%s.",result);
                SendClientMessage(extraid,COLOR_LIGHTRED,string);
                Kick(extraid);
            }
I tried this way too, but it didn't work.
Reply
#5

why are you sending 2 queries when you could send only one ? (do you need banid ?)

Also always free the result before storing another query

pawn Код:
.
    GetPlayerIp(playerid, ipban, sizeof(ipban));
    format(queryString, sizeof(queryString), "SELECT playerBanReason FROM bans WHERE IPBanned = '%s'", ipban);
    mysql_query(queryString, THREAD_CHECK_BANS_LIST, playerid);

pawn Код:
.
    case THREAD_CHECK_BANS_LIST: {
            mysql_store_result();

            if(!IsPlayerConnected(extraid))
                return mysql_free_result();

            if(mysql_num_rows() >= 1) {
                new result[128];
                mysql_fetch_field_row(result,"playerBanReason");
                format(string,sizeof(string),"Reason: %s.",result);
                SendClientMessage(extraid,COLOR_LIGHTRED,string);
                mysql_free_result();
                // perhaps adding a timer that calls kick is a good idea
                // since otherwise you'll be kicked too quickly and you won't see the ban message
                //Kick(extraid);
            }
Reply
#6

pawn Код:
format(queryString, sizeof(queryString), "SELECT `banID` FROM `bans` WHERE `IPBanned` = '%s'", playerIP);
    mysql_query(queryString, THREAD_CHECK_BANS_LIST, playerid);
pawn Код:
case THREAD_CHECK_BANS_LIST: {
            mysql_store_result();

            if(!IsPlayerConnected(extraid))
                return mysql_free_result();

            if(mysql_num_rows() >= 1) {
                new result[256], string[256], querySz[256], ipban[64];
                GetPlayerIp(extraid, ipban, sizeof(ipban));
                format(querySz, sizeof(querySz), "SELECT playerBanReason FROM bans WHERE IPBanned = '%s'", ipban);
                mysql_query(querySz);
                mysql_store_result();
                mysql_fetch_field_row(result,"playerBanReason");
                mysql_get_field("playerBanReason",result);
                format(string,sizeof(string),"%s.",result);
                SendClientMessage(extraid,COLOR_LIGHTRED,string);
                Kick(extraid);
            }
This checks if the IP is banned. I need to show the reason.
Reply
#7

Resolved.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)