MYSQL
#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


Messages In This Thread
MYSQL - by SILENT! - 23.06.2011, 15:08
Re: MYSQL - by WackoX - 23.06.2011, 15:23
Re: MYSQL - by SILENT! - 23.06.2011, 15:23
Re: MYSQL - by SILENT! - 23.06.2011, 15:41
Re: MYSQL - by xxmitsu - 23.06.2011, 16:06
Re: MYSQL - by SILENT! - 23.06.2011, 16:30
Re: MYSQL - by SILENT! - 23.06.2011, 16:44

Forum Jump:


Users browsing this thread: 2 Guest(s)