Skip to content

Commit

Permalink
added teleport players hack
Browse files Browse the repository at this point in the history
  • Loading branch information
rdbo committed Jan 14, 2021
1 parent 8797a80 commit 56583cc
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 1 deletion.
1 change: 1 addition & 0 deletions AssaultCube-Multihack.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
<ClCompile Include="src\hacks\NoScope.cpp" />
<ClCompile Include="src\hacks\Speedhack.cpp" />
<ClCompile Include="src\hacks\Teleport.cpp" />
<ClCompile Include="src\hacks\TeleportPlayers.cpp" />
<ClCompile Include="src\hacks\Triggerbot.cpp" />
<ClCompile Include="src\hooks\attackphysics.cpp" />
<ClCompile Include="src\hooks\c2sinfo.cpp" />
Expand Down
3 changes: 3 additions & 0 deletions AssaultCube-Multihack.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@
<ClCompile Include="src\hooks\drawscope.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\hacks\TeleportPlayers.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\pch.h">
Expand Down
5 changes: 5 additions & 0 deletions src/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 6 additions & 0 deletions src/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -128,6 +133,7 @@ namespace Base
void Triggerbot();
void FlyHack();
void NoScope();
void TeleportPlayers(playerent* p_ent);
}

namespace Hooks
Expand Down
6 changes: 5 additions & 1 deletion src/game.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class playerinfo_t
bool is_valid = false;
playerent* ent = nullptr;
vec pos2D = {};
vec pos3D = {};
vec headpos3D = {};
vec headpos2D = {};

Expand All @@ -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);
}

Expand Down
20 changes: 20 additions & 0 deletions src/hacks/TeleportPlayers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <pch.h>
#include <base.h>

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;
}

}
}
16 changes: 16 additions & 0 deletions src/hooks/SwapBuffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions src/hooks/c2sinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 2 additions & 0 deletions src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#define WIN32_LEAN_AND_MEAN
#endif

#include <iostream>
#include <cmath>
#include <Windows.h>
#include <WinSock2.h>
#include <assaultcube/sdk.h>
Expand Down

0 comments on commit 56583cc

Please sign in to comment.