significantly helps the bots to abandon afk players

This commit is contained in:
christian 2021-12-16 14:50:03 +01:00
parent 747c11d797
commit 36ec38f3aa

View File

@ -20,7 +20,6 @@ int buttons_old[MAXPLAYERS + 1];
int flags_old[MAXPLAYERS + 1]; int flags_old[MAXPLAYERS + 1];
int ports[7] = {48470, 48471, 48472, 48473, 48474, 48479, 48480}; //last three indexes are ports its sending udp from in plugin int ports[7] = {48470, 48471, 48472, 48473, 48474, 48479, 48480}; //last three indexes are ports its sending udp from in plugin
int server_ports[2] = {27015, 27035}; //server ports: ze, ze2 int server_ports[2] = {27015, 27035}; //server ports: ze, ze2
bool surf_cooldown = false;
int bot_avoid_edge[MAXPLAYERS + 1]; int bot_avoid_edge[MAXPLAYERS + 1];
float client_old_coords[MAXPLAYERS + 1][3]; float client_old_coords[MAXPLAYERS + 1][3];
float targethuman_teleported[MAXPLAYERS + 1][3]; float targethuman_teleported[MAXPLAYERS + 1][3];
@ -785,12 +784,6 @@ public void trace_hulling_bot(int client)
} }
} }
public Action surf_cooldown_timer(Handle timer, any data)
{
surf_cooldown = false;
return Plugin_Continue;
}
public bool TraceRayDontHitSelf(int entity, int mask, any data) public bool TraceRayDontHitSelf(int entity, int mask, any data)
{ {
return entity != data && !(0 < entity <= MaxClients); return entity != data && !(0 < entity <= MaxClients);
@ -826,15 +819,19 @@ stock bool IsValidClient(int client)
stock bool is_client_stuck_or_afk(int client, int i) stock bool is_client_stuck_or_afk(int client, int i)
{ {
//can trigger between 6-8 times per second //triggers between 6-8 times per second
target_friend_afk_counter[client][i]++; target_friend_afk_counter[client][i]++;
if (target_friend_afk_counter[client][i] > 24) if (target_friend_afk_counter[client][i] >= 24)
{ {
target_friend_afk_counter[client][i] = 0;
float min_distance_cap = 1.0; float min_distance_cap = 1.0;
float client_own_distance = get_power_distance(client, client_old_coords[client]); float i_own_distance = get_power_distance(i, client_old_coords[i]);
GetEntPropVector(client, Prop_Send, "m_vecOrigin", client_old_coords[client]); GetEntPropVector(i, Prop_Send, "m_vecOrigin", client_old_coords[i]);
return client_own_distance < min_distance_cap; bool not_moved = i_own_distance < min_distance_cap;
if (!not_moved)
{
target_friend_afk_counter[client][i] = 0;
}
return not_moved;
} }
return false; return false;
} }