Untitled
unknown
c_cpp
6 months ago
4.4 kB
4
Indexable
std::string DeviceLocalIP = "192.168.15.36"; int MoveMouseWifi(int x, int y, bool click) { static bool once = false; if (!once) { WSADATA wsaData; int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); if (iResult != 0) { return 0; } once = true; } std::string msgFromClient = std::to_string(x) + ":" + std::to_string(y) + ":" + std::to_string(click); const char* bytesToSend = msgFromClient.c_str(); std::string hostname{ DeviceLocalIP }; uint16_t port = 1234; int sock = ::socket(AF_INET, SOCK_DGRAM, 0); sockaddr_in destination; destination.sin_family = AF_INET; destination.sin_port = htons(port); destination.sin_addr.s_addr = inet_addr(hostname.c_str()); int n_bytes = ::sendto(sock, msgFromClient.c_str(), msgFromClient.length(), 0, reinterpret_cast<sockaddr*>(&destination), sizeof(destination)); //std::cout << n_bytes << " bytes sent" << std::endl; #ifdef _WIN32 closesocket(sock); #else ::shutdown(sock, SHUT_RDWR); ::close(sock); #endif return 0; } void move(float x, float y) { Vector2 center(settings::width / 2, settings::height / 2); Vector3 target(0, 0, 0); if (x != 0) { if (x > center.x) { target.x = -(center.x - x); target.x /= (settings::aimbot::smoothness); if (target.x + center.x > center.x * 2) target.x = 0; } if (x < center.x) { target.x = x - center.x; target.x /= (settings::aimbot::smoothness); if (target.x + center.x < 0) target.x = 0; } } if (y != 0) { if (y > center.y) { target.y = -(center.y - y); target.y /= (settings::aimbot::smoothness); if (target.y + center.y > center.y * 2) target.y = 0; } if (y < center.y) { target.y = y - center.y; target.y /= (settings::aimbot::smoothness); if (target.y + center.y < 0) target.y = 0; } } const float snapThreshold = 1.0f; if (std::abs(target.x) < snapThreshold) { target.x = 0; } if (std::abs(target.y) < snapThreshold) { target.y = 0; } if (settings::misc::raspberry) { MoveMouseWifi(target.x, target.y + 1, 0); } if (settings::kmbox::kmboxnet) { kmNet_mouse_move(target.x, target.y); } } void do_aimbot(Vector2 target) { if (settings::aimbot::key) { if (mem.GetKeyboard()->IsKeyDown(VK_RBUTTON)) { move(target.x, target.y); } } else { move(target.x, target.y); } } void aimbot() { const Vector2 screen_center(settings::screen_center_x, settings::screen_center_y); const float fov_radius_squared = pow(settings::aimbot::fov / 2.0f, 2); float closest_meter_distance = FLT_MAX; float closest_screen_distance_squared = FLT_MAX; const EntityData* best_target = nullptr; for (const auto& entity : entities) { if (entity.player_team == localPlayer::teamId || !entity.visible || entity.player_distance > settings::visuals::distance_render) { continue; } const float dx = entity.player_screen.x - screen_center.x; const float dy = entity.player_screen.y - screen_center.y; const float screen_distance_squared = dx * dx + dy * dy; // L�gica do aimbot if (screen_distance_squared <= fov_radius_squared && entity.stance != 3) { if (entity.player_distance < closest_meter_distance || (entity.player_distance == closest_meter_distance && screen_distance_squared < closest_screen_distance_squared)) { closest_meter_distance = entity.player_distance; closest_screen_distance_squared = screen_distance_squared; best_target = &entity; } } } if (best_target && settings::aimbot::enable) { //draw_circle(best_target->head_screen.x, best_target->head_screen.y + 20, ImColor(255, 0, 0), 3); do_aimbot(Vector2(best_target->head_screen.x, best_target->head_screen.y + 20)); } }
Editor is loading...
Leave a Comment