public OnQueryFinish(query[], resultid, extraid, connectionHandle) { // a lot of threads and stuff. // ..... case THREAD_OFFLINE_FINE: { mysql_store_result(g_MySQLConnections); new szMessage[128], szPlayerIP[20], iPlayerAdminLevel, iPlayerBanned, szReason[128], iPlayerPermabanned, iCash, iBankAccount, iFinedAmount, szPlayerName[MAX_PLAYER_NAME], szResult[256], iTotalCashAfterFine; if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections)) { sscanf(szResult, "p<|>dddssdd", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iBankAccount, iCash); if(iPlayerPermabanned > 0) return SendClientMessage(extraid, COLOR_GREY, "The specified player is permanently banned."); if(iPlayerAdminLevel > 0) return SendClientMessage(extraid, COLOR_GREY, "You can't fine other administrators."); GetPVarString(extraid, "ofinereason", szReason, sizeof(szReason)); mysql_real_escape_string(szReason, szReason, g_MySQLConnections); iFinedAmount = GetPVarInt(extraid, "ofineamount"); iTotalCashAfterFine = iCash - iFinedAmount; format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = %d WHERE Username = '%s'", iTotalCashAfterFine, szPlayerName); mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); Log("logs/admin.log", szMessage); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); ABroadCast(COLOR_LIGHTRED,szMessage,1); } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist."); mysql_free_result(g_MySQLConnections); } }
// under OnQueryFinish method case THREAD_OFFLINE_FINE: { new szMessage[128], szPlayerIP[20], iPlayerAdminLevel, iPlayerBanned, szReason[128], iPlayerPermabanned, iCash, iBankAccount, iFinedAmount, szPlayerName[MAX_PLAYER_NAME], szResult[256], iTotalCashAfterFine, rows, fields; cache_get_data(rows, fields); if(rows) { cache_get_field_content(0, "PermaBanned", iPlayerPermaBanned); cache_get_field_content(0, "Banned", iPlayerBanned); cache_get_field_content(0, "AdminLevel", iPlayerAdminLevel); cache_get_field_content(0, "Username", szPlayerName); cache_get_field_content(0, "LastIP", szPlayerIP); cache_get_field_Content(0, "Bank", iBankAccount); cache_get_field_content(0, "Cash", iCash); if(iPlayerPermabanned > 0) return SendClientMessage(extraid, COLOR_GREY, "The specified player is permanently banned."); if(iPlayerAdminLevel > 0) return SendClientMessage(extraid, COLOR_GREY, "You can't fine other administrators."); GetPVarString(extraid, "ofinereason", szReason, sizeof(szReason)); mysql_escape_string(szReason, szReason, g_MySQLConnections); iFinedAmount = GetPVarInt(extraid, "ofineamount"); iTotalCashAfterFine = iCash - iFinedAmount; format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = %d WHERE Username = '%s'", iTotalCashAfterFine, szPlayerName); mysql_tquery(g_MySQLConnections, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, extraid); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); Log("logs/admin.log", szMessage); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); ABroadCast(COLOR_LIGHTRED,szMessage,1); } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist."); }
public OnQueryFinish(query[], resultid, extraid, connectionHandle) { // a lot of threads and stuff. // ..... case THREAD_OFFLINE_FINE: { mysql_store_result(g_MySQLConnections); new szMessage[128], szPlayerIP[20], iPlayerAdminLevel, iPlayerBanned, szReason[128], iPlayerPermabanned, iCash, iBankAccount, iFinedAmount, szPlayerName[MAX_PLAYER_NAME], szResult[256], iTotalCashAfterFine; if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections)) { sscanf(szResult, "p<|>dddssdd", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iBankAccount, iCash); if(iPlayerPermabanned > 0) return SendClientMessage(extraid, COLOR_GREY, "The specified player is permanently banned."); if(iPlayerAdminLevel > 0) return SendClientMessage(extraid, COLOR_GREY, "You can't fine other administrators."); GetPVarString(extraid, "ofinereason", szReason, sizeof(szReason)); mysql_real_escape_string(szReason, szReason, g_MySQLConnections); iFinedAmount = GetPVarInt(extraid, "ofineamount"); iTotalCashAfterFine = iCash - iFinedAmount; format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = %d WHERE Username = '%s'", iTotalCashAfterFine, szPlayerName); mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); Log("logs/admin.log", szMessage); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); ABroadCast(COLOR_LIGHTRED,szMessage,1); } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist."); mysql_free_result(g_MySQLConnections); } }
// under OnQueryFinish method case THREAD_OFFLINE_FINE: { new szMessage[128], szPlayerIP[20], iPlayerAdminLevel, iPlayerBanned, szReason[128], iPlayerPermabanned, iCash, iBankAccount, iFinedAmount, szPlayerName[MAX_PLAYER_NAME], szResult[256], iTotalCashAfterFine, rows, fields; cache_get_data(rows, fields); if(rows) { cache_get_field_content(0, "PermaBanned", iPlayerPermaBanned); cache_get_field_content(0, "Banned", iPlayerBanned); cache_get_field_content(0, "AdminLevel", iPlayerAdminLevel); cache_get_field_content(0, "Username", szPlayerName); cache_get_field_content(0, "LastIP", szPlayerIP); cache_get_field_Content(0, "Bank", iBankAccount); cache_get_field_content(0, "Cash", iCash); if(iPlayerPermabanned > 0) return SendClientMessage(extraid, COLOR_GREY, "The specified player is permanently banned."); if(iPlayerAdminLevel > 0) return SendClientMessage(extraid, COLOR_GREY, "You can't fine other administrators."); GetPVarString(extraid, "ofinereason", szReason, sizeof(szReason)); mysql_escape_string(szReason, szReason, g_MySQLConnections); iFinedAmount = GetPVarInt(extraid, "ofineamount"); iTotalCashAfterFine = iCash - iFinedAmount; format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = %d WHERE Username = '%s'", iTotalCashAfterFine, szPlayerName); mysql_tquery(g_MySQLConnections, szQuery, "OnQueryFinish", "ii", THREAD_NO_RESULT, extraid); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); Log("logs/admin.log", szMessage); format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason); ABroadCast(COLOR_LIGHTRED,szMessage,1); } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist."); }
mysql_tquery(g_MySQLConnections, query, "OnQueryFinish", "ii", THREAD_OFFLINE_FINE, playerid);
Learn to debug. Check mysql_log. Add print(f) everywhere you can, and look in server's console. This way you can pinpoint what exactly is not firing.
|