Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //header
- struct SoundEsp_t {
- SoundEsp_t(string name, Vector origin, float time, CBaseEntity* Entity) {
- szName = name;
- vecOrigin = origin;
- fltime = time;
- pEntity = Entity;
- }
- string szName;
- Vector vecOrigin;
- float fltime;
- CBaseEntity* pEntity;
- };
- class CSoundESP {
- public:
- void DrawSoundEsp();
- void AddSound(string name,Vector origin, float time, CBaseEntity* Entity);
- private:
- vector<SoundEsp_t> m_Sounds;
- }; extern CSoundESP* g_pSoundESP;
- //cpp
- CSoundESP* g_pSoundESP = new CSoundESP();
- void CSoundESP::DrawSoundEsp() {
- for (int i = 0; i < m_Sounds.size(); i++) {
- if (m_Sounds[i].fltime < g_pGlobalVars->curtime)
- m_Sounds.erase(m_Sounds.begin() + i);
- }
- for (int i = 0; i < m_Sounds.size(); i++) {
- Vector out;
- if(g_pESP->WorldToScreen(m_Sounds[i].vecOrigin,out))
- Draw.Box(out.x, out.y,10,10,1,WHITE(255));
- }
- }
- void CSoundESP::AddSound(string name, Vector origin, float time, CBaseEntity* Entity) {
- SoundEsp_t curSound(name, origin, time, Entity);
- m_Sounds.push_back(curSound);
- }
- //hook IEngineSound 5 IEngineSoundClient003
- typedef void(__stdcall *fnEmitSound)(void*& filter, int, int, const char*, unsigned int, const char*, float, float, int, int, int, const Vector*, const Vector*, void*, bool, float, int);
- fnEmitSound fnEmitSound;
- void __stdcall hkEmitSound(void*& filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash,
- const char *pSample, float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
- void* pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity){
- g_fnEmitSound(filter, iEntIndex, iChannel, pSoundEntry, nSoundEntryHash, pSample, flVolume, flAttenuation, nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
- if (!G::LocalPlayer)
- return;
- CBaseEntity* Entity = g_pIEntList->GetClientEntity(iEntIndex);
- if (!Entity)
- return;
- if (Entity == G::LocalPlayer)
- return;
- player_info_t pInfo;
- g_pEngineClient->GetPlayerInfo(iEntIndex,&pInfo);
- if (iChannel == 4) {
- if (strstr(pSample, "footsteps"))
- g_pSoundESP->AddSound(pInfo.name, *pOrigin, g_pGlobalVars->curtime + 1,Entity);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement