fixed bugs related to mapchange/round restarts
This commit is contained in:
parent
ae9ea5083a
commit
db669f3b05
@ -27,6 +27,16 @@ public void OnPluginStart()
|
|||||||
}
|
}
|
||||||
OnMapStart();
|
OnMapStart();
|
||||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||||
|
HookEvent("round_end", OnRoundEnd, EventHookMode_Post);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action OnRoundEnd(Handle event, const char[] name, bool dontBroadcast)
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
if (IsValidClient(i) && !IsFakeClient(i))
|
||||||
|
{
|
||||||
|
reset_client(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||||
@ -63,6 +73,10 @@ public void reset_client(int client)
|
|||||||
bot_finished_surf_coords[client][1] = 0.0;
|
bot_finished_surf_coords[client][1] = 0.0;
|
||||||
bot_finished_surf_coords[client][2] = 0.0;
|
bot_finished_surf_coords[client][2] = 0.0;
|
||||||
is_forward_called[client] = false;
|
is_forward_called[client] = false;
|
||||||
|
if (BotMimic_IsPlayerMimicing(client))
|
||||||
|
{
|
||||||
|
BotMimic_StopPlayerMimic(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//unknown delay before forward is called.
|
//unknown delay before forward is called.
|
||||||
@ -77,7 +91,7 @@ public int BotMimic_OnPlayerMimicLoops(int client)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (bot_finished_surf_coords[client][0] != 0.0)
|
if (bot_finished_surf_coords[client][0] != 0.0 && BotMimic_IsPlayerMimicing(client))
|
||||||
{
|
{
|
||||||
BotMimic_StopPlayerMimic(client);
|
BotMimic_StopPlayerMimic(client);
|
||||||
TeleportEntity(client, bot_finished_surf_coords[client], NULL_VECTOR, NULL_VECTOR);
|
TeleportEntity(client, bot_finished_surf_coords[client], NULL_VECTOR, NULL_VECTOR);
|
||||||
@ -206,6 +220,11 @@ public void SQL_OnQueryCompleted(Database db, DBResultSet results, const char[]
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
if (IsValidClient(i) && !IsFakeClient(i))
|
||||||
|
{
|
||||||
|
reset_client(i);
|
||||||
|
}
|
||||||
char map_name[256];
|
char map_name[256];
|
||||||
GetCurrentMap(map_name, sizeof(map_name));
|
GetCurrentMap(map_name, sizeof(map_name));
|
||||||
if (!g_dDatabase)
|
if (!g_dDatabase)
|
||||||
|
Loading…
Reference in New Issue
Block a user