-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hooks.cpp
5122 lines (4832 loc) · 147 KB
/
Hooks.cpp
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*credits by ibanned*/
#include "LagComp.h"
#include "backtracking.h"
#include "Backtracking Rage.h"
//#include "Resolver.h"
#include "Hooks.h"
#include "Hacks.h"
#include "Chams.h"
#include "Menu.h"
#include "Interfaces.h"
#include "RenderManager.h"
#include "MiscHacks.h"
#include "CRC32.h"
#include "hitmarker.h"
#include <intrin.h>
#include "Entities.h"
#include "CBulletListener.h"
#include "damageindicator.h"
#define M_PI 3.14159265358979323846
extern float lineLBY;
extern float fakeangle;
extern float lineRealAngle;
extern float lineFakeAngle;
Vector LastAngleAAReal;
Vector LBYThirdpersonAngle;
#define MakePtr(cast, ptr, addValue) (cast)( (DWORD)(ptr) + (DWORD)(addValue))
#ifdef NDEBUG
#define strenc( s ) std::string( cx_make_encrypted_string( s ) )
#define charenc( s ) strenc( s ).c_str()
#define wstrenc( s ) std::wstring( strenc( s ).begin(), strenc( s ).end() )
#define wcharenc( s ) wstrenc( s ).c_str()
#else
#define strenc( s ) ( s )
#define charenc( s ) ( s )
#define wstrenc( s ) ( s )
#define wcharenc( s ) ( s )
#endif
#ifdef NDEBUG
#define XorStr( s ) ( XorCompileTime::XorString< sizeof( s ) - 1, __COUNTER__ >( s, std::make_index_sequence< sizeof( s ) - 1>() ).decrypt() )
#else
#define XorStr( s ) ( s )
#endif
/*includes*/
/*--------------------------------------------------------------*/
int currentfov;
Vector LastAngleAA;
bool Resolver::didhitHS;
CUserCmd* Globals::UserCmd;
IClientEntity* Globals::Target;
int Globals::Shots;
bool Globals::change;
int Globals::TargetID;
std::map<int, QAngle>Globals::storedshit;
int Globals::missedshots;
int bigboi::indicator;
/*--------------------------------------------------------------*/
typedef void(__thiscall* DrawModelEx_)(void*, void*, void*, const ModelRenderInfo_t&, matrix3x4*);
typedef void(__thiscall* PaintTraverse_)(PVOID, unsigned int, bool, bool);
typedef bool(__thiscall* InPrediction_)(PVOID);
typedef void(__stdcall *FrameStageNotifyFn)(ClientFrameStage_t);
typedef bool(__thiscall *FireEventClientSideFn)(PVOID, IGameEvent*);
typedef void(__thiscall* RenderViewFn)(void*, CViewSetup&, CViewSetup&, int, int);
using OverrideViewFn = void(__fastcall*)(void*, void*, CViewSetup*);
typedef float(__stdcall *oGetViewModelFOV)();
typedef void(__thiscall *SceneEnd_t)(void *pCmd);
PaintTraverse_ oPaintTraverse;
DrawModelEx_ oDrawModelExecute;
FrameStageNotifyFn oFrameStageNotify;
OverrideViewFn oOverrideView;
FireEventClientSideFn oFireEventClientSide;
RenderViewFn oRenderView;
SceneEnd_t pSceneEnd;
std::vector<trace_info> trace_logs;
void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce);
bool __stdcall Hooked_InPrediction();
bool __fastcall Hooked_FireEventClientSide(PVOID ECX, PVOID EDX, IGameEvent *Event);
void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld);
bool __stdcall CreateMoveClient_Hooked(float frametime, CUserCmd* pCmd);
void __stdcall Hooked_FrameStageNotify(ClientFrameStage_t curStage);
void __fastcall Hooked_OverrideView(void* ecx, void* edx, CViewSetup* pSetup);
void __fastcall Hooked_RenderView(void* ecx, void* edx, CViewSetup &setup, CViewSetup &hudViewSetup, int nClearFlags, int whatToDraw);
void __fastcall hkSceneEnd(void *pEcx, void *pEdx);
float __stdcall GGetViewModelFOV();
namespace Hooks
{
Utilities::Memory::VMTManager VMTPanel;
Utilities::Memory::VMTManager VMTClient;
Utilities::Memory::VMTManager VMTClientMode;
Utilities::Memory::VMTManager VMTModelRender;
Utilities::Memory::VMTManager VMTPrediction;
Utilities::Memory::VMTManager VMTRenderView;
Utilities::Memory::VMTManager VMTEventManager;
};
void Hooks::UndoHooks()
{
VMTPanel.RestoreOriginal();
VMTPrediction.RestoreOriginal();
VMTModelRender.RestoreOriginal();
VMTClientMode.RestoreOriginal();
}
void Hooks::Initialise()
{
Interfaces::Engine->ExecuteClientCmd("clear");
Interfaces::CVar->ConsoleColorPrintf(Color(252, 112, 231, 255), ("\n insert open menu \n"));
VMTPanel.Initialise((DWORD*)Interfaces::Panels);
oPaintTraverse = (PaintTraverse_)VMTPanel.HookMethod((DWORD)&PaintTraverse_Hooked, Offsets::VMT::Panel_PaintTraverse);
VMTPrediction.Initialise((DWORD*)Interfaces::Prediction);
VMTPrediction.HookMethod((DWORD)&Hooked_InPrediction, 14);
VMTModelRender.Initialise((DWORD*)Interfaces::ModelRender);
oDrawModelExecute = (DrawModelEx_)VMTModelRender.HookMethod((DWORD)&Hooked_DrawModelExecute, Offsets::VMT::ModelRender_DrawModelExecute);
VMTClientMode.Initialise((DWORD*)Interfaces::ClientMode);
VMTClientMode.HookMethod((DWORD)CreateMoveClient_Hooked, 24);
VMTRenderView.Initialise((DWORD*)Interfaces::RenderView);
pSceneEnd = (SceneEnd_t)VMTRenderView.HookMethod((DWORD)&hkSceneEnd, 9);
VMTClient.Initialise((DWORD*)Interfaces::Client);
oFrameStageNotify = (FrameStageNotifyFn)VMTClient.HookMethod((DWORD)&Hooked_FrameStageNotify, 36);
VMTEventManager.Initialise((DWORD*)Interfaces::EventManager);
oFireEventClientSide = (FireEventClientSideFn)VMTEventManager.HookMethod((DWORD)&Hooked_FireEventClientSide, 9);
oOverrideView = (OverrideViewFn)VMTClientMode.HookMethod((DWORD)&Hooked_OverrideView, 18);
VMTClientMode.HookMethod((DWORD)&GGetViewModelFOV, 35);
}
void MovementCorrection(CUserCmd* pCmd)
{
}
float clip(float n, float lower, float upper)
{
return (std::max)(lower, (std::min)(n, upper));
}
int LagCompBreak() {
IClientEntity *pLocalPlayer = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
Vector velocity = pLocalPlayer->GetVelocity();
velocity.z = 0;
float speed = velocity.Length();
if (speed > 0.f) {
auto distance_per_tick = speed *
Interfaces::Globals->interval_per_tick;
int choked_ticks = std::ceilf(65.f / distance_per_tick);
return std::min<int>(choked_ticks, 14);
}
return 1;
}
BYTE bMoveData[0x200];
/*pPa$te*/
void Prediction(CUserCmd* pCmd, IClientEntity* LocalPlayer)
{
if (Interfaces::MoveHelper && g_menu::window.RageBotTab.EnginePrediction.GetState() && LocalPlayer->IsAlive())
{
float curtime = Interfaces::Globals->curtime;
float frametime = Interfaces::Globals->frametime;
int iFlags = LocalPlayer->GetFlags();
Interfaces::Globals->curtime = (float)LocalPlayer->GetTickBase() * Interfaces::Globals->interval_per_tick;
Interfaces::Globals->frametime = Interfaces::Globals->interval_per_tick;
Interfaces::MoveHelper->SetHost(LocalPlayer);
BYTE bMoveData[0x200];
Interfaces::Prediction1->SetupMove(LocalPlayer, pCmd, nullptr, bMoveData);
Interfaces::GameMovement->ProcessMovement(LocalPlayer, bMoveData);
Interfaces::Prediction1->FinishMove(LocalPlayer, pCmd, bMoveData);
Interfaces::MoveHelper->SetHost(0);
Interfaces::Globals->curtime = curtime;
Interfaces::Globals->frametime = frametime;
*LocalPlayer->GetPointerFlags() = iFlags;
}
}
int kek = 0;
int autism = 0;
void SetClanTag(const char* tag, const char* name)//190% paste
{
static auto pSetClanTag = reinterpret_cast<void(__fastcall*)(const char*, const char*)>(((DWORD)Utilities::Memory::FindPattern("engine.dll", (PBYTE)"\x53\x56\x57\x8B\xDA\x8B\xF9\xFF\x15\x00\x00\x00\x00\x6A\x24\x8B\xC8\x8B\x30", "xxxxxxxxx????xxxxxx")));
pSetClanTag(tag, name);
}
void NoClantag()
{
SetClanTag("", "");
}
void ClanTag()
{
static int counter = 0;
switch (g_menu::window.MiscTab.OtherClantag.GetIndex())
{
case 0:
break;
case 1:
{
static int motion = 0;
int ServerTime = (float)Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase() * 3;
if (counter % 48 == 0)
motion++;
int value = ServerTime % 2;
switch (value) {
case 0:SetClanTag("fuckware", ""); break;
case 1:SetClanTag("1tap", ""); break;
}
counter++;
break;
}
case 2:
{
static int motion = 0;
int ServerTime = (float)Interfaces::Globals->interval_per_tick * hackManager.pLocal()->GetTickBase() * 3;
if (counter % 48 == 0)
motion++;
int value = ServerTime % 7;
switch (value) {
case 0:SetClanTag("fuckware ", ""); break;
case 1:SetClanTag("yougame.biz ", ""); break;
case 2:SetClanTag(" 0 101 10 ", ""); break;
case 3:SetClanTag("101 0 0 1 ", ""); break;
case 4:SetClanTag("0 01 10 1 ", ""); break;
case 5:SetClanTag("11 1 0 00 ", ""); break;
case 6:SetClanTag("1 0 11 1 0 ", ""); break;
}
counter++;
break;
}
}
}
bool flipAA;
bool __stdcall CreateMoveClient_Hooked(float frametime, CUserCmd* pCmd)
{
if (!pCmd->command_number)
return true;
IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && pLocal)
{
PVOID pebp;
__asm mov pebp, ebp;
bool* pbSendPacket = (bool*)(*(DWORD*)pebp - 0x1C);
bool& bSendPacket = *pbSendPacket;
if (g_menu::window.MiscTab.OtherClantag.GetIndex() > 0)
ClanTag();
Vector origView = pCmd->viewangles;
Vector viewforward, viewright, viewup, aimforward, aimright, aimup;
Vector qAimAngles;
qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
IClientEntity* pEntity;
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && pLocal && pLocal->IsAlive())
{
Hacks::MoveHacks(pCmd, bSendPacket);
ResolverSetup::GetInst().CM(pEntity);
}
backtracking->legitBackTrack(pCmd, pLocal);
backtracking->ragebacktrack(pCmd, pLocal);
static bool abc = false;
qAimAngles.Init(0.0f, GetAutostrafeView().y, 0.0f);
AngleVectors(qAimAngles, &viewforward, &viewright, &viewup);
qAimAngles.Init(0.0f, pCmd->viewangles.y, 0.0f);
AngleVectors(qAimAngles, &aimforward, &aimright, &aimup);
Vector vForwardNorm; Normalize(viewforward, vForwardNorm);
Vector vRightNorm; Normalize(viewright, vRightNorm);
Vector vUpNorm; Normalize(viewup, vUpNorm);
float forward = pCmd->forwardmove;
float right = pCmd->sidemove;
float up = pCmd->upmove;
if (forward > 450) forward = 450;
if (right > 450) right = 450;
if (up > 450) up = 450;
if (forward < -450) forward = -450;
if (right < -450) right = -450;
if (up < -450) up = -450;
pCmd->forwardmove = DotProduct(forward * vForwardNorm, aimforward) + DotProduct(right * vRightNorm, aimforward) + DotProduct(up * vUpNorm, aimforward);
pCmd->sidemove = DotProduct(forward * vForwardNorm, aimright) + DotProduct(right * vRightNorm, aimright) + DotProduct(up * vUpNorm, aimright);
pCmd->upmove = DotProduct(forward * vForwardNorm, aimup) + DotProduct(right * vRightNorm, aimup) + DotProduct(up * vUpNorm, aimup);
if (g_menu::window.MiscTab.OtherSafeMode.GetState())
{
GameUtils::NormaliseViewAngle(pCmd->viewangles);
if (pCmd->viewangles.z != 0.0f)
{
pCmd->viewangles.z = 0.00;
}
if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180)
{
Utilities::Log("Having to re-normalise!");
GameUtils::NormaliseViewAngle(pCmd->viewangles);
Beep(750, 800);
if (pCmd->viewangles.x < -89 || pCmd->viewangles.x > 89 || pCmd->viewangles.y < -180 || pCmd->viewangles.y > 180)
{
pCmd->viewangles = origView;
pCmd->sidemove = right;
pCmd->forwardmove = forward;
}
}
}
if (pCmd->viewangles.x > 90)
{
pCmd->forwardmove = -pCmd->forwardmove;
}
if (pCmd->viewangles.x < -90)
{
pCmd->forwardmove = -pCmd->forwardmove;
}
// LBY
LBYThirdpersonAngle = Vector(pLocal->GetEyeAnglesXY()->x, pLocal->GetLowerBodyYaw(), pLocal->GetEyeAnglesXY()->z);
switch (g_menu::window.MiscTab.SeeTpangle.GetIndex())
{
case 0:
if (bSendPacket)
fakeangle = pCmd->viewangles.y;
break;
case 1:
if (!bSendPacket)
fakeangle = pCmd->viewangles.y;
break;
}
switch (g_menu::window.MiscTab.SeeTpangle.GetIndex())
{
case 0:
if (!bSendPacket)
LastAngleAA = pCmd->viewangles;
break;
case 1:
if (bSendPacket)
LastAngleAA = pCmd->viewangles;
break;
}
if (g_menu::window.AntiAimtab.fakelag25.GetState()) {
if (GetAsyncKeyState(VK_SPACE))
{
int Amount = g_menu::window.MiscTab.FakeLagChoke.GetValue();
static int KeyPressedLag = -1;
KeyPressedLag++;
if (KeyPressedLag <= Amount && KeyPressedLag > -1)
{
bSendPacket = false;
}
else
{
bSendPacket = true;
KeyPressedLag = -1;
}
}
}
lineLBY = pLocal->GetLowerBodyYaw();
if (bSendPacket == true) {
lineFakeAngle = pCmd->viewangles.y;
}
else if (bSendPacket == false) {
lineRealAngle = pCmd->viewangles.y;
}
}
return false;
}
std::string GetTimeString()
{
time_t current_time;
struct tm *time_info;
static char timeString[10];
time(¤t_time);
time_info = localtime(¤t_time);
strftime(timeString, sizeof(timeString), "%X", time_info);
return timeString;
}
/*--------------------------------------------------------------*//*--------------------------------------------------------------*/
void __fastcall PaintTraverse_Hooked(PVOID pPanels, int edx, unsigned int vguiPanel, bool forceRepaint, bool allowForce)
{
if (g_menu::window.VisualsTab.OtherNoScope.GetState() && strcmp("HudZoom", Interfaces::Panels->GetName(vguiPanel)) == 0)
return;
IClientEntity* pLocalPlayer = hackManager.pLocal();
IClientEntity* pEnt;
CUserCmd pCmd;
bool done = false;
static unsigned int FocusOverlayPanel = 0;
static bool FoundPanel = false;
if (!FoundPanel)
{
PCHAR szPanelName = (PCHAR)Interfaces::Panels->GetName(vguiPanel);
if (strstr(szPanelName, XorStr("MatSystemTopPanel")))
{
FocusOverlayPanel = vguiPanel;
FoundPanel = true;
}
}
else if (FocusOverlayPanel == vguiPanel)
{
if (g_menu::window.VisualsTab.ManualaaIndicator.GetState())
{
int W, H, cW, cH;
Interfaces::Engine->GetScreenSize(W, H);
cW = W / 2;
cH = H / 2;
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
{
if (GetKeyState(g_menu::window.AntiAimtab.SWSwitchKey.GetKey()))
{
Render::Text(cW + 34, cH - 20, Color(0, 128, 255, 160), Render::Fonts::LBY2, L"▶");
Render::Text(cW - 50, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"◀");
}
else
{
Render::Text(cW + 34, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"▶");
Render::Text(cW - 50, cH - 20, Color(0, 128, 255, 160), Render::Fonts::LBY2, L"◀");
}
}
else
{
if (GetKeyState(g_menu::window.AntiAimtab.SWSwitchKey.GetKey()))
{
Render::Text(cW + 34, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"▶");
Render::Text(cW - 50, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"◀");
}
else
{
Render::Text(cW + 34, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"▶");
Render::Text(cW - 50, cH - 20, Color(255, 255, 255, 160), Render::Fonts::LBY2, L"◀");
}
}
}
if (g_menu::window.VisualsTab.NightMode.GetState()) {
if (!done)
{
ConVar* staticdrop = Interfaces::CVar->FindVar("r_DrawSpecificStaticProp");
SpoofedConvar* staticdrop_spoofed = new SpoofedConvar(staticdrop);
staticdrop_spoofed->SetInt(0);
{
for (MaterialHandle_t i = Interfaces::MaterialSystem->FirstMaterial(); i != Interfaces::MaterialSystem->InvalidMaterial(); i = Interfaces::MaterialSystem->NextMaterial(i))
{
IMaterial *pMaterial = Interfaces::MaterialSystem->GetMaterial(i);
if (!pMaterial)
continue;
if (!strcmp(pMaterial->GetTextureGroupName(), "World textures"))
{
pMaterial->ColorModulate(0.1f, 0.1f, 0.1f);
}
if (!strcmp(pMaterial->GetTextureGroupName(), "StaticProp textures"))
{
pMaterial->ColorModulate(0.3f, 0.3f, 0.3f);
}
}
}
done = true;
}
else
{
if (done)
{
for (MaterialHandle_t i = Interfaces::MaterialSystem->FirstMaterial(); i != Interfaces::MaterialSystem->InvalidMaterial(); i = Interfaces::MaterialSystem->NextMaterial(i))
{
IMaterial *pMaterial = Interfaces::MaterialSystem->GetMaterial(i);
if (!pMaterial)
continue;
if (!strcmp(pMaterial->GetTextureGroupName(), "World textures"))
{
pMaterial->ColorModulate(1.f, 1.f, 1.f);
}
if (!strcmp(pMaterial->GetTextureGroupName(), "StaticProp textures"))
{
pMaterial->ColorModulate(0.4f, 0.4f, 0.4f);
}
}
done = false;
}
}
}
if (g_menu::window.VisualsTab.LBYIdicador.GetState())
{
CUserCmd* cmdlist = *(CUserCmd**)((DWORD)Interfaces::pInput + 0xEC);
CUserCmd* pCmd = cmdlist;
IClientEntity* localplayer = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
RECT TextSize = Render::GetTextSize(Render::Fonts::LBY, "LBY");
RECT scrn = Render::GetViewport();
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
if (pCmd->viewangles.y - *localplayer->GetLowerBodyYawTarget() >= -35 && pCmd->viewangles.y - *localplayer->GetLowerBodyYawTarget() <= 35)
Render::Text(10, scrn.bottom - 80, Color(255, 0, 0, 255), Render::Fonts::LBY, "LBY");
else
Render::Text(10, scrn.bottom - 80, Color(0, 255, 0, 255), Render::Fonts::LBY, "LBY");
}
{
/*watermark background 229, 150, 255, 255*/
Render::Clear(1170, 13, 175, 18, Color(252, 112, 231, 87));
Render::Text(1173, 15, Color(255, 255, 255, 255), Render::Fonts::supremacy, ("fuckware.tk |"));
Render::Textf(1242, 15, Color(255, 255, 255, 255), Render::Fonts::supremacy, ("%s | 14 may"), GetTimeString().c_str());
}
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame())
Hacks::DrawHacks();
g_menu::DoUIFrame();
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && g_menu::window.SettingsTab.OtherHitmarker.GetState())
hitmarker::singleton()->on_paint();
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && g_menu::window.VisualsTab.DamageIndicator.GetState())
damage_indicators.paint();
}
oPaintTraverse(pPanels, vguiPanel, forceRepaint, allowForce);
}
void __fastcall hkSceneEnd(void *pEcx, void *pEdx) {
if (g_menu::window.MiscTab.FakeAngleChams.GetState())
{
IClientEntity* pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (pLocal)
{
static IMaterial* CoveredLit = CreateMaterial(true);
if (CoveredLit)
{
Vector OrigAng;
OrigAng = pLocal->GetEyeAngles();
pLocal->SetAngle2(Vector(0, lineFakeAngle, 0));
bool LbyColor = false;
float NormalColor[3] = { 1, 1, 1 };
float lbyUpdateColor[3] = { 0, 1, 0 };
Interfaces::RenderView->SetColorModulation(LbyColor ? lbyUpdateColor : NormalColor);
Interfaces::ModelRender->ForcedMaterialOverride(CoveredLit);
pLocal->draw_model(STUDIO_RENDER, 255);
Interfaces::ModelRender->ForcedMaterialOverride(nullptr);
pLocal->SetAngle2(OrigAng);
}
}
}
}
/*--------------------------------------------------------------*//*--------------------------------------------------------------*/
bool __stdcall Hooked_InPrediction()
{
bool result;
static InPrediction_ origFunc = (InPrediction_)Hooks::VMTPrediction.GetOriginalFunction(14);
static DWORD *ecxVal = Interfaces::Prediction;
result = origFunc(ecxVal);
if (g_menu::window.VisualsTab.OtherNoVisualRecoil.GetState() && (DWORD)(_ReturnAddress()) == Offsets::Functions::dwCalcPlayerView)
{
IClientEntity* pLocalEntity = NULL;
float* m_LocalViewAngles = NULL;
__asm
{
MOV pLocalEntity, ESI
MOV m_LocalViewAngles, EBX
}
Vector viewPunch = pLocalEntity->localPlayerExclusive()->GetViewPunchAngle();
Vector aimPunch = pLocalEntity->localPlayerExclusive()->GetAimPunchAngle();
m_LocalViewAngles[0] -= (viewPunch[0] + (aimPunch[0] * 2 * 0.4499999f));
m_LocalViewAngles[1] -= (viewPunch[1] + (aimPunch[1] * 2 * 0.4499999f));
m_LocalViewAngles[2] -= (viewPunch[2] + (aimPunch[2] * 2 * 0.4499999f));
return true;
}
return result;
}
player_info_t GetInfo(int Index) {
player_info_t Info;
Interfaces::Engine->GetPlayerInfo(Index, &Info);
return Info;
}
typedef void(__cdecl* MsgFn)(const char* msg, va_list);
void Msg(const char* msg, ...)
{
if (msg == nullptr)
return; //If no string was passed, or it was null then don't do anything
static MsgFn fn = (MsgFn)GetProcAddress(GetModuleHandle("tier0.dll"), "Msg"); //This gets the address of export "Msg" in the dll "tier0.dll". The static keyword means it's only called once and then isn't called again (but the variable is still there)
char buffer[989];
va_list list; //Normal varargs stuff http://stackoverflow.com/questions/10482960/varargs-to-printf-all-arguments
va_start(list, msg);
vsprintf(buffer, msg, list);
va_end(list);
fn(buffer, list); //Calls the function, we got the address above.
}
int Kills2 = 0;
int Kills = 0;
bool RoundInfo = false;
size_t Delay = 0;
bool warmup = false;
bool pEvent = false;
/*--------------------------------------------------------------*//*--------------------------------------------------------------*/
bool __fastcall Hooked_FireEventClientSide(PVOID ECX, PVOID EDX, IGameEvent *Event)
{
CBulletListener::singleton()->OnStudioRender();//
if (g_menu::window.RageBotTab.AimbotEnable.GetState())
{
if (g_menu::window.SettingsTab.BuyBot.GetIndex() == 1)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy ssg08;");
}
else if (g_menu::window.SettingsTab.BuyBot.GetIndex() == 2)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy scar20; buy g3sg1;");
}
else if (g_menu::window.SettingsTab.BuyBot.GetIndex() == 3)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy negev;");
}
}
if (g_menu::window.RageBotTab.AimbotEnable.GetState())
{
if (g_menu::window.SettingsTab.BuyBotGrenades.GetIndex() == 1)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy taser; buy vest; buy vesthelm; buy molotov; buy smokegrenade; buy hegrenade;");
}
else if (g_menu::window.SettingsTab.BuyBotGrenades.GetIndex() == 2)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("defuser; buy vest; buy vesthelm; buy taser; buy molotov; buy smokegrenade; buy hegrenade;");
}
}
if (g_menu::window.RageBotTab.AimbotEnable.GetState())
{
if (g_menu::window.SettingsTab.BuyBotPistol.GetIndex() == 1)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy elite;");
}
else if (g_menu::window.SettingsTab.BuyBotPistol.GetIndex() == 2)
{
if (strcmp(Event->GetName(), "round_start") == 0)
Interfaces::Engine->ClientCmd_Unrestricted("buy revolver;");
}
}
if (!Event)
IClientEntity* localplayer = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
std::string event_name = Event->GetName();
if (event_name.find("round_prestart") != std::string::npos || event_name.find("round_end") != std::string::npos)
{
if (event_name.find("round_end") != std::string::npos)
{
warmup = false;
}
else
{
warmup = true;
}
}
if (event_name.find("round_freeze_end") != std::string::npos)
{
warmup = false;
}
if (event_name.find("round_end") != std::string::npos)
{
warmup = true;
}
if (g_menu::window.SettingsTab.Logs.GetIndex())
{
if (!strcmp(Event->GetName(), "item_purchase"))
{
int nUserID = Event->GetInt("attacker");
int nDead = Event->GetInt("userid");
if (nUserID || nDead)
{
player_info_t killed_info = GetInfo(Interfaces::Engine->GetPlayerForUserID(nDead));
player_info_t killer_info = GetInfo(Interfaces::Engine->GetPlayerForUserID(nUserID));
std::string before = (" ");
std::string one = killed_info.name;
std::string two = ("bought ");
std::string three = Event->GetString("weapon");
std::string six = "\n";
if (g_menu::window.SettingsTab.Logs.GetIndex())
{
Msg((before + one + two + three + six).c_str());
}
}
}
if (g_menu::window.SettingsTab.Logs.GetIndex())
{
if (!strcmp(Event->GetName(), "player_hurt"))
{
int attackerid = Event->GetInt("attacker");
int entityid = Interfaces::Engine->GetPlayerForUserID(attackerid);
if (entityid == Interfaces::Engine->GetLocalPlayer())
{
int nUserID = Event->GetInt("attacker");
int nDead = Event->GetInt("userid");
if (nUserID || nDead)
{
player_info_t killed_info = GetInfo(Interfaces::Engine->GetPlayerForUserID(nDead));
player_info_t killer_info = GetInfo(Interfaces::Engine->GetPlayerForUserID(nUserID));
std::string before = (" ");
std::string two = ("Hit ");
std::string three = killed_info.name;
std::string foura = " for ";
std::string fivea = Event->GetString("dmg_health");
std::string damage = " damage";
std::string fourb = " (";
std::string fiveb = Event->GetString("health");
std::string six = " health remaining)";
std::string newline = "\n";
}
}
}
}
}
return oFireEventClientSide(ECX, Event);
}
/*--------------------------------------------------------------*//*--------------------------------------------------------------*/
void Hooks::DrawBeamd(Vector src, Vector end, Color color)
{
BeamInfo_t beamInfo;
beamInfo.m_nType = TE_BEAMPOINTS;
beamInfo.m_pszModelName = "sprites/physbeam.vmt";
beamInfo.m_nModelIndex = -1;
beamInfo.m_flHaloScale = 0.0f;
beamInfo.m_flLife = 3.0f;
beamInfo.m_flWidth = 7.0f;
beamInfo.m_flEndWidth = 7.0f;
beamInfo.m_flFadeLength = 0.0f;
beamInfo.m_flAmplitude = 2.0f;
beamInfo.m_flBrightness = color.a();
beamInfo.m_flSpeed = 0.2f;
beamInfo.m_nStartFrame = 0.f;
beamInfo.m_flFrameRate = 0.f;
beamInfo.m_flRed = color.r();
beamInfo.m_flGreen = color.g();
beamInfo.m_flBlue = color.b();
beamInfo.m_nSegments = 2;
beamInfo.m_bRenderable = true;
beamInfo.m_nFlags = FBEAM_ONLYNOISEONCE | FBEAM_NOTILE | FBEAM_HALOBEAM;
beamInfo.m_vecStart = src;
beamInfo.m_vecEnd = end;
Beam_t* myBeam = Interfaces::g_pViewRenderBeams->CreateBeamPoints(beamInfo);
if (myBeam)
Interfaces::g_pViewRenderBeams->DrawBeam(myBeam);
}
void StartPrediction(IClientEntity* LocalPlayer, CUserCmd* pCmd)
{
static bool done = false;
if (LocalPlayer->IsAlive() && g_menu::window.RageBotTab.EnginePrediction.GetState() && !done)
{
//Interfaces::CVar->FindVar("rate")->SetValue(1048576);
//Interface->Cvar()->GetVTable<ICvar>()->FindVar( "viewmodel_fov" )->SetValue( 80 );
Interfaces::CVar->FindVar("cl_interp")->SetValue(0.01f);
Interfaces::CVar->FindVar("cl_cmdrate")->SetValue(66);
Interfaces::CVar->FindVar("cl_updaterate")->SetValue(66);
Interfaces::CVar->FindVar("cl_interp_all")->SetValue(0.0f);
Interfaces::CVar->FindVar("cl_interp_ratio")->SetValue(1.0f);
Interfaces::CVar->FindVar("cl_smooth")->SetValue(0.0f);
Interfaces::CVar->FindVar("cl_smoothtime")->SetValue(0.01f);
done = true;
}
}
#define TEXTURE_GROUP_OTHER "Other textures"
void __fastcall Hooked_DrawModelExecute(void* thisptr, int edx, void* ctx, void* state, const ModelRenderInfo_t &pInfo, matrix3x4 *pCustomBoneToWorld)
{
Color color;
float flColor[3] = { 0.f };
static IMaterial* CoveredLit = CreateMaterial(true);
static IMaterial* OpenLit = CreateMaterial(false);
static IMaterial* CoveredFlat = CreateMaterial(true, false);
static IMaterial* OpenFlat = CreateMaterial(false, false);
static IMaterial* Chrome = CreateMaterial("$envmap env_cube");
bool DontDraw = false;
const char* ModelName = Interfaces::ModelInfo->GetModelName((model_t*)pInfo.pModel);
IClientEntity* pModelEntity = (IClientEntity*)Interfaces::EntList->GetClientEntity(pInfo.entity_index);
IClientEntity* pLocal = (IClientEntity*)Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
int ChamsStyle = g_menu::window.VisualsTab.OptionsChams.GetIndex();
int HandsStyle = g_menu::window.VisualsTab.OtherNoHands.GetIndex();
if (strstr(ModelName, "models/player"))
{
if (pLocal && pModelEntity && ChamsStyle != 0)
{
IMaterial *material1 = Interfaces::MaterialSystem->FindMaterial("models/player/ct_fbi/ct_fbi_glass", TEXTURE_GROUP_OTHER);
if (pLocal->IsScoped())
{
//color.SetColor(255, 255, 255, 255);
//ForceMaterial(color, material1);
Interfaces::RenderView->SetBlend(0.3);
}
if ((g_menu::window.VisualsTab.FiltersAll.GetState() || pModelEntity->GetTeamNum() != pLocal->GetTeamNum()))
{
IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
if (pModelEntity->IsAlive() && pModelEntity->GetHealth() > 0 /*&& pModelEntity->GetTeamNum() != local->GetTeamNum()*/)
{
float alpha = 1.f;
if (pModelEntity->HasGunGameImmunity())
alpha = 0.5f;
if (pModelEntity->GetTeamNum() != pLocal->GetTeamNum())
{
flColor[0] = 60.f / 255.f;
flColor[1] = 120.f / 255.f;
flColor[2] = 180.f / 255.f;
}
else
{
flColor[0] = 60.f / 255.f;
flColor[1] = 120.f / 255.f;
flColor[2] = 180.f / 255.f;
}
if (g_menu::window.VisualsTab.OptionsChams.GetIndex() == 1 || g_menu::window.VisualsTab.OptionsChams.GetIndex() == 2 && !pLocal->IsScoped())
{
Interfaces::RenderView->SetColorModulation(flColor);
Interfaces::RenderView->SetBlend(alpha);
Interfaces::ModelRender->ForcedMaterialOverride(covered);
oDrawModelExecute(thisptr, ctx, state, pInfo, pCustomBoneToWorld);
}
if (pModelEntity->GetTeamNum() == pLocal->GetTeamNum())
{
flColor[0] = 150.f / 255.f;
flColor[1] = 200.f / 255.f;
flColor[2] = 60.f / 255.f;
}
else
{
flColor[0] = 150.f / 255.f;
flColor[1] = 200.f / 255.f;
flColor[2] = 60.f / 255.f;
}
if (g_menu::window.VisualsTab.OptionsChams.GetIndex() == 3)
{
Interfaces::RenderView->SetColorModulation(flColor);
Interfaces::RenderView->SetBlend(alpha);
Interfaces::ModelRender->ForcedMaterialOverride(OpenLit);
}
else {
Interfaces::RenderView->SetColorModulation(flColor);
Interfaces::RenderView->SetBlend(alpha);
Interfaces::ModelRender->ForcedMaterialOverride(open);
}
}
else
{
color.SetColor(255, 255, 255, 255);
ForceMaterial(color, open);
}
}
}
}
else if (strstr(ModelName, "arms"))
{
/*
models/player/ct_fbi/ct_fbi_glass - platinum
models/inventory_items/cologne_prediction/cologne_prediction_glass - glass
models/inventory_items/trophy_majors/crystal_clear - crystal
models/inventory_items/trophy_majors/gold - gold
models/gibs/glass/glass - dark chrome
models/inventory_items/trophy_majors/gloss - plastic/glass
vgui/achievements/glow - glow
*/
IMaterial *material = Interfaces::MaterialSystem->FindMaterial("models/inventory_items/cologne_prediction/cologne_prediction_glass", TEXTURE_GROUP_OTHER);
IMaterial *material1 = Interfaces::MaterialSystem->FindMaterial("models/inventory_items/trophy_majors/crystal_clear", TEXTURE_GROUP_OTHER);
if (HandsStyle != 0 && pLocal && pLocal->IsAlive())
{
if (HandsStyle == 1)
{
ForceMaterial(color, material1);
}
else if (HandsStyle == 2)
{
Interfaces::RenderView->SetBlend(0.3);
}
else if (HandsStyle == 3)
{
IMaterial *covered = ChamsStyle == 1 ? CoveredLit : CoveredFlat;
IMaterial *open = ChamsStyle == 1 ? OpenLit : OpenFlat;
if (pLocal)
{
if (pLocal->IsAlive())
{
int alpha = pLocal->HasGunGameImmunity() ? 150 : 255;
if (pLocal->GetTeamNum() == 2)
color.SetColor(240, 240, 240, alpha);
else
color.SetColor(240, 240, 240, alpha);
ForceMaterial(color, covered);