forked from icantstandpeople/potassium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMisc.cpp
More file actions
60 lines (55 loc) · 1.91 KB
/
Misc.cpp
File metadata and controls
60 lines (55 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "Misc.h"
#include "Util.h"
CMisc gMisc;
void CMisc::Run(CBaseEntity* pLocal, CUserCmd* pCommand)
{
if (gCvars.misc_bunnyhop) {
// say bye to stick's gay 1 line bunny hop, XD, owned!
// credits: josh
static bool firstjump = 0, fakejmp;
if (pCommand->buttons & IN_JUMP)
if (!firstjump)
firstjump = fakejmp = 1;
else if (!(pLocal->GetFlags() & FL_ONGROUND))
if (fakejmp)
fakejmp = 0;
else
pCommand->buttons &= ~IN_JUMP;
else
fakejmp = 1;
else
firstjump = 0;
}
if (!(pLocal->GetFlags() & FL_ONGROUND) && pCommand->buttons & IN_JUMP)
{
//Autostrafe
if (gCvars.misc_autostrafe)
if (pCommand->mousedx > 1 || pCommand->mousedx < -1) //> 1 < -1 so we have some wiggle room
pCommand->sidemove = pCommand->mousedx > 1 ? 450.f : -450.f;
}
if (gCvars.misc_noisemaker_spam)
{
PVOID kv = Util->InitKeyValue();
if (kv != NULL)
{
NoisemakerSpam(kv);
gInts.Engine->ServerCmdKeyValues(kv);
}
}
}
//Could be much simpler, but I don't want keyvals class
void CMisc::NoisemakerSpam(PVOID kv) //Credits gir https://www.unknowncheats.me/forum/team-fortress-2-a/141108-infinite-noisemakers.html
{
char chCommand[30] = "use_action_slot_item_server";
typedef int(__cdecl* HashFunc_t)(const char*, bool);
static DWORD dwHashFunctionLocation = gSignatures.GetClientSignature("FF 15 ? ? ? ? 83 C4 08 89 06 8B C6");
static HashFunc_t s_pfGetSymbolForString = (HashFunc_t)**(PDWORD*)(dwHashFunctionLocation + 0x2);
*(PDWORD)((DWORD)kv + 0x4) = 0;
*(PDWORD)((DWORD)kv + 0x8) = 0;
*(PDWORD)((DWORD)kv + 0xC) = 0;
*(PDWORD)((DWORD)kv + 0x10) = /*0x10000*/0xDEADBEEF;
*(PDWORD)((DWORD)kv + 0x14) = 0;
*(PDWORD)((DWORD)kv + 0x18) = 0; //Extra one the game isn't doing, but if you don't zero this out, the game crashes.
*(PDWORD)((DWORD)kv + 0x1C) = 0;
*(PDWORD)((DWORD)kv + 0) = s_pfGetSymbolForString(chCommand, 1);
}