diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index 0a1b0a2a..d8c65780 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -274,7 +274,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float public Action recursive_pressing(Handle timer, any data) { - if (IsValidClient(present) && IsPlayerAlive(present)) + if (IsValidClient(present)) { if (GetClientTeam(present) == 1) { @@ -282,113 +282,116 @@ public Action recursive_pressing(Handle timer, any data) bot_send_connected_msg(); return Plugin_Continue; } - char message[generic_length * 7]; - float present_bot_coords[3]; - GetClientAbsOrigin(present, present_bot_coords); - int targeteam = 0; - if (GetClientTeam(present) != 3) + if (IsPlayerAlive(present)) { - //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; - } - bool find_closest_match = true; - - //check ladder = 0, water = 1, in air(surfing) = 2, downhill = 3, teleporter = 4 - int bot_on_type = -1; - if (GetEntityMoveType(present) == MOVETYPE_LADDER) - bot_on_type = 0; - int ilevel = GetEntProp(present, Prop_Data, "m_nWaterLevel"); - if (ilevel >= 2) - bot_on_type = 1; - if (bot_surf_plane) - bot_on_type = 2; - if (bot_on_type == -1) - bot_on_type = check_bot_downhill(); - if (targethuman_teleported[0] != 0.0) - { - bot_on_type = 4; - float ClientPos[3]; - float Result[3]; - GetClientEyePosition(present, ClientPos); - MakeVectorFromPoints(ClientPos, targethuman_teleported, Result); - GetVectorAngles(Result, Result); - TeleportEntity(present, NULL_VECTOR, Result, NULL_VECTOR); - if (!distance_check()) - reset_target_human_tp_coord(); - } - if (IsValidClient(targethuman) && GetClientTeam(targethuman) == targeteam && IsPlayerAlive(targethuman) && bot_on_type != 0 && bot_on_type != 2 - && bot_on_type != 4) - { - face_call(targethuman); - find_closest_match = is_client_stuck_or_afk(targethuman); - if (!find_closest_match || admins[targethuman] || vips[targethuman]) + char message[generic_length * 7]; + float present_bot_coords[3]; + GetClientAbsOrigin(present, present_bot_coords); + int targeteam = 0; + if (GetClientTeam(present) != 3) { - face_call(targethuman); - find_closest_match = IsAbleToSee(present, targethuman) ? false : true; + //2 = autismo is zm and should follow closest moving zm + targeteam = 2; } - } - if (find_closest_match && bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4) - { - targethuman = 0; - targethuman = GetClosestClient_option1(present, targeteam); - } - float enemy_distance = -1.0; - int target_enemy = find_closest_enemy(present, targeteam); - bool chasing_enemy = false; - float dist_target = -1.0; - int crouch_or_jump = 0; - if (bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4) - { - float pos[3]; - if (IsValidClient(targethuman)) - { - GetEntPropVector(targethuman, Prop_Send, "m_vecOrigin", pos); - dist_target = get_power_distance(present, pos); - } - if (IsValidClient(target_enemy)) - { - float min_enemy_distance = 100.0; - GetEntPropVector(target_enemy, Prop_Send, "m_vecOrigin", pos); - enemy_distance = get_power_distance(present, pos); - //human aiming for zombie - if (targeteam == 3) - { - float min_distance_target_human = 0.1; - if (0 < dist_target <= min_distance_target_human && enemy_distance > min_enemy_distance) - { - chasing_enemy = true; - face_call(target_enemy); - } - else if (!IsValidClient(targethuman)) - { - chasing_enemy = true; - face_call(target_enemy); - } - } - //zombie aiming for human - if (targeteam == 2 && 0 < enemy_distance) - { - chasing_enemy = true; - face_call(target_enemy); - } - } - if (IsValidClient(targethuman) && !chasing_enemy) - face_call(targethuman); - //0: nothing, 2: crouch, 3: jump - crouch_or_jump = wall_circle(); - } - if (bot_on_type != 2) - { - if (IsValidClient(targethuman)) - Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, crouch_or_jump, targeteam); else - Format(message, sizeof(message), "dist_target: %f targethuman: none bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, bot_on_type, enemy_distance, crouch_or_jump, targeteam); - send_socket_msg(message, strlen(message)); + { + //3 = autismo is human and should follow closest moving ct + targeteam = 3; + } + bool find_closest_match = true; + + //check ladder = 0, water = 1, in air(surfing) = 2, downhill = 3, teleporter = 4 + int bot_on_type = -1; + if (GetEntityMoveType(present) == MOVETYPE_LADDER) + bot_on_type = 0; + int ilevel = GetEntProp(present, Prop_Data, "m_nWaterLevel"); + if (ilevel >= 2) + bot_on_type = 1; + if (bot_surf_plane) + bot_on_type = 2; + if (bot_on_type == -1) + bot_on_type = check_bot_downhill(); + if (targethuman_teleported[0] != 0.0) + { + bot_on_type = 4; + float ClientPos[3]; + float Result[3]; + GetClientEyePosition(present, ClientPos); + MakeVectorFromPoints(ClientPos, targethuman_teleported, Result); + GetVectorAngles(Result, Result); + TeleportEntity(present, NULL_VECTOR, Result, NULL_VECTOR); + if (!distance_check()) + reset_target_human_tp_coord(); + } + if (IsValidClient(targethuman) && GetClientTeam(targethuman) == targeteam && IsPlayerAlive(targethuman) && bot_on_type != 0 && bot_on_type != 2 + && bot_on_type != 4) + { + face_call(targethuman); + find_closest_match = is_client_stuck_or_afk(targethuman); + if (!find_closest_match || admins[targethuman] || vips[targethuman]) + { + face_call(targethuman); + find_closest_match = IsAbleToSee(present, targethuman) ? false : true; + } + } + if (find_closest_match && bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4) + { + targethuman = 0; + targethuman = GetClosestClient_option1(present, targeteam); + } + float enemy_distance = -1.0; + int target_enemy = find_closest_enemy(present, targeteam); + bool chasing_enemy = false; + float dist_target = -1.0; + int crouch_or_jump = 0; + if (bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4) + { + float pos[3]; + if (IsValidClient(targethuman)) + { + GetEntPropVector(targethuman, Prop_Send, "m_vecOrigin", pos); + dist_target = get_power_distance(present, pos); + } + if (IsValidClient(target_enemy)) + { + float min_enemy_distance = 100.0; + GetEntPropVector(target_enemy, Prop_Send, "m_vecOrigin", pos); + enemy_distance = get_power_distance(present, pos); + //human aiming for zombie + if (targeteam == 3) + { + float min_distance_target_human = 0.1; + if (0 < dist_target <= min_distance_target_human && enemy_distance > min_enemy_distance) + { + chasing_enemy = true; + face_call(target_enemy); + } + else if (!IsValidClient(targethuman)) + { + chasing_enemy = true; + face_call(target_enemy); + } + } + //zombie aiming for human + if (targeteam == 2 && 0 < enemy_distance) + { + chasing_enemy = true; + face_call(target_enemy); + } + } + if (IsValidClient(targethuman) && !chasing_enemy) + face_call(targethuman); + //0: nothing, 2: crouch, 3: jump + crouch_or_jump = wall_circle(); + } + if (bot_on_type != 2) + { + if (IsValidClient(targethuman)) + Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, crouch_or_jump, targeteam); + else + Format(message, sizeof(message), "dist_target: %f targethuman: none bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, bot_on_type, enemy_distance, crouch_or_jump, targeteam); + send_socket_msg(message, strlen(message)); + } } } return Plugin_Continue;