diff --git a/AutismBotIngame/scripting/bot_surfing.sp b/AutismBotIngame/scripting/bot_surfing.sp index 4b4d178c..48ddc0af 100644 --- a/AutismBotIngame/scripting/bot_surfing.sp +++ b/AutismBotIngame/scripting/bot_surfing.sp @@ -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,17 +69,24 @@ 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]); - if (bot_finished_surf_coords[client][0] != 0.0) + char map_name[256]; + GetCurrentMap(map_name, sizeof(map_name)); + if (!is_bot_player(client) || StrContains(map_name, "ze_surf", false) == -1) { - 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); } else { - is_forward_called[client] = true; + if (bot_finished_surf_coords[client][0] != 0.0) + { + BotMimic_StopPlayerMimic(client); + TeleportEntity(client, bot_finished_surf_coords[client], NULL_VECTOR, NULL_VECTOR); + reset_client(client); + } + else + { + is_forward_called[client] = true; + } } } @@ -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,8 +253,13 @@ public void SQL_FinishedQuery_creating_tables(Database db, DBResultSet results, { LogError("Query error: %s", error); } - select_map_related_surfs(); - CreateTimer(0.30, update_mimic_coords, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); + 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); + } }