From 3316b6e74accfd8e261927f4f2dd7bab1d025903 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 17 Sep 2022 19:18:13 +0200 Subject: [PATCH] should not be needed, is weird check --- AutismBotIngame/scripting/bot_surfing.sp | 50 +++++++++++++----------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/AutismBotIngame/scripting/bot_surfing.sp b/AutismBotIngame/scripting/bot_surfing.sp index 19014354..95e0441a 100644 --- a/AutismBotIngame/scripting/bot_surfing.sp +++ b/AutismBotIngame/scripting/bot_surfing.sp @@ -226,32 +226,32 @@ public Action BotMimic_OnStartRecording(int client, char[] name, char[] category public void select_map_related_surfs() { - char map_name[256]; - GetCurrentMap(map_name, sizeof(map_name)); - char sQuery[256]; - Format(sQuery, sizeof(sQuery), "select recordname, coordinate from `maps_coordinates` where mapname = '%s'", map_name); - g_dDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_High); + char map_name[256]; + GetCurrentMap(map_name, sizeof(map_name)); + char sQuery[256]; + Format(sQuery, sizeof(sQuery), "select recordname, coordinate from `maps_coordinates` where mapname = '%s'", map_name); + g_dDatabase.Query(SQL_OnQueryCompleted, sQuery, _, DBPrio_High); } public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[] error, DataPack data) { - if (!db || strlen(error)) - { - LogError("Query error: %s", error); - return; - } - int iterator = 0; - for (int i = 0; i < sizeof(map_coorindates); i++) - { - Format(map_coorindates[i], sizeof(map_coorindates[]), ""); - Format(map_recordname[i], sizeof(map_recordname[]), ""); - } - while (results.RowCount > 0 && results.FetchRow()) - { - results.FetchString(0, map_recordname[iterator], sizeof(map_recordname[])); - results.FetchString(1, map_coorindates[iterator], sizeof(map_coorindates[])); - iterator++; - } + if (!db || strlen(error)) + { + LogError("Query error: %s", error); + return; + } + int iterator = 0; + for (int i = 0; i < sizeof(map_coorindates); i++) + { + Format(map_coorindates[i], sizeof(map_coorindates[]), ""); + Format(map_recordname[i], sizeof(map_recordname[]), ""); + } + while (results.RowCount > 0 && results.FetchRow()) + { + results.FetchString(0, map_recordname[iterator], sizeof(map_recordname[])); + results.FetchString(1, map_coorindates[iterator], sizeof(map_coorindates[])); + iterator++; + } } @@ -268,6 +268,12 @@ public void OnMapStart() Database.Connect(SQL_OnDatabaseConnect, "bot_surfing"); else if(StrContains(map_name, "ze_surf", false) != -1) { + //should not be needed + for (int i = 0; i < sizeof(map_coorindates); i++) + { + Format(map_coorindates[i], sizeof(map_coorindates[]), ""); + Format(map_recordname[i], sizeof(map_recordname[]), ""); + } select_map_related_surfs(); } }