further updates to handle multiple bots
This commit is contained in:
parent
0970bbb4ed
commit
286402d3af
@ -207,3 +207,4 @@ if __name__ == '__main__':
|
||||
|
||||
#before steam login: export SDL_VIDEO_X11_VISUALID=0x074
|
||||
#to find correct SDL_VIDEO_X11_VISUALID use glxinfo in X2GO
|
||||
|
||||
|
@ -14,14 +14,14 @@
|
||||
|
||||
//#pragma newdecls required
|
||||
int present[MAXPLAYERS + 1];
|
||||
int targethuman = 0;
|
||||
int target_enemy = 0;
|
||||
int buttons_old;
|
||||
int flags_old;
|
||||
int targethuman[MAXPLAYERS + 1];
|
||||
int target_enemy[MAXPLAYERS + 1];
|
||||
int buttons_old[MAXPLAYERS + 1];
|
||||
int flags_old[MAXPLAYERS + 1];
|
||||
bool surf_cooldown = false;
|
||||
bool connected_cooldown = false;
|
||||
float client_old_coords[MAXPLAYERS + 1][3];
|
||||
float targethuman_teleported[3];
|
||||
float targethuman_teleported[MAXPLAYERS + 1][3];
|
||||
bool chat_cooldown = false;
|
||||
|
||||
//admins & vips
|
||||
@ -44,7 +44,11 @@ public void OnPluginStart()
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
present[i] = 0;
|
||||
{
|
||||
targethuman[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
}
|
||||
//talking
|
||||
RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application");
|
||||
|
||||
@ -58,47 +62,46 @@ public void OnPluginStart()
|
||||
//UDP connection
|
||||
connect_socket();
|
||||
chat_cooldown = false;
|
||||
reset_target_human_tp_coord();
|
||||
targethuman = 0;
|
||||
target_enemy = 0;
|
||||
}
|
||||
|
||||
public void reset_target_human_tp_coord()
|
||||
public void reset_target_human_tp_coord(int client)
|
||||
{
|
||||
targethuman_teleported[0] = 0.0;
|
||||
targethuman_teleported[1] = 0.0;
|
||||
targethuman_teleported[2] = 0.0;
|
||||
targethuman_teleported[client][0] = 0.0;
|
||||
targethuman_teleported[client][1] = 0.0;
|
||||
targethuman_teleported[client][2] = 0.0;
|
||||
}
|
||||
|
||||
public void trigger_teleport(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index))
|
||||
if (IsValidClient(targethuman) && client == targethuman)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported);
|
||||
CreateTimer(6.0, reset_target_tp);
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (targethuman[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (client == present[0] || client == present[1])
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
else if (IsValidClient(client) && client == present[client])
|
||||
CreateTimer(0.1, reset_target_tp);
|
||||
}
|
||||
|
||||
public void Trigger_Multiple(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index))
|
||||
if (IsValidEdict(entity_index) && origin_command_check(entity_index))
|
||||
{
|
||||
if (IsValidClient(targethuman) && client == targethuman)
|
||||
{
|
||||
if (origin_command_check(entity_index))
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported);
|
||||
CreateTimer(6.0, reset_target_tp);
|
||||
}
|
||||
}
|
||||
else if (IsValidClient(client) && client == present[client])
|
||||
{
|
||||
if (origin_command_check(entity_index))
|
||||
CreateTimer(0.1, reset_target_tp);
|
||||
}
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (targethuman[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
}
|
||||
else if (client == present[0] || client == present[1])
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,15 +126,15 @@ public bool origin_command_check(int entity_index)
|
||||
return false;
|
||||
}
|
||||
|
||||
public Action reset_target_tp(Handle timer, any data)
|
||||
public Action reset_target_tp(Handle timer, int client)
|
||||
{
|
||||
reset_target_human_tp_coord();
|
||||
reset_target_human_tp_coord(client);
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public bool distance_check(int client)
|
||||
{
|
||||
float dist_target = get_power_distance(present[client], targethuman_teleported);
|
||||
float dist_target = get_power_distance(client, targethuman_teleported[client]);
|
||||
float min_required_distance = 50000.0;
|
||||
if (dist_target > min_required_distance)
|
||||
return false;
|
||||
@ -153,26 +156,35 @@ public Action cmd_talk(int client, int args)
|
||||
PrintToChat(client, "spamming bot too much, applying cooldown");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
bool bot_found = false;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && !IsFakeClient(i))
|
||||
{
|
||||
char ip_addr[generic_length];
|
||||
GetClientIP(i, ip_addr, sizeof(ip_addr));
|
||||
if (present[i] == i)
|
||||
{
|
||||
if (StrContains(ip_addr, "127.0.0.1"))
|
||||
{
|
||||
chat_cooldown = true;
|
||||
char magic_code[16];
|
||||
Format(magic_code, sizeof(magic_code), "72DqZ84");
|
||||
Format(msg, sizeof(msg), "clientmessage:%N %s %s", client, magic_code, info);
|
||||
send_socket_msg(msg, strlen(msg));
|
||||
CreateTimer(2.0, bot_chat_cooldown);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
char auth[50];
|
||||
GetClientAuthId(i, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
chat_cooldown = true;
|
||||
char magic_code[16];
|
||||
Format(magic_code, sizeof(magic_code), "72DqZ84");
|
||||
Format(msg, sizeof(msg), "clientmessage:%N %s %s", client, magic_code, info);
|
||||
send_socket_msg(msg, strlen(msg));
|
||||
CreateTimer(2.0, bot_chat_cooldown);
|
||||
bot_found = true;
|
||||
}
|
||||
}
|
||||
PrintToChat(client, "bot not connected to server");
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
chat_cooldown = true;
|
||||
char magic_code[16];
|
||||
Format(magic_code, sizeof(magic_code), "72DqZ84");
|
||||
Format(msg, sizeof(msg), "clientmessage:%N %s %s", client, magic_code, info);
|
||||
send_socket_msg1(msg, strlen(msg));
|
||||
CreateTimer(2.0, bot_chat_cooldown);
|
||||
bot_found = true;
|
||||
}
|
||||
}
|
||||
if (!bot_found)
|
||||
PrintToChat(client, "bot not connected to server");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
@ -184,9 +196,13 @@ public Action bot_chat_cooldown(Handle timer, any data)
|
||||
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
targethuman = 0;
|
||||
target_enemy = 0;
|
||||
reset_target_human_tp_coord();
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && !IsFakeClient(i))
|
||||
{
|
||||
targethuman[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
@ -220,33 +236,36 @@ public Action bot_check_connect(Handle timer, any data)
|
||||
{
|
||||
char ip_addr[generic_length];
|
||||
GetClientIP(i, ip_addr, sizeof(ip_addr));
|
||||
if (i == present[i])
|
||||
if (client_count > 61)
|
||||
{
|
||||
if (client_count > 61)
|
||||
char msg[generic_length];
|
||||
if (StrContains(ip_addr, "127.0.0.1"))
|
||||
{
|
||||
char msg[generic_length];
|
||||
if (StrContains(ip_addr, "127.0.0.1"))
|
||||
{
|
||||
KickClient(i, "server full you need to leave");
|
||||
Format(msg, sizeof(msg), "bot kicked server full");
|
||||
send_socket_msg(msg, strlen(msg));
|
||||
}
|
||||
else if (StrContains(ip_addr, "164.132.201.173"))
|
||||
{
|
||||
KickClient(i, "server full you need to leave");
|
||||
Format(msg, sizeof(msg), "bot kicked server full");
|
||||
send_socket_msg1(msg, strlen(msg));
|
||||
}
|
||||
KickClient(i, "server full you need to leave");
|
||||
Format(msg, sizeof(msg), "bot kicked server full");
|
||||
send_socket_msg(msg, strlen(msg));
|
||||
}
|
||||
else
|
||||
else if (StrContains(ip_addr, "164.132.201.173"))
|
||||
{
|
||||
if (StrContains(ip_addr, "127.0.0.1"))
|
||||
found_bot_1 = true;
|
||||
else if (StrContains(ip_addr, "164.132.201.173"))
|
||||
found_bot_2 = true;
|
||||
KickClient(i, "server full you need to leave");
|
||||
Format(msg, sizeof(msg), "bot kicked server full");
|
||||
send_socket_msg1(msg, strlen(msg));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
char auth[50];
|
||||
GetClientAuthId(i, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
found_bot_1 = true;
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
found_bot_2 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
char msg[generic_length];
|
||||
//PrintToChatAll("sending UDP message...");
|
||||
Format(msg, sizeof(msg), "connect to ze");
|
||||
@ -261,149 +280,158 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
||||
int cmdnum, int tickcount, int seed, const int mouse[2])
|
||||
{
|
||||
if (!IsClientInGame(client)) return;
|
||||
if (client == present[client])
|
||||
if (client != present[0] && client != present[1]) return;
|
||||
int flags = GetEntityFlags(client);
|
||||
if (!(flags & FL_ONGROUND) && (flags_old[client] & FL_ONGROUND) && !(buttons_old[client] & IN_JUMP) && !(buttons & IN_JUMP) && (GetEntityMoveType(client) != MOVETYPE_LADDER))
|
||||
{
|
||||
int flags = GetEntityFlags(client);
|
||||
if (!(flags & FL_ONGROUND) && (flags_old & FL_ONGROUND) && !(buttons_old & IN_JUMP) && !(buttons & IN_JUMP) && (GetEntityMoveType(present[client]) != MOVETYPE_LADDER))
|
||||
float Vel[3], feet_origin[3], ground_pos[3], downwards[3];
|
||||
//TODO
|
||||
float velocity_addition_z_axis = 300.0;
|
||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", Vel);
|
||||
Vel[2] += velocity_addition_z_axis;
|
||||
|
||||
GetClientAbsOrigin(client, feet_origin);
|
||||
downwards[0] = 90.0;
|
||||
downwards[1] = 0.0;
|
||||
downwards[2] = 0.0;
|
||||
TR_TraceRayFilter(feet_origin, downwards, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, client);
|
||||
if (TR_DidHit())
|
||||
{
|
||||
float Vel[3], feet_origin[3], ground_pos[3], downwards[3];
|
||||
//TODO
|
||||
float velocity_addition_z_axis = 300.0;
|
||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", Vel);
|
||||
Vel[2] += velocity_addition_z_axis;
|
||||
|
||||
GetClientAbsOrigin(present[client], feet_origin);
|
||||
downwards[0] = 90.0;
|
||||
downwards[1] = 0.0;
|
||||
downwards[2] = 0.0;
|
||||
TR_TraceRayFilter(feet_origin, downwards, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, present[client]);
|
||||
if (TR_DidHit())
|
||||
TR_GetEndPosition(ground_pos);
|
||||
feet_origin[2] -= 10.0;
|
||||
float ground_distance = GetVectorDistance(feet_origin, ground_pos);
|
||||
if (ground_distance > 80)
|
||||
{
|
||||
TR_GetEndPosition(ground_pos);
|
||||
feet_origin[2] -= 10.0;
|
||||
float ground_distance = GetVectorDistance(feet_origin, ground_pos);
|
||||
if (ground_distance > 80)
|
||||
float angles_eye[3];
|
||||
GetClientEyeAngles(client, angles_eye);
|
||||
feet_origin[2] += 10.0;
|
||||
TR_TraceRayFilter(feet_origin, angles_eye, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, client);
|
||||
if (TR_DidHit())
|
||||
{
|
||||
float angles_eye[3];
|
||||
GetClientEyeAngles(present[client], angles_eye);
|
||||
feet_origin[2] += 10.0;
|
||||
TR_TraceRayFilter(feet_origin, angles_eye, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, present[client]);
|
||||
if (TR_DidHit())
|
||||
TR_GetEndPosition(ground_pos);
|
||||
feet_origin[2] -= 10.0;
|
||||
float forward_distance = GetVectorDistance(feet_origin, ground_pos);
|
||||
if (forward_distance > 280)
|
||||
{
|
||||
TR_GetEndPosition(ground_pos);
|
||||
feet_origin[2] -= 10.0;
|
||||
float forward_distance = GetVectorDistance(feet_origin, ground_pos);
|
||||
if (forward_distance > 280)
|
||||
if (IsValidClient(targethuman[client]))
|
||||
{
|
||||
if (IsValidClient(targethuman))
|
||||
float feet_origin_pre[3], human_feet_origin[3];
|
||||
GetClientAbsOrigin(client, feet_origin_pre);
|
||||
GetClientAbsOrigin(targethuman[client], human_feet_origin);
|
||||
//target human is below, get down to them
|
||||
//TODO maybe?
|
||||
if (feet_origin_pre[2] - 200 > human_feet_origin[2])
|
||||
{
|
||||
float feet_origin_pre[3], human_feet_origin[3];
|
||||
GetClientAbsOrigin(present[client], feet_origin_pre);
|
||||
GetClientAbsOrigin(targethuman, human_feet_origin);
|
||||
//target human is below, get down to them
|
||||
//TODO maybe?
|
||||
if (feet_origin_pre[2] - 200 > human_feet_origin[2])
|
||||
{
|
||||
buttons_old = buttons;
|
||||
flags_old = flags;
|
||||
return;
|
||||
}
|
||||
buttons_old[client] = buttons;
|
||||
flags_old[client] = flags;
|
||||
return;
|
||||
}
|
||||
float velocity[3];
|
||||
GetEntPropVector(present[client], Prop_Data, "m_vecVelocity", velocity);
|
||||
velocity[2] += 30.0;
|
||||
NegateVector(velocity);
|
||||
for (int y = 0; y < 10; y++)
|
||||
TeleportEntity(present[client], NULL_VECTOR, NULL_VECTOR, velocity);
|
||||
}
|
||||
}
|
||||
float velocity[3];
|
||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
|
||||
velocity[2] += 30.0;
|
||||
NegateVector(velocity);
|
||||
for (int y = 0; y < 10; y++)
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel);
|
||||
}
|
||||
buttons_old = buttons;
|
||||
flags_old = flags;
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel);
|
||||
}
|
||||
buttons_old[client] = buttons;
|
||||
flags_old[client] = flags;
|
||||
}
|
||||
|
||||
public Action recursive_pressing(Handle timer, any data)
|
||||
{
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
if (IsValidClient(client) && present[client] == client)
|
||||
{
|
||||
if (GetClientTeam(present[client]) == 1 || GetClientTeam(present[client]) == 0)
|
||||
{
|
||||
ChangeClientTeam(present[client], 2);
|
||||
return Plugin_Continue;
|
||||
}
|
||||
if (IsPlayerAlive(present[client]))
|
||||
{
|
||||
if (GetEntityMoveType(present[client]) == MOVETYPE_LADDER)
|
||||
return Plugin_Continue;
|
||||
int targeteam = 0;
|
||||
if (GetClientTeam(present[client]) != 3)
|
||||
{
|
||||
//2 = autismo is zm and should follow closest moving zm
|
||||
targeteam = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
//3 = autismo is human and should follow closest moving ct
|
||||
targeteam = 3;
|
||||
}
|
||||
if (targethuman_teleported[0] != 0.0)
|
||||
{
|
||||
float ClientPos[3];
|
||||
float Result[3];
|
||||
GetClientEyePosition(present[client], ClientPos);
|
||||
MakeVectorFromPoints(ClientPos, targethuman_teleported, Result);
|
||||
GetVectorAngles(Result, Result);
|
||||
TeleportEntity(present[client], NULL_VECTOR, Result, NULL_VECTOR);
|
||||
if (!distance_check(client))
|
||||
reset_target_human_tp_coord();
|
||||
return Plugin_Continue;
|
||||
}
|
||||
target_enemy = GetClosestClient_option1(targeteam == 2 ? 3 : 2, client);
|
||||
targethuman = GetClosestClient_option1(targeteam == 2 ? 2 : 3, client);
|
||||
float enemy_distance = -1.0;
|
||||
float dist_target = -1.0;
|
||||
float pos[3];
|
||||
if (IsValidClient(targethuman))
|
||||
{
|
||||
GetEntPropVector(targethuman, Prop_Send, "m_vecOrigin", pos);
|
||||
dist_target = get_power_distance(present[client], pos);
|
||||
}
|
||||
|
||||
//TODO maybe disable if requested
|
||||
if (IsValidClient(target_enemy))
|
||||
{
|
||||
GetEntPropVector(target_enemy, Prop_Send, "m_vecOrigin", pos);
|
||||
enemy_distance = get_power_distance(present[client], pos);
|
||||
}
|
||||
if ((0 < enemy_distance && targeteam == 2) || dist_target < 0 < enemy_distance)
|
||||
{
|
||||
float feet_origin[3], enemy_feet_origin[3];
|
||||
GetClientAbsOrigin(present[client], feet_origin);
|
||||
GetClientAbsOrigin(target_enemy, enemy_feet_origin);
|
||||
if (feet_origin[2] + 100 > enemy_feet_origin[2])
|
||||
face_call(target_enemy, client);
|
||||
}
|
||||
else if (0 < dist_target)
|
||||
face_call(targethuman, client);
|
||||
trace_hulling_bot(client);
|
||||
char message[generic_length * 7];
|
||||
if (IsValidClient(targethuman))
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: %N enemy_distance: %f targeteam: %i", dist_target, targethuman, enemy_distance, targeteam);
|
||||
else
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: none enemy_distance: %f targeteam: %i", dist_target, enemy_distance, targeteam);
|
||||
if (IsValidClient(target_enemy))
|
||||
Format(message, sizeof(message), "%s target_enemy: %N", message, target_enemy);
|
||||
else
|
||||
Format(message, sizeof(message), "%s target_enemy: none", message);
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
}
|
||||
return Plugin_Continue;
|
||||
for (int client = 1; client <= MaxClients; client++)
|
||||
{
|
||||
if (!IsValidClient(client)) return Plugin_Continue;
|
||||
if (client != present[0] && client != present[1]) return Plugin_Continue;
|
||||
if (GetClientTeam(client) == 1 || GetClientTeam(client) == 0)
|
||||
{
|
||||
ChangeClientTeam(client, 2);
|
||||
continue;
|
||||
}
|
||||
if (IsPlayerAlive(client))
|
||||
{
|
||||
if (GetEntityMoveType(client) == MOVETYPE_LADDER)
|
||||
continue;
|
||||
int targeteam = 0;
|
||||
if (GetClientTeam(client) != 3)
|
||||
{
|
||||
//2 = autismo is zm and should follow closest moving zm
|
||||
targeteam = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
//3 = autismo is human and should follow closest moving ct
|
||||
targeteam = 3;
|
||||
}
|
||||
if (targethuman_teleported[client][0] != 0.0)
|
||||
{
|
||||
float ClientPos[3];
|
||||
float Result[3];
|
||||
GetClientEyePosition(client, ClientPos);
|
||||
MakeVectorFromPoints(ClientPos, targethuman_teleported[client], Result);
|
||||
GetVectorAngles(Result, Result);
|
||||
TeleportEntity(client, NULL_VECTOR, Result, NULL_VECTOR);
|
||||
if (!distance_check(client))
|
||||
reset_target_human_tp_coord(client);
|
||||
continue;
|
||||
}
|
||||
target_enemy[client] = GetClosestClient_option1(targeteam == 2 ? 3 : 2, client);
|
||||
targethuman[client] = GetClosestClient_option1(targeteam == 2 ? 2 : 3, client);
|
||||
float enemy_distance = -1.0;
|
||||
float dist_target = -1.0;
|
||||
float pos[3];
|
||||
if (IsValidClient(targethuman[client]))
|
||||
{
|
||||
GetEntPropVector(targethuman[client], Prop_Send, "m_vecOrigin", pos);
|
||||
dist_target = get_power_distance(client, pos);
|
||||
}
|
||||
|
||||
//TODO maybe disable if requested
|
||||
if (IsValidClient(target_enemy[client]))
|
||||
{
|
||||
GetEntPropVector(target_enemy[client], Prop_Send, "m_vecOrigin", pos);
|
||||
enemy_distance = get_power_distance(client, pos);
|
||||
}
|
||||
if ((0 < enemy_distance && targeteam == 2) || dist_target < 0 < enemy_distance)
|
||||
{
|
||||
float feet_origin[3], enemy_feet_origin[3];
|
||||
GetClientAbsOrigin(client, feet_origin);
|
||||
GetClientAbsOrigin(target_enemy[client], enemy_feet_origin);
|
||||
if (feet_origin[2] + 100 > enemy_feet_origin[2])
|
||||
face_call(target_enemy[client], client);
|
||||
}
|
||||
else if (0 < dist_target)
|
||||
face_call(targethuman[client], client);
|
||||
trace_hulling_bot(client);
|
||||
char message[generic_length * 7];
|
||||
if (IsValidClient(targethuman[client]))
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman[client]: %N enemy_distance: %f targeteam: %i", dist_target, targethuman[client], enemy_distance, targeteam);
|
||||
else
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman[client]: none enemy_distance: %f targeteam: %i", dist_target, enemy_distance, targeteam);
|
||||
if (IsValidClient(target_enemy[client]))
|
||||
Format(message, sizeof(message), "%s target_enemy[client]: %N", message, target_enemy[client]);
|
||||
else
|
||||
Format(message, sizeof(message), "%s target_enemy[client]: none", message);
|
||||
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(message, strlen(message));
|
||||
}
|
||||
}
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
//https://developer.valvesoftware.com/wiki/Dimensions
|
||||
@ -415,10 +443,10 @@ public void trace_hulling_bot(int client)
|
||||
float stand_min = 63.0;
|
||||
float feet_origin[3], mins[3], maxs[3], eye_position[3];
|
||||
int BOUNDINGBOX_INFLATION_OFFSET = 3;
|
||||
GetClientEyePosition(present[client], eye_position);
|
||||
GetClientAbsOrigin(present[client], feet_origin);
|
||||
GetClientMins(present[client], mins);
|
||||
GetClientMaxs(present[client], maxs);
|
||||
GetClientEyePosition(client, eye_position);
|
||||
GetClientAbsOrigin(client, feet_origin);
|
||||
GetClientMins(client, mins);
|
||||
GetClientMaxs(client, maxs);
|
||||
//increasing boxes sizes
|
||||
for (int ij = 0; ij < sizeof(mins) - 1; ij++)
|
||||
{
|
||||
@ -439,7 +467,16 @@ public void trace_hulling_bot(int client)
|
||||
{
|
||||
//can crouch
|
||||
Format(message, sizeof(message), "hull info:crouch");
|
||||
send_socket_msg(message, strlen(message));
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(message, strlen(message));
|
||||
}
|
||||
return;
|
||||
}
|
||||
//something blocks floor crouch
|
||||
@ -449,7 +486,16 @@ public void trace_hulling_bot(int client)
|
||||
{
|
||||
//should not block jump level
|
||||
Format(message, sizeof(message), "hull info:jump");
|
||||
send_socket_msg(message, strlen(message));
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(message, strlen(message));
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
@ -472,14 +518,32 @@ public void trace_hulling_bot(int client)
|
||||
if (!(TR_DidHit()))
|
||||
{
|
||||
Format(message, sizeof(message), "hull info:jump");
|
||||
send_socket_msg(message, strlen(message));
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(message, strlen(message));
|
||||
}
|
||||
return;
|
||||
}
|
||||
TR_TraceHullFilter(eye_position, eye_position, mins, maxs, MASK_ALL, TraceRayDontHitSelf);
|
||||
if (!(TR_DidHit()))
|
||||
{
|
||||
Format(message, sizeof(message), "hull info:jump");
|
||||
send_socket_msg(message, strlen(message));
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(message, strlen(message));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (jj == 0)
|
||||
@ -490,13 +554,13 @@ public void trace_hulling_bot(int client)
|
||||
}
|
||||
//currently detects when two walls meet and create a corner
|
||||
float move_angles[3];
|
||||
if (GetEntityMoveType(present[client]) != MOVETYPE_LADDER)
|
||||
if (GetEntityMoveType(client) != MOVETYPE_LADDER)
|
||||
{
|
||||
GetClientEyeAngles(present[client], move_angles);
|
||||
GetClientEyeAngles(client, move_angles);
|
||||
move_angles[0] = 0.0;
|
||||
move_angles[1] += 35.0;
|
||||
move_angles[2] = 0.0;
|
||||
TeleportEntity(present[client], NULL_VECTOR, move_angles, NULL_VECTOR);
|
||||
TeleportEntity(client, NULL_VECTOR, move_angles, NULL_VECTOR);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -537,7 +601,16 @@ public void check_bot_surfing()
|
||||
surf_cooldown = true;
|
||||
TeleportEntity(present[client], NULL_VECTOR, vPlane, NULL_VECTOR);
|
||||
Format(keyinput, sizeof(keyinput), "surfing: %f %f %f", vPlane[0], vPlane[1], vPlane[2]);
|
||||
send_socket_msg(keyinput, strlen(keyinput));
|
||||
char auth[50];
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
send_socket_msg(keyinput, strlen(keyinput));
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
send_socket_msg1(keyinput, strlen(keyinput));
|
||||
}
|
||||
CreateTimer(0.5, surf_cooldown_timer);
|
||||
}
|
||||
}
|
||||
@ -598,13 +671,13 @@ public int GetClosestClient_option1(int targeteam, int client)
|
||||
float nearestdistance = -1.0;
|
||||
int nearest = -1;
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam && i != present[client])
|
||||
if (IsValidClient(i) && IsPlayerAlive(i) && GetClientTeam(i) == targeteam)
|
||||
{
|
||||
if (!IsAbleToSee(present[client], i))
|
||||
if (!IsAbleToSee(client, i))
|
||||
continue;
|
||||
if (is_client_stuck_or_afk(i))
|
||||
{
|
||||
if (i != targethuman)
|
||||
if (i != targethuman[client])
|
||||
continue;
|
||||
target_human_afk_counter++;
|
||||
int afk_cap = 9;
|
||||
@ -614,19 +687,19 @@ public int GetClosestClient_option1(int targeteam, int client)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (i == targethuman)
|
||||
return targethuman;
|
||||
if (i == targethuman[client])
|
||||
return targethuman[client];
|
||||
float pos[3];
|
||||
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
|
||||
float dist_target = get_power_distance(present[client], pos);
|
||||
if (GetClientTeam(present[client]) == 3 && IsValidClient(target_enemy) && targeteam == 3)
|
||||
float dist_target = get_power_distance(client, pos);
|
||||
if (GetClientTeam(client) == 3 && IsValidClient(target_enemy[client]) && targeteam == 3)
|
||||
{
|
||||
float enemey_cap = 1500.0;
|
||||
float enemy_dist = get_power_distance(target_enemy, pos);
|
||||
float enemy_dist = get_power_distance(target_enemy[client], pos);
|
||||
if (enemy_dist < enemey_cap)
|
||||
dist_target += enemey_cap;
|
||||
}
|
||||
if (admins[i] || vips[i] || i == target_enemy)
|
||||
if (admins[i] || vips[i] || i == target_enemy[client])
|
||||
dist_target /= 5;
|
||||
if (nearestdistance < 0 || dist_target < nearestdistance)
|
||||
{
|
||||
@ -651,16 +724,15 @@ public void OnClientPostAdminCheck(int client)
|
||||
//[U:1:120378081]
|
||||
//[U:1:69566635]
|
||||
char auth[50];
|
||||
present[client] = 0;
|
||||
GetClientAuthId(client, AuthId_Engine, auth, sizeof(auth));
|
||||
if (StrEqual("[U:1:120378081]", auth, false) || StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
present[client] = client;
|
||||
present[0] = client;
|
||||
bot_send_connected_msg(0);
|
||||
}
|
||||
if (StrEqual("[U:1:1036189204]", auth, false) || StrEqual("STEAM_0:0:518094602", auth, false))
|
||||
{
|
||||
present[client] = client;
|
||||
present[1] = client;
|
||||
bot_send_connected_msg(1);
|
||||
}
|
||||
if (CheckCommandAccess(client, "sm_kick", ADMFLAG_KICK))
|
||||
@ -688,12 +760,11 @@ stock void connect_socket()
|
||||
SocketSetOption(global_socket, SocketReuseAddr, 1);
|
||||
SocketBind(global_socket, "127.0.0.1", 48475);
|
||||
SocketConnect(global_socket, OnSocketConnected, OnSocketReceive, OnSocketDisconnected, "127.0.0.1", 48475);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
present[client] = 0;
|
||||
admins[client] = false;
|
||||
vips[client] = false;
|
||||
client_old_coords[client][0] = 0.0;
|
||||
|
Loading…
Reference in New Issue
Block a user