Skip to content

Commit 56583cc

Browse files
committed
added teleport players hack
1 parent 8797a80 commit 56583cc

File tree

9 files changed

+67
-1
lines changed

9 files changed

+67
-1
lines changed

AssaultCube-Multihack.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@
220220
<ClCompile Include="src\hacks\NoScope.cpp" />
221221
<ClCompile Include="src\hacks\Speedhack.cpp" />
222222
<ClCompile Include="src\hacks\Teleport.cpp" />
223+
<ClCompile Include="src\hacks\TeleportPlayers.cpp" />
223224
<ClCompile Include="src\hacks\Triggerbot.cpp" />
224225
<ClCompile Include="src\hooks\attackphysics.cpp" />
225226
<ClCompile Include="src\hooks\c2sinfo.cpp" />

AssaultCube-Multihack.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
<ClCompile Include="src\hooks\drawscope.cpp">
109109
<Filter>Source Files</Filter>
110110
</ClCompile>
111+
<ClCompile Include="src\hacks\TeleportPlayers.cpp">
112+
<Filter>Source Files</Filter>
113+
</ClCompile>
111114
</ItemGroup>
112115
<ItemGroup>
113116
<ClInclude Include="src\pch.h">

src/base.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ bool Base::Data::Settings::EnableFlyHack = false;
8989

9090
bool Base::Data::Settings::EnableNoScope = false;
9191

92+
bool Base::Data::Settings::EnableTeleportPlayers = false;
93+
float Base::Data::Settings::TeleportPlayersDistance = 5.0f;
94+
bool Base::Data::Settings::TeleportPlayersTeam = false;
95+
bool Base::Data::Settings::TeleportPlayersEnemy = true;
96+
9297
DWORD WINAPI ExitThread(LPVOID lpReserved);
9398

9499
void Base::Init(HMODULE hMod)

src/base.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ namespace Base
108108
extern bool EnableFlyHack;
109109

110110
extern bool EnableNoScope;
111+
112+
extern bool EnableTeleportPlayers;
113+
extern float TeleportPlayersDistance;
114+
extern bool TeleportPlayersTeam;
115+
extern bool TeleportPlayersEnemy;
111116
}
112117

113118
namespace Keys
@@ -128,6 +133,7 @@ namespace Base
128133
void Triggerbot();
129134
void FlyHack();
130135
void NoScope();
136+
void TeleportPlayers(playerent* p_ent);
131137
}
132138

133139
namespace Hooks

src/game.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class playerinfo_t
8080
bool is_valid = false;
8181
playerent* ent = nullptr;
8282
vec pos2D = {};
83+
vec pos3D = {};
8384
vec headpos3D = {};
8485
vec headpos2D = {};
8586

@@ -100,7 +101,10 @@ class playerinfo_t
100101
this->headpos3D = this->ent->head;
101102
if (this->headpos3D.x == -1.0f || this->headpos3D.y == -1.0f || this->headpos2D.z == -1.0f)
102103
this->headpos3D = this->ent->o;
103-
check &= WorldToScreen(this->ent->newpos, &this->pos2D);
104+
this->pos3D = this->ent->o;
105+
this->pos3D.z -= this->ent->eyeheight;
106+
//this->pos3D = this->ent->newpos;
107+
check &= WorldToScreen(this->pos3D, &this->pos2D);
104108
check &= WorldToScreen(this->headpos3D, &this->headpos2D);
105109
}
106110

src/hacks/TeleportPlayers.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <pch.h>
2+
#include <base.h>
3+
4+
void Base::Hacks::TeleportPlayers(playerent* p_ent)
5+
{
6+
if (Data::Settings::EnableTeleportPlayers)
7+
{
8+
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)
9+
{
10+
vec pos = Data::game.player1->o;
11+
float yaw = Data::game.player1->yaw;
12+
yaw -= 90.0f;
13+
if (yaw < 0.0f) yaw += 360.0f;
14+
pos.x += cos(yaw * (PI / 180.0f)) * Data::Settings::TeleportPlayersDistance;
15+
pos.y += sin(yaw * (PI / 180.0f)) * Data::Settings::TeleportPlayersDistance;
16+
p_ent->o = pos;
17+
}
18+
19+
}
20+
}

src/hooks/SwapBuffers.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ BOOL __stdcall Base::Hooks::SwapBuffers(_In_ HDC hdc)
5656
ImGui::Begin("ImGui Window");
5757
ImGui::Text("Test ImGUI Window");
5858

59+
if (Data::game.player1)
60+
{
61+
ImGui::Text("Pitch: %.1f", Data::game.player1->pitch);
62+
ImGui::Text("Yaw: %.1f", Data::game.player1->yaw);
63+
ImGui::Text("New Pitch: %.1f", Data::game.player1->newpitch);
64+
ImGui::Text("New Yaw: %.1f", Data::game.player1->newyaw);
65+
}
66+
67+
ImGui::Checkbox("Teleport Players", &Data::Settings::EnableTeleportPlayers);
68+
if (Data::Settings::EnableTeleportPlayers)
69+
{
70+
ImGui::SliderFloat("Teleport Distance", &Data::Settings::TeleportPlayersDistance, 0.0f, 10.0f, "%.1f");
71+
ImGui::Checkbox("Teleport Team", &Data::Settings::TeleportPlayersTeam);
72+
ImGui::Checkbox("Teleport Enemy", &Data::Settings::TeleportPlayersEnemy);
73+
}
74+
5975
ImGui::Checkbox("No Scope", &Data::Settings::EnableNoScope);
6076

6177
ImGui::Checkbox("Fly Hack", &Data::Settings::EnableFlyHack);

src/hooks/c2sinfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,14 @@ void Base::Hooks::c2sinfo(playerent* d)
77
Hacks::Speedhack();
88
Hacks::Triggerbot();
99
Hacks::FlyHack();
10+
11+
for (int i = 0; Data::game.players && Data::game.players->inrange(i); i++)
12+
{
13+
playerent* ent = Data::game.players->operator[](i);
14+
if (!ent) continue;
15+
16+
Hacks::TeleportPlayers(ent);
17+
}
18+
1019
return Data::o_c2sinfo(d);
1120
}

src/pch.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define WIN32_LEAN_AND_MEAN
77
#endif
88

9+
#include <iostream>
10+
#include <cmath>
911
#include <Windows.h>
1012
#include <WinSock2.h>
1113
#include <assaultcube/sdk.h>

0 commit comments

Comments
 (0)