Advertisement
pycache

footstep esp abomination

Jan 9th, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.29 KB | None | 0 0
  1. #include "Cheat.h"
  2.  
  3. EmitSound_Params_t* pEmitSoundParams = nullptr;
  4. std::array<PlayerSoundstruct_t, 64> footstep_sounds;
  5. EmitSoundFn oEmitSound;
  6.  
  7. void EmitSoundHook() {
  8.     if (pEmitSoundParams->pOrigin == nullptr || pEmitSoundParams->pSample == nullptr || !I::EngineClient->IsInGame())
  9.         return;
  10.  
  11.     int index = pEmitSoundParams->iEntIndex;
  12.     Vector origin = *pEmitSoundParams->pOrigin;
  13.     const char* name1 = pEmitSoundParams->pSample;
  14.  
  15.     if (index != 0) {
  16.         if (strstr(name1, "footsteps")) {
  17.             clock_t start_t = clock();
  18.             footstep_sounds[pEmitSoundParams->iEntIndex].pOrigin = origin;
  19.             footstep_sounds[pEmitSoundParams->iEntIndex].soundtime = start_t;
  20.             footstep_sounds[pEmitSoundParams->iEntIndex].iEntIndex = index;
  21.             sprintf(footstep_sounds[pEmitSoundParams->iEntIndex].pSample, name1);
  22.         }
  23.     }
  24. }
  25.  
  26. __declspec(naked) void hkEmitSound() {
  27.     __asm
  28.     {
  29.         mov pEmitSoundParams, esp
  30.         pushad
  31.         call EmitSoundHook
  32.         popad
  33.         jmp oEmitSound
  34.     }
  35. }
  36.  
  37. void __stdcall Hooks::EmitSound() {
  38.     hkEmitSound();
  39. }
  40.  
  41.  
  42. void CVisuals::SoundEsp() {
  43.     for (int i = 0; i < 64; i++) {
  44.         CBaseEntity* Entity = I::ClientEntityList->GetClientEntity(footstep_sounds[i].iEntIndex);
  45.         if (!Entity || Entity == G::LocalPlayer ||
  46.             //Entity == I::ClientEntityList->GetClientEntityFromHandle(G::LocalPlayer->GetObserverTarget()) ||
  47.             (Vars.Visuals.Filter.Decoy && Entity->GetTeam() == G::LocalPlayer->GetTeam()))
  48.             continue;
  49.  
  50.         Vector origin = footstep_sounds[i].pOrigin;
  51.         Vector screenpos;
  52.         clock_t time = clock() - footstep_sounds[i].soundtime;
  53.         float timeago = ((float)time) / CLOCKS_PER_SEC;
  54.         float dist = M::VectorDistance(G::LocalPlayer->GetEyePosition(), origin);
  55.  
  56.         if (dist > 1200.f)
  57.             continue;
  58.  
  59.         if (timeago > .5f)
  60.             continue;
  61.  
  62.         D::WorldToScreen(origin, screenpos);
  63.         D::DrawCircle(screenpos.x, screenpos.y, 3300 / dist, 30,
  64.             (!footstep_sounds[i].iEntIndex || !Entity) ? Color::Red() : Entity->IsEnemy() ? Color::Yellow() : Color::Green());
  65.     }
  66. }
  67.  
  68.  
  69. using EmitSoundFn = void(__fastcall*)();
  70. extern EmitSoundFn oEmitSound;
  71.  
  72. class IEngineSound {
  73. public:
  74.  
  75. };
  76.  
  77. class EmitSound_Params_t {
  78. public:
  79.     char _0x0000[8];
  80.     __int32 iEntIndex; //0x0008
  81.     __int32 iChannel; //0x000C
  82.     char _0x0010[8];
  83.     char* pSample; //0x0018
  84.     float flVolume; //0x001C
  85.     __int32 iSoundlevel; //0x0020
  86.     __int32 iFlags; //0x0024
  87.     __int32 iPitch; //0x0028
  88.     __int32 iSpecialDSP; //0x002C
  89.     Vector* pOrigin; //0x0030
  90.     Vector* pDirection; //0x0034
  91.     __int32 pUtlVecOrigins; //0x0038 CUtlVector< Vector >*
  92.     byte bUpdatePositions; //0x003C
  93.     char _0x003D[3];
  94.     float soundtime; //0x0040 zero in my case
  95.     __int32 speakerentity; //0x0044
  96. };//Size=0x0048
  97.  
  98. extern EmitSound_Params_t* pEmitSoundParams;
  99.  
  100. struct PlayerSoundstruct_t { //hier in emitsound die gesammtelen infos speichern. 64 structs, für jede entity eine.
  101.     __int32 iEntIndex; //0x0008
  102.     __int32 iChannel; //0x000C
  103.     char pSample[333]; //0x0018
  104.     float flVolume; //0x001C
  105.     __int32 iSoundlevel; //0x0020
  106.     __int32 iFlags; //0x0024
  107.     __int32 iPitch; //0x0028
  108.     __int32 iSpecialDSP; //0x002C
  109.     Vector pOrigin; //0x0030
  110.     Vector pDirection; //0x0034
  111.     __int32 pUtlVecOrigins; //0x0038
  112.     byte bUpdatePositions; //0x003C
  113.     clock_t soundtime; //0x0040
  114.     __int32 speakerentity; //0x0044
  115. };
  116.  
  117. extern std::array<PlayerSoundstruct_t, 64> footstep_sounds;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement