simple attempt to fix potential teleport bug by excluding all non surf maps

This commit is contained in:
jenz 2022-01-16 15:45:38 +01:00
parent ab8a2359d8
commit ae9ea5083a

View File

@ -12,8 +12,8 @@ public Plugin myinfo =
version = "1.0",
url = "www.unloze.com"
};
float bot_finished_surf_coords[MAXPLAYERS][3];
bool is_forward_called[MAXPLAYERS];
float bot_finished_surf_coords[MAXPLAYERS + 1][3] ;
bool is_forward_called[MAXPLAYERS + 1];
char map_coorindates[65][256];
char map_recordname[65][256];
Database g_dDatabase;
@ -69,11 +69,17 @@ public void reset_client(int client)
//BotMimic_IsPlayerMimicing() is true in update_mimic_coords before the BotMimic_OnPlayerMimicLoops forward is called
public int BotMimic_OnPlayerMimicLoops(int client)
{
//PrintToChatAll("BotMimic_OnPlayerMimicLoops bot_finished_surf_coords[client][0]: %f", bot_finished_surf_coords[client][0]);
char map_name[256];
GetCurrentMap(map_name, sizeof(map_name));
if (!is_bot_player(client) || StrContains(map_name, "ze_surf", false) == -1)
{
reset_client(client);
}
else
{
if (bot_finished_surf_coords[client][0] != 0.0)
{
BotMimic_StopPlayerMimic(client);
//on ze2 they were teleported to end of world or maybe 0.0 0.0 0.0
TeleportEntity(client, bot_finished_surf_coords[client], NULL_VECTOR, NULL_VECTOR);
reset_client(client);
}
@ -82,6 +88,7 @@ public int BotMimic_OnPlayerMimicLoops(int client)
is_forward_called[client] = true;
}
}
}
public Action update_mimic_coords(Handle timer, any data)
{
@ -199,9 +206,11 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
public void OnMapStart()
{
char map_name[256];
GetCurrentMap(map_name, sizeof(map_name));
if (!g_dDatabase)
Database.Connect(SQL_OnDatabaseConnect, "bot_surfing");
else
else if(StrContains(map_name, "ze_surf", false) != -1)
{
select_map_related_surfs();
CreateTimer(0.30, update_mimic_coords, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
@ -244,9 +253,14 @@ public void SQL_FinishedQuery_creating_tables(Database db, DBResultSet results,
{
LogError("Query error: %s", error);
}
char map_name[256];
GetCurrentMap(map_name, sizeof(map_name));
if (StrContains(map_name, "ze_surf", false) != -1)
{
select_map_related_surfs();
CreateTimer(0.30, update_mimic_coords, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
}
}
public bool is_bot_player(int client)