minor updates and fixes

This commit is contained in:
jenz 2022-08-10 20:44:01 +02:00
parent 43cb66b2d8
commit 26315fe33e

View File

@ -9,13 +9,14 @@ public Plugin myinfo =
name = "test surfing plugin", name = "test surfing plugin",
author = "jenzur", author = "jenzur",
description = "hello ", description = "hello ",
version = "1.0", version = "1.1",
url = "www.unloze.com" url = "www.unloze.com"
}; };
float bot_finished_surf_coords[MAXPLAYERS + 1][3]; float bot_finished_surf_coords[MAXPLAYERS + 1][3];
char map_coorindates[65][256]; char map_coorindates[65][256];
char map_recordname[65][256]; char map_recordname[65][256];
bool round_switch = false; bool round_switch = false;
Handle g_hTraceTimer = null;
Database g_dDatabase; Database g_dDatabase;
public void OnPluginStart() public void OnPluginStart()
@ -26,6 +27,7 @@ public void OnPluginStart()
reset_client(i); reset_client(i);
reset_bot_finished_surf(i); reset_bot_finished_surf(i);
} }
g_hTraceTimer = CreateTimer(0.30, update_mimic_coords, _, TIMER_REPEAT);
OnMapStart(); OnMapStart();
HookEvent("round_start", Event_RoundStart, EventHookMode_Pre); HookEvent("round_start", Event_RoundStart, EventHookMode_Pre);
HookEvent("round_end", OnRoundEnd, EventHookMode_Pre); HookEvent("round_end", OnRoundEnd, EventHookMode_Pre);
@ -39,6 +41,8 @@ public void OnPluginEnd()
reset_client(i); reset_client(i);
reset_bot_finished_surf(i); reset_bot_finished_surf(i);
} }
if (g_hTraceTimer != null)
delete g_hTraceTimer;
} }
public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast) public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast)
@ -95,7 +99,7 @@ public void reset_bot_finished_surf(int client)
public void reset_client(int client) public void reset_client(int client)
{ {
if (bot_finished_surf_coords[client][0] != 0.0) if (BotMimic_IsPlayerMimicing(client))
{ {
BotMimic_StopPlayerMimic(client); BotMimic_StopPlayerMimic(client);
} }
@ -155,7 +159,7 @@ public Action update_mimic_coords(Handle timer, any data)
float distance = get_power_distance(j, coords); float distance = get_power_distance(j, coords);
if (distance < 225.0) if (distance < 225.0)
{ {
char path[256]; char path[1024];
for (int f = 0; f < GetArraySize(records_list); f++) for (int f = 0; f < GetArraySize(records_list); f++)
{ {
if (f != i) continue; if (f != i) continue;
@ -266,7 +270,6 @@ public void OnMapStart()
else if(StrContains(map_name, "ze_surf", false) != -1) else if(StrContains(map_name, "ze_surf", false) != -1)
{ {
select_map_related_surfs(); select_map_related_surfs();
CreateTimer(0.30, update_mimic_coords, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
} }
} }
@ -311,11 +314,9 @@ public void SQL_FinishedQuery_creating_tables(Database db, DBResultSet results,
if (StrContains(map_name, "ze_surf", false) != -1) if (StrContains(map_name, "ze_surf", false) != -1)
{ {
select_map_related_surfs(); 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) public bool is_bot_player(int client)
{ {
bool debug_b = false; bool debug_b = false;