From 56583cc2b9695a1d07e612a9711e8af8e5c952d5 Mon Sep 17 00:00:00 2001 From: rdbo Date: Thu, 14 Jan 2021 01:34:04 -0300 Subject: [PATCH] added teleport players hack --- AssaultCube-Multihack.vcxproj | 1 + AssaultCube-Multihack.vcxproj.filters | 3 +++ src/base.cpp | 5 +++++ src/base.h | 6 ++++++ src/game.h | 6 +++++- src/hacks/TeleportPlayers.cpp | 20 ++++++++++++++++++++ src/hooks/SwapBuffers.cpp | 16 ++++++++++++++++ src/hooks/c2sinfo.cpp | 9 +++++++++ src/pch.h | 2 ++ 9 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 src/hacks/TeleportPlayers.cpp diff --git a/AssaultCube-Multihack.vcxproj b/AssaultCube-Multihack.vcxproj index cb03840..6b85e76 100644 --- a/AssaultCube-Multihack.vcxproj +++ b/AssaultCube-Multihack.vcxproj @@ -220,6 +220,7 @@ + diff --git a/AssaultCube-Multihack.vcxproj.filters b/AssaultCube-Multihack.vcxproj.filters index 605eaa1..75a5f8b 100644 --- a/AssaultCube-Multihack.vcxproj.filters +++ b/AssaultCube-Multihack.vcxproj.filters @@ -108,6 +108,9 @@ Source Files + + Source Files + diff --git a/src/base.cpp b/src/base.cpp index 1d2176e..f1470c4 100644 --- a/src/base.cpp +++ b/src/base.cpp @@ -89,6 +89,11 @@ bool Base::Data::Settings::EnableFlyHack = false; bool Base::Data::Settings::EnableNoScope = false; +bool Base::Data::Settings::EnableTeleportPlayers = false; +float Base::Data::Settings::TeleportPlayersDistance = 5.0f; +bool Base::Data::Settings::TeleportPlayersTeam = false; +bool Base::Data::Settings::TeleportPlayersEnemy = true; + DWORD WINAPI ExitThread(LPVOID lpReserved); void Base::Init(HMODULE hMod) diff --git a/src/base.h b/src/base.h index 0c7ae74..c9c23d9 100644 --- a/src/base.h +++ b/src/base.h @@ -108,6 +108,11 @@ namespace Base extern bool EnableFlyHack; extern bool EnableNoScope; + + extern bool EnableTeleportPlayers; + extern float TeleportPlayersDistance; + extern bool TeleportPlayersTeam; + extern bool TeleportPlayersEnemy; } namespace Keys @@ -128,6 +133,7 @@ namespace Base void Triggerbot(); void FlyHack(); void NoScope(); + void TeleportPlayers(playerent* p_ent); } namespace Hooks diff --git a/src/game.h b/src/game.h index eab024b..6812d2c 100644 --- a/src/game.h +++ b/src/game.h @@ -80,6 +80,7 @@ class playerinfo_t bool is_valid = false; playerent* ent = nullptr; vec pos2D = {}; + vec pos3D = {}; vec headpos3D = {}; vec headpos2D = {}; @@ -100,7 +101,10 @@ class playerinfo_t this->headpos3D = this->ent->head; if (this->headpos3D.x == -1.0f || this->headpos3D.y == -1.0f || this->headpos2D.z == -1.0f) this->headpos3D = this->ent->o; - check &= WorldToScreen(this->ent->newpos, &this->pos2D); + this->pos3D = this->ent->o; + this->pos3D.z -= this->ent->eyeheight; + //this->pos3D = this->ent->newpos; + check &= WorldToScreen(this->pos3D, &this->pos2D); check &= WorldToScreen(this->headpos3D, &this->headpos2D); } diff --git a/src/hacks/TeleportPlayers.cpp b/src/hacks/TeleportPlayers.cpp new file mode 100644 index 0000000..7f887ee --- /dev/null +++ b/src/hacks/TeleportPlayers.cpp @@ -0,0 +1,20 @@ +#include +#include + +void Base::Hacks::TeleportPlayers(playerent* p_ent) +{ + if (Data::Settings::EnableTeleportPlayers) + { + if (Data::Settings::TeleportPlayersTeam && p_ent->team == Data::game.player1->team && (m_teammode || m_coop) || Data::Settings::TeleportPlayersEnemy && p_ent->team != Data::game.player1->team) + { + vec pos = Data::game.player1->o; + float yaw = Data::game.player1->yaw; + yaw -= 90.0f; + if (yaw < 0.0f) yaw += 360.0f; + pos.x += cos(yaw * (PI / 180.0f)) * Data::Settings::TeleportPlayersDistance; + pos.y += sin(yaw * (PI / 180.0f)) * Data::Settings::TeleportPlayersDistance; + p_ent->o = pos; + } + + } +} \ No newline at end of file diff --git a/src/hooks/SwapBuffers.cpp b/src/hooks/SwapBuffers.cpp index 8c03b19..86f1a74 100644 --- a/src/hooks/SwapBuffers.cpp +++ b/src/hooks/SwapBuffers.cpp @@ -56,6 +56,22 @@ BOOL __stdcall Base::Hooks::SwapBuffers(_In_ HDC hdc) ImGui::Begin("ImGui Window"); ImGui::Text("Test ImGUI Window"); + if (Data::game.player1) + { + ImGui::Text("Pitch: %.1f", Data::game.player1->pitch); + ImGui::Text("Yaw: %.1f", Data::game.player1->yaw); + ImGui::Text("New Pitch: %.1f", Data::game.player1->newpitch); + ImGui::Text("New Yaw: %.1f", Data::game.player1->newyaw); + } + + ImGui::Checkbox("Teleport Players", &Data::Settings::EnableTeleportPlayers); + if (Data::Settings::EnableTeleportPlayers) + { + ImGui::SliderFloat("Teleport Distance", &Data::Settings::TeleportPlayersDistance, 0.0f, 10.0f, "%.1f"); + ImGui::Checkbox("Teleport Team", &Data::Settings::TeleportPlayersTeam); + ImGui::Checkbox("Teleport Enemy", &Data::Settings::TeleportPlayersEnemy); + } + ImGui::Checkbox("No Scope", &Data::Settings::EnableNoScope); ImGui::Checkbox("Fly Hack", &Data::Settings::EnableFlyHack); diff --git a/src/hooks/c2sinfo.cpp b/src/hooks/c2sinfo.cpp index 6c5e962..dd30320 100644 --- a/src/hooks/c2sinfo.cpp +++ b/src/hooks/c2sinfo.cpp @@ -7,5 +7,14 @@ void Base::Hooks::c2sinfo(playerent* d) Hacks::Speedhack(); Hacks::Triggerbot(); Hacks::FlyHack(); + + for (int i = 0; Data::game.players && Data::game.players->inrange(i); i++) + { + playerent* ent = Data::game.players->operator[](i); + if (!ent) continue; + + Hacks::TeleportPlayers(ent); + } + return Data::o_c2sinfo(d); } \ No newline at end of file diff --git a/src/pch.h b/src/pch.h index a990e85..c7bc00f 100644 --- a/src/pch.h +++ b/src/pch.h @@ -6,6 +6,8 @@ #define WIN32_LEAN_AND_MEAN #endif +#include +#include #include #include #include