20.08.2017, 09:52
Well i am using this code(query is called under onplayerconnect) the error occurs only seldom(rarely). There is no problem with the code, the troublesome part is that it causes server to lose connection with sql which prevents all other sql connections from happening unless the player relogs.
error
Код:
public OnPlayerBanCheck(playerid) { if(cache_get_row_count() > 0) { new id; while(cache_get_row_count() > id) { new string[128], bname[25], badmin[25], breason[100], btime[10], bdate[10]; cache_get_field_content(id, "pBanned", bname); cache_get_field_content(id, "pBannedBy", badmin); cache_get_field_content(id, "pBanReason", breason); cache_get_field_content(id, "pBanTime", btime); cache_get_field_content(id, "pBanDate", bdate); format(string, sizeof(string), "%s(%d), you were banned by %s for %s. Time: %s, %s", GetPlayerNameEx(playerid), playerid, badmin, breason, bdate, btime); new query2[500]; format(query2, sizeof(query2), "UPDATE bans SET pBanEvade=%d WHERE `pBanned` = '%s'", 1, GetPlayerNameEx(playerid)); mysql_tquery(c_handle, query2, "SendQuery", ""); printf("%s Has Been Blocked From Connecting To The Server. IP: %s",GetPlayerNameEx(playerid),ReturnPlayerIp(playerid)); PlayerPlaySound(playerid, 1062, 0.0, 0.0, 0.0); KickEx(playerid); id++; } } return 1; }
Код:
[11:19:15] [ERROR] CMySQLQuery::Execute[OnPlayerBanCheck] - (error #2013) Lost connection to MySQL server during query [11:19:15] [DEBUG] CMySQLQuery::Execute[OnPlayerBanCheck] - error will be triggered in OnQueryError