added indexes for each bot
This commit is contained in:
parent
1b90d90d4b
commit
747c11d797
@ -13,7 +13,7 @@
|
|||||||
#include <cstrike>
|
#include <cstrike>
|
||||||
#include <socket>
|
#include <socket>
|
||||||
|
|
||||||
int target_friend_afk_counter[MAXPLAYERS + 1];
|
int target_friend_afk_counter[MAXPLAYERS][MAXPLAYERS + 1];
|
||||||
int target_friend[MAXPLAYERS + 1];
|
int target_friend[MAXPLAYERS + 1];
|
||||||
int target_enemy[MAXPLAYERS + 1];
|
int target_enemy[MAXPLAYERS + 1];
|
||||||
int buttons_old[MAXPLAYERS + 1];
|
int buttons_old[MAXPLAYERS + 1];
|
||||||
@ -824,13 +824,13 @@ stock bool IsValidClient(int client)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
stock bool is_client_stuck_or_afk(int client)
|
stock bool is_client_stuck_or_afk(int client, int i)
|
||||||
{
|
{
|
||||||
//can trigger between 6-8 times per second
|
//can trigger between 6-8 times per second
|
||||||
target_friend_afk_counter[client]++;
|
target_friend_afk_counter[client][i]++;
|
||||||
if (target_friend_afk_counter[client] > 24)
|
if (target_friend_afk_counter[client][i] > 24)
|
||||||
{
|
{
|
||||||
target_friend_afk_counter[client] = 0;
|
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 client_own_distance = get_power_distance(client, client_old_coords[client]);
|
||||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", client_old_coords[client]);
|
GetEntPropVector(client, Prop_Send, "m_vecOrigin", client_old_coords[client]);
|
||||||
@ -848,7 +848,7 @@ public int GetClosestClient_option1(bool finding_friend, int client)
|
|||||||
for (int i = 1; i <= MaxClients; i++)
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
if (IsValidClient(i) && IsPlayerAlive(i) && i != client && !is_bot_player(i))
|
if (IsValidClient(i) && IsPlayerAlive(i) && i != client && !is_bot_player(i))
|
||||||
{
|
{
|
||||||
if (!IsAbleToSee(client, i) || is_client_stuck_or_afk(i))
|
if (!IsAbleToSee(client, i) || is_client_stuck_or_afk(client, i))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -879,7 +879,11 @@ public float get_power_distance(int target_player, float [3]pos)
|
|||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientPostAdminCheck(int client)
|
||||||
{
|
{
|
||||||
target_friend_afk_counter[client] = 0;
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && is_bot_player(i) && i != client)
|
||||||
|
target_friend_afk_counter[i][client] = 0;
|
||||||
|
}
|
||||||
bot_avoid_edge[client] = -1;
|
bot_avoid_edge[client] = -1;
|
||||||
char auth[64];
|
char auth[64];
|
||||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||||
@ -947,7 +951,11 @@ public void OnClientDisconnect(int client)
|
|||||||
client_old_coords[client][0] = 0.0;
|
client_old_coords[client][0] = 0.0;
|
||||||
client_old_coords[client][1] = 0.0;
|
client_old_coords[client][1] = 0.0;
|
||||||
client_old_coords[client][2] = 0.0;
|
client_old_coords[client][2] = 0.0;
|
||||||
target_friend_afk_counter[client] = 0;
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && is_bot_player(i) && i != client)
|
||||||
|
target_friend_afk_counter[i][client] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Socket callback
|
//Socket callback
|
||||||
|
Loading…
Reference in New Issue
Block a user