added delay to prevent bot falling off edges more often

This commit is contained in:
christian 2021-04-27 00:55:50 +02:00
parent 9d516dd2ab
commit c34ecd60d4

View File

@ -19,6 +19,7 @@ int target_enemy[MAXPLAYERS + 1];
int buttons_old[MAXPLAYERS + 1];
int flags_old[MAXPLAYERS + 1];
bool surf_cooldown = false;
int bot_avoid_edge[MAXPLAYERS + 1];
float client_old_coords[MAXPLAYERS + 1][3];
float targethuman_teleported[MAXPLAYERS + 1][3];
bool chat_cooldown = false;
@ -314,6 +315,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
NegateVector(Result);
GetVectorAngles(Result, Result);
TeleportEntity(client, NULL_VECTOR, Result, NULL_VECTOR);
bot_avoid_edge[client] = 0;
}
}
}
@ -352,6 +354,13 @@ public Action recursive_pressing(Handle timer, any data)
ChangeClientTeam(client, 2);
continue;
}
if (bot_avoid_edge[client] >= 4)
bot_avoid_edge[client] = -1;
if (bot_avoid_edge[client] > -1)
{
bot_avoid_edge[client]++;
continue;
}
if (IsPlayerAlive(client))
{
int targeteam = 0;
@ -720,6 +729,7 @@ public void OnClientPostAdminCheck(int client)
//[U:1:120378081]
//[U:1:69566635]
target_human_afk_counter[client] = 0;
bot_avoid_edge[client] = -1;
char auth[50];
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
char msg[generic_length];
@ -763,6 +773,7 @@ stock void connect_socket()
public void OnClientDisconnect(int client)
{
admins[client] = false;
bot_avoid_edge[client] = -1;
vips[client] = false;
client_old_coords[client][0] = 0.0;
client_old_coords[client][1] = 0.0;