Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.27 KB | None | 0 0
  1. //header
  2. struct SoundEsp_t {
  3.  
  4.     SoundEsp_t(string name, Vector origin, float time, CBaseEntity* Entity) {
  5.         szName = name;
  6.         vecOrigin = origin;
  7.         fltime = time;
  8.         pEntity = Entity;
  9.     }
  10.  
  11.     string szName;
  12.     Vector vecOrigin;
  13.     float fltime;
  14.     CBaseEntity* pEntity;
  15. };
  16.  
  17. class CSoundESP {
  18. public:
  19.     void DrawSoundEsp();
  20.     void AddSound(string name,Vector origin, float time, CBaseEntity* Entity);
  21. private:
  22.     vector<SoundEsp_t> m_Sounds;
  23. }; extern CSoundESP* g_pSoundESP;
  24.  
  25. //cpp
  26. CSoundESP* g_pSoundESP = new CSoundESP();
  27.  
  28. void CSoundESP::DrawSoundEsp() {
  29.  
  30.     for (int i = 0; i < m_Sounds.size(); i++) {
  31.         if (m_Sounds[i].fltime < g_pGlobalVars->curtime)
  32.             m_Sounds.erase(m_Sounds.begin() + i);  
  33.     }
  34.  
  35.     for (int i = 0; i < m_Sounds.size(); i++) {
  36.         Vector out;
  37.         if(g_pESP->WorldToScreen(m_Sounds[i].vecOrigin,out))
  38.             Draw.Box(out.x, out.y,10,10,1,WHITE(255));
  39.  
  40.     }
  41.  
  42. }
  43.  
  44. void CSoundESP::AddSound(string name, Vector origin, float time, CBaseEntity* Entity) {
  45.  
  46.     SoundEsp_t curSound(name, origin, time, Entity);
  47.  
  48.     m_Sounds.push_back(curSound);
  49. }
  50. //hook IEngineSound 5 IEngineSoundClient003
  51.  
  52. 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);
  53. fnEmitSound fnEmitSound;
  54. void __stdcall hkEmitSound(void*& filter, int iEntIndex, int iChannel, const char *pSoundEntry, unsigned int nSoundEntryHash,
  55.     const char *pSample, float flVolume, float flAttenuation, int nSeed, int iFlags, int iPitch, const Vector *pOrigin, const Vector *pDirection,
  56.     void* pUtlVecOrigins, bool bUpdatePositions, float soundtime, int speakerentity){
  57.  
  58.     g_fnEmitSound(filter, iEntIndex, iChannel, pSoundEntry, nSoundEntryHash, pSample, flVolume, flAttenuation, nSeed, iFlags, iPitch, pOrigin, pDirection, pUtlVecOrigins, bUpdatePositions, soundtime, speakerentity);
  59.  
  60.     if (!G::LocalPlayer)
  61.         return;
  62.  
  63.     CBaseEntity* Entity = g_pIEntList->GetClientEntity(iEntIndex);
  64.  
  65.     if (!Entity)
  66.         return;
  67.  
  68.     if (Entity == G::LocalPlayer)
  69.         return;
  70.  
  71.     player_info_t pInfo;
  72.  
  73.     g_pEngineClient->GetPlayerInfo(iEntIndex,&pInfo);
  74.  
  75.     if (iChannel == 4) {
  76.  
  77.         if (strstr(pSample, "footsteps"))
  78.             g_pSoundESP->AddSound(pInfo.name, *pOrigin, g_pGlobalVars->curtime + 1,Entity);
  79.  
  80.     }
  81.  
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement