should not be needed, is weird check

This commit is contained in:
jenz 2022-09-17 19:18:13 +02:00
parent c72b97c657
commit 3316b6e74a

View File

@ -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();
}
}