23.06.2011, 16:06
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
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);
}