diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index a3d0b349..fc9e1835 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -239,13 +239,13 @@ public Action bot_check_connect(Handle timer, any data) if (client_count > 61) { char msg[generic_length]; - if (StrContains(ip_addr, "127.0.0.1")) + if (StrEqual(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")) + else if (StrEqual(ip_addr, "164.132.201.173")) { KickClient(i, "server full you need to leave"); Format(msg, sizeof(msg), "bot kicked server full"); @@ -280,155 +280,159 @@ 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[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)) + if (client == present[0] || client == present[1]) { - 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()) + 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)) { - TR_GetEndPosition(ground_pos); - feet_origin[2] -= 10.0; - float ground_distance = GetVectorDistance(feet_origin, ground_pos); - if (ground_distance > 80) + 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 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()) + 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 forward_distance = GetVectorDistance(feet_origin, ground_pos); - if (forward_distance > 280) + 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()) { - if (IsValidClient(targethuman[client])) + TR_GetEndPosition(ground_pos); + feet_origin[2] -= 10.0; + float forward_distance = GetVectorDistance(feet_origin, ground_pos); + if (forward_distance > 280) { - 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]) + if (IsValidClient(targethuman[client])) { - buttons_old[client] = buttons; - flags_old[client] = flags; - return; + 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]) + { + buttons_old[client] = buttons; + flags_old[client] = flags; + return; + } } + 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); } - 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); } - TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel); + buttons_old[client] = buttons; + flags_old[client] = flags; } - 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)) return Plugin_Continue; - if (client != present[0] && client != present[1]) return Plugin_Continue; - if (GetClientTeam(client) == 1 || GetClientTeam(client) == 0) + if (!IsValidClient(client)) continue; + if (client == present[0] || client == present[1]) { - ChangeClientTeam(client, 2); - continue; - } - if (IsPlayerAlive(client)) - { - if (GetEntityMoveType(client) == MOVETYPE_LADDER) + 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; - 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); - } + } + 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)); - } + //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: %N enemy_distance: %f targeteam: %i", dist_target, targethuman[client], 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[client])) + Format(message, sizeof(message), "%s target_enemy: %N", message, target_enemy[client]); + else + Format(message, sizeof(message), "%s target_enemy: 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;