removed fakeclients movement again so now its only the four autismbots again

This commit is contained in:
jenz 2026-01-08 16:28:07 +01:00
parent 7e6147df40
commit 6b2abc9643

View File

@ -25,8 +25,6 @@ int server_ports[2] = {27015, 27035}; //server ports: ze, ze2
float client_old_coords[MAXPLAYERS + 1][3];
float targetfriend_prev_coords[MAXPLAYERS + 1][3];
int fakes_state[MAXPLAYERS + 1];
bool fakes_hit_ground[MAXPLAYERS + 1];
int has_to_jump_bots[MAXPLAYERS + 1];
float coords_run_cmd[MAXPLAYERS + 1][3];
bool chat_cooldown = false;
@ -41,8 +39,6 @@ Handle g_hTimer_bot_connect = null;
//cmdrun handle for gamedata txt
Handle g_hGetRunCmdPre;
int g_iVelocity = -1;
//is botplayer
bool is_bot_player[MAXPLAYERS + 1];
int specific_bot_player[MAXPLAYERS + 1];
@ -58,7 +54,6 @@ public Plugin myinfo =
public void OnPluginStart()
{
g_iVelocity = FindSendPropInfo("CBasePlayer", "m_vecVelocity[0]");
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i))
{
@ -92,7 +87,7 @@ public void OnPluginStart()
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i) && (is_bot_player[i] || IsFakeClient(i)))
if (IsValidClient(i) && is_bot_player[i])
{
if (g_hGetRunCmdPre != INVALID_HANDLE)
DHookEntity(g_hGetRunCmdPre, false, i);
@ -120,7 +115,7 @@ public MRESReturn OnGetRunCmdPre(int entity, Handle hReturn)
return MRES_Ignored;
//check here if fell off edge, if did change some boolean around tell it to OnPlayerRunCmd when still on ground there
if (IsValidClient(entity) && IsPlayerAlive(entity) && !(GetEntityFlags(entity) & FL_ONGROUND) && !has_to_jump_bots[entity]
&& (is_bot_player[entity] || IsFakeClient(entity)))
&& is_bot_player[entity] )
{
has_to_jump_bots[entity] = 1;
}
@ -148,7 +143,7 @@ public void get_new_angles(int client, int target, float angles[3])
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2])
{
//we use info we just got from OnPlayerRunCmdPre to determine if to jump
if (!IsValidClient(client) || !IsPlayerAlive(client) || !(is_bot_player[client] || IsFakeClient(client))) return Plugin_Continue;
if (!IsValidClient(client) || !IsPlayerAlive(client) || !is_bot_player[client]) return Plugin_Continue;
//2023 october: the new place to set angles for the client instead of using face_call, through this is teleporting avoided which can trigger trigger_multiples
if (!bot_follow_tp[client])
@ -244,14 +239,14 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
GetEntPropVector(client, Prop_Send, "m_vecOrigin", coords_run_cmd[client]);
return Plugin_Continue;
}
if (GetEntProp(client, Prop_Data, "m_nWaterLevel") != 0 && !IsFakeClient(client))
if (GetEntProp(client, Prop_Data, "m_nWaterLevel") != 0)
{
has_to_jump_bots[client] = 2;
return Plugin_Continue;
}
//make sure fell of an edge instead of actually jumping. update: i suppose buttons & IN_JUMP probably wont detected for fakes correctly.
if (buttons & IN_JUMP && has_to_jump_bots[client] == 1 && !IsFakeClient(client))
//make sure fell of an edge instead of actually jumping.
if (buttons & IN_JUMP && has_to_jump_bots[client] == 1)
{
has_to_jump_bots[client] = 2;
return Plugin_Continue;
@ -273,93 +268,14 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
//teleport back on ground so can jump
TeleportEntity(client, coords_run_cmd[client], NULL_VECTOR, NULL_VECTOR);
buttons |= IN_JUMP; //jump
if (IsFakeClient(client) && fakes_hit_ground[client]) //fakes not affected by buttons
{
float fVelocity[3];
GetEntDataVector(client, g_iVelocity, fVelocity);
fVelocity[2] = 300.0;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity); //jump
fakes_hit_ground[client] = false;
}
has_to_jump_bots[client] = 2;
}
if (GetEntityFlags(client) & FL_ONGROUND)
{
GetEntPropVector(client, Prop_Send, "m_vecOrigin", coords_run_cmd[client]);
has_to_jump_bots[client] = 0;
fakes_hit_ground[client] = true;
}
//fake clients movement input processed here
if (IsFakeClient(client))
{
int weapon_knife = GetPlayerWeaponSlot(client, 2);
int weapon_p90 = GetPlayerWeaponSlot(client, 0);
int weapon_elite = GetPlayerWeaponSlot(client, 1);
//check what weapon the client is currently using and set it to -1 so it wont constantly set it again
char weaponc[128];
GetClientWeapon(client, weaponc, sizeof(weaponc));
if (StrEqual(weaponc, "weapon_knife"))
{
weapon_knife = -1;
}
else if (StrEqual(weaponc, "weapon_p90"))
{
weapon_p90 = -1;
}
else if (StrEqual(weaponc, "weapon_elite"))
{
weapon_elite = -1;
}
if (fakes_state[client] == 5 || fakes_state[client] == 7)
{
if (weapon_knife != -1)
EquipPlayerWeapon(client, weapon_knife);
}
else if (fakes_state[client] >= 3)
{
if (weapon_knife != -1)
EquipPlayerWeapon(client, weapon_knife);
vel[0] = 400.0;
vel[1] += 0.0;
vel[2] += 0.0;
}
else if (fakes_state[client] == 0)
{
if (weapon_p90 != -1)
EquipPlayerWeapon(client, weapon_p90);
}
else if (fakes_state[client] == 1)
{
if (weapon_elite != -1)
EquipPlayerWeapon(client, weapon_elite);
vel[0] = 400.0;
vel[1] += 0.0;
vel[2] += 0.0;
}
else if (fakes_state[client] == 2)
{
if (weapon_elite != -1)
EquipPlayerWeapon(client, weapon_elite);
}
int random = GetRandomInt(0, 1);
if (!random)
{
vel[0] += 0.0;
vel[1] += 400.0; //move right?
vel[2] += 0.0;
}
else
{
vel[0] += 0.0;
vel[1] -= 400.0; //move left?
vel[2] += 0.0;
}
}
return Plugin_Continue;
}
@ -380,7 +296,7 @@ public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
{
if (IsValidClient(i))
{
if (is_bot_player[i] || IsFakeClient(i))
if (is_bot_player[i])
{
has_to_jump_bots[i] = 3;
}
@ -394,7 +310,7 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
{
if (IsValidClient(i))
{
if (is_bot_player[i] || IsFakeClient(i))
if (is_bot_player[i])
{
target_friend[i] = -1;
target_enemy[i] = -1;
@ -651,7 +567,7 @@ public Action recursive_pressing(Handle timer, any data)
{
found_enemy = true;
}
if (!(is_bot_player[client] || IsFakeClient(client)) && GetClientTeam(client) > 1)
if (!is_bot_player[client] && GetClientTeam(client) > 1)
{
valid_ct_counter++;
if (valid_ct_counter >= 3) //autismbots first join when there are three active players.
@ -663,7 +579,7 @@ public Action recursive_pressing(Handle timer, any data)
for (int client = 1; client <= MaxClients; client++)
{
if (!IsValidClient(client)) continue;
if (!found_valid_ct && (is_bot_player[client]))
if (!found_valid_ct && is_bot_player[client])
{
if (GetClientTeam(client) != 0)
ChangeClientTeam(client, 0);
@ -677,7 +593,7 @@ public Action recursive_pressing(Handle timer, any data)
continue;
}
}
if (is_bot_player[client] || IsFakeClient(client))
if (is_bot_player[client])
{
if (IsPlayerAlive(client))
{
@ -831,10 +747,6 @@ public Action recursive_pressing(Handle timer, any data)
{
send_socket_msg(message, strlen(message), ports[3]);
}
if (IsFakeClient(client))
{
fakes_state[client] = state;
}
}
}
}
@ -842,7 +754,7 @@ public Action recursive_pressing(Handle timer, any data)
for (int client = 1; client <= MaxClients; client++)
{
if (!IsValidClient(client)) continue;
if (!(is_bot_player[client] || IsFakeClient(client)) && GetClientTeam(client) == 3 && IsPlayerAlive(client))
if (!is_bot_player[client] && GetClientTeam(client) == 3 && IsPlayerAlive(client))
{
found_valid_ct = true;
break;
@ -853,7 +765,7 @@ public Action recursive_pressing(Handle timer, any data)
for (int client = 1; client <= MaxClients; client++)
{
if (!IsValidClient(client)) continue;
if ((is_bot_player[client] || IsFakeClient(client)) && GetClientTeam(client) == 3)
if (is_bot_player[client] && GetClientTeam(client) == 3)
{
ForcePlayerSuicide(client);
}
@ -913,10 +825,6 @@ public void trace_hulling_bot(int client)
{
send_socket_msg(message, strlen(message), ports[3]);
}
if (IsFakeClient(client))
{
FakeClientCommandEx(client, "+duck; wait 5; -duck;"); //crouch but probably not working for fakes.
}
return;
}
//something blocks floor crouch
@ -952,13 +860,6 @@ public void trace_hulling_bot(int client)
{
send_socket_msg(message, strlen(message), ports[3]);
}
if (IsFakeClient(client) && (GetEntityFlags(client) & FL_ONGROUND))
{
float fVelocity[3];
GetEntDataVector(client, g_iVelocity, fVelocity);
fVelocity[2] = 300.0;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity); //jump
}
return;
}
else
@ -1030,13 +931,6 @@ public void trace_hulling_bot(int client)
{
send_socket_msg(message, strlen(message), ports[3]);
}
if (IsFakeClient(client) && (GetEntityFlags(client) & FL_ONGROUND))
{
float fVelocity[3];
GetEntDataVector(client, g_iVelocity, fVelocity);
fVelocity[2] = 300.0;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, fVelocity); //jump
}
return;
}
}
@ -1127,7 +1021,7 @@ public int GetClosestClient_option1(bool finding_friend, int client, int enemy)
dist_target = 8000000.0;
}
}
if (is_bot_player[i] || IsFakeClient(i))
if (is_bot_player[i])
{
//just making sure bots have lowest priority
dist_target = 9000000.0;
@ -1150,8 +1044,6 @@ public float get_power_distance(int target_player, float pos[3])
public void OnClientPostAdminCheck(int client)
{
fakes_hit_ground[client] = false;
fakes_state[client] = -1;
is_bot_player[client] = false;
specific_bot_player[client] = 0;
is_autism_bot1(client);
@ -1162,12 +1054,12 @@ public void OnClientPostAdminCheck(int client)
{
if (!IsValidClient(i)) continue;
if ((is_bot_player[i] || IsFakeClient(client)) && i != client)
if (is_bot_player[i] && i != client)
{
target_friend_afk_counter[i][client] = 0;
}
}
if (is_bot_player[client] || IsFakeClient(client))
if (is_bot_player[client])
{
if (g_hGetRunCmdPre != INVALID_HANDLE)
DHookEntity(g_hGetRunCmdPre, false, client);
@ -1243,8 +1135,6 @@ stock void connect_socket()
public void OnClientDisconnect(int client)
{
fakes_hit_ground[client] = false;
fakes_state[client] = -1;
client_old_coords[client][0] = 0.0;
client_old_coords[client][1] = 0.0;
client_old_coords[client][2] = 0.0;
@ -1259,7 +1149,7 @@ public void OnClientDisconnect(int client)
has_to_jump_bots[client] = 0;
for (int i = 1; i <= MaxClients; i++)
{
if (IsValidClient(i) && (is_bot_player[i] || IsFakeClient(client)) && i != client)
if (IsValidClient(i) && is_bot_player[i] && i != client)
{
target_friend_afk_counter[i][client] = 0;
}