FootStep ESP keeps crashing. What am i doing wrong!
I think this line is the problem
Code:
if (strstr(pEmitSoundParams->pSample, "player/footsteps") == NULL && strstr(pEmitSoundParams->pSample, "player/land") == NULL)
return;
But i dont really know what makes it keep crashing.
Code:
long GetEpochTime()
{
auto duration = std::chrono::system_clock::now().time_since_epoch();
return std::chrono::duration_cast<std::chrono::milliseconds>(duration).count();
}
typedef struct D3DXVECTOR3 {
FLOAT x;
FLOAT y;
FLOAT z;
} D3DXVECTOR3, *LPD3DXVECTOR3;
class EmitSound_params_from_ESP
{
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
D3DXVECTOR3* pOrigin; //0x0030
D3DXVECTOR3* 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
EmitSound_params_from_ESP* pEmitSoundParams = NULL;
struct Footstep
{
long expiration;
int entityId;
Vector position;
};
std::vector<Footstep> footsteps;
void StepESP(int iEntIndex, const char *pSample)
{
if (strstr(pEmitSoundParams->pSample, "player/footsteps") == NULL && strstr(pEmitSoundParams->pSample, "player/land") == NULL)
return;
Console::Log("footstep found");
Footstep footstep;
footstep.entityId = pEmitSoundParams->iEntIndex;
footstep.position = Altern::EntList->GetClientEntity(pEmitSoundParams->iEntIndex)->GetOrigin();
footstep.expiration = GetEpochTime() + 1000;
Console::Log("Footstep esp");
footsteps.pushback(footstep);
}