Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Cheat.h"
- EmitSound_Params_t* pEmitSoundParams = nullptr;
- std::array<PlayerSoundstruct_t, 64> footstep_sounds;
- EmitSoundFn oEmitSound;
- void EmitSoundHook() {
- if (pEmitSoundParams->pOrigin == nullptr || pEmitSoundParams->pSample == nullptr || !I::EngineClient->IsInGame())
- return;
- int index = pEmitSoundParams->iEntIndex;
- Vector origin = *pEmitSoundParams->pOrigin;
- const char* name1 = pEmitSoundParams->pSample;
- if (index != 0) {
- if (strstr(name1, "footsteps")) {
- clock_t start_t = clock();
- footstep_sounds[pEmitSoundParams->iEntIndex].pOrigin = origin;
- footstep_sounds[pEmitSoundParams->iEntIndex].soundtime = start_t;
- footstep_sounds[pEmitSoundParams->iEntIndex].iEntIndex = index;
- sprintf(footstep_sounds[pEmitSoundParams->iEntIndex].pSample, name1);
- }
- }
- }
- __declspec(naked) void hkEmitSound() {
- __asm
- {
- mov pEmitSoundParams, esp
- pushad
- call EmitSoundHook
- popad
- jmp oEmitSound
- }
- }
- void __stdcall Hooks::EmitSound() {
- hkEmitSound();
- }
- void CVisuals::SoundEsp() {
- for (int i = 0; i < 64; i++) {
- CBaseEntity* Entity = I::ClientEntityList->GetClientEntity(footstep_sounds[i].iEntIndex);
- if (!Entity || Entity == G::LocalPlayer ||
- //Entity == I::ClientEntityList->GetClientEntityFromHandle(G::LocalPlayer->GetObserverTarget()) ||
- (Vars.Visuals.Filter.Decoy && Entity->GetTeam() == G::LocalPlayer->GetTeam()))
- continue;
- Vector origin = footstep_sounds[i].pOrigin;
- Vector screenpos;
- clock_t time = clock() - footstep_sounds[i].soundtime;
- float timeago = ((float)time) / CLOCKS_PER_SEC;
- float dist = M::VectorDistance(G::LocalPlayer->GetEyePosition(), origin);
- if (dist > 1200.f)
- continue;
- if (timeago > .5f)
- continue;
- D::WorldToScreen(origin, screenpos);
- D::DrawCircle(screenpos.x, screenpos.y, 3300 / dist, 30,
- (!footstep_sounds[i].iEntIndex || !Entity) ? Color::Red() : Entity->IsEnemy() ? Color::Yellow() : Color::Green());
- }
- }
- using EmitSoundFn = void(__fastcall*)();
- extern EmitSoundFn oEmitSound;
- class IEngineSound {
- public:
- };
- class EmitSound_Params_t {
- public:
- char _0x0000[8];
- __int32 iEntIndex; //0x0008
- __int32 iChannel; //0x000C
- char _0x0010[8];
- char* pSample; //0x0018
- float flVolume; //0x001C
- __int32 iSoundlevel; //0x0020
- __int32 iFlags; //0x0024
- __int32 iPitch; //0x0028
- __int32 iSpecialDSP; //0x002C
- Vector* pOrigin; //0x0030
- Vector* pDirection; //0x0034
- __int32 pUtlVecOrigins; //0x0038 CUtlVector< Vector >*
- byte bUpdatePositions; //0x003C
- char _0x003D[3];
- float soundtime; //0x0040 zero in my case
- __int32 speakerentity; //0x0044
- };//Size=0x0048
- extern EmitSound_Params_t* pEmitSoundParams;
- struct PlayerSoundstruct_t { //hier in emitsound die gesammtelen infos speichern. 64 structs, für jede entity eine.
- __int32 iEntIndex; //0x0008
- __int32 iChannel; //0x000C
- char pSample[333]; //0x0018
- float flVolume; //0x001C
- __int32 iSoundlevel; //0x0020
- __int32 iFlags; //0x0024
- __int32 iPitch; //0x0028
- __int32 iSpecialDSP; //0x002C
- Vector pOrigin; //0x0030
- Vector pDirection; //0x0034
- __int32 pUtlVecOrigins; //0x0038
- byte bUpdatePositions; //0x003C
- clock_t soundtime; //0x0040
- __int32 speakerentity; //0x0044
- };
- extern std::array<PlayerSoundstruct_t, 64> footstep_sounds;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement