
Originally Posted by
WasserEsser
As i said, make sure pLocal is not a nullptr. pLocal in your case is a nullptr, hence the access violation, because 0 + 0xAA44 == 0xAA44, which is not the address you want nor is it an address you have access to.
Either you forgot to initialize your IClientEntityList interface, have wrong indecies or you're getting the interfaces incorrectly.
This is the sdk, there is no nullptr anywhere.
Code:
class IClientEntity
{
public:
void* GetClientRenderable()
{
return reinterpret_cast<void*>(this + 0x4);
}
void* GetClientNetworkable()
{
return reinterpret_cast<void*>(this + 0x8);
}
ICollideable* GetCollideable()
{
typedef ICollideable* (__thiscall* GetCollideableFn)(void*);
return CallVirtualFunction<GetCollideableFn>(this, 2)(this);
}
Vector3& GetAbsOrigin()
{
typedef Vector3& (__thiscall* GetAbsOriginFn)(void*);
return CallVirtualFunction<GetAbsOriginFn>(this, 10)(this);
}
Vector3& GetAbsAngles()
{
typedef Vector3& (__thiscall* GetAbsAnglesFn)(void*);
return CallVirtualFunction<GetAbsAnglesFn>(this, 11)(this);
}
ClientClass* GetClientClass()
{
typedef ClientClass* (__thiscall* GetClientClassFn)(void*);
return CallVirtualFunction<GetClientClassFn>(this->GetClientNetworkable(), 2)(this->GetClientNetworkable());
}
bool isAlive()
{
BYTE lifestate = *(BYTE*)((DWORD)this + 0x025B);
return (lifestate == 0);
}
int GetIndex()
{
typedef int(__thiscall* GetIndexFn)(void*);
return CallVirtualFunction<GetIndexFn>(this->GetClientNetworkable(), 10)(this->GetClientNetworkable());
}
model_t* GetModel()
{
typedef model_t* (__thiscall* GetModelFn)(void*);
return CallVirtualFunction<GetModelFn>(this->GetClientRenderable(), 8)(this->GetClientRenderable());
}
bool SetupBones(matrix3x4 *pBoneToWorldOut, int nMaxBones, int boneMask, float currentTime)
{
typedef bool(__thiscall* SetupBonesFn)(void*, matrix3x4*, int, int, float);
return CallVirtualFunction<SetupBonesFn>(this->GetClientRenderable(), 13)(this->GetClientRenderable(), pBoneToWorldOut, nMaxBones, boneMask, currentTime);
}
int InCross()
{
return *(int*)((DWORD) + 0xAA44);
}
int GetTeamNum()
{
return *reinterpret_cast<int*>((DWORD)this + 0xF0);
}
bool IsDormant()
{
typedef bool(__thiscall* IsDormantFn)(void*);
return CallVirtualFunction<IsDormantFn>(this->GetClientNetworkable(), 9)(this->GetClientNetworkable());
}
template <typename t>
inline t* cast_to()
{
return reinterpret_cast<t*>(this);
}
};
class IClientEntityList
{
public:
template <typename t>
t* GetClientEntity(int index)
{
typedef t* (__thiscall* GetClientEntityFn)(void*, int);
return CallVirtualFunction<GetClientEntityFn>(this, 3)(this, index);
}
//IClientEntity* GetClientEntity(int index)
//{
// typedef IClientEntity* (__thiscall* GetClientEntityFn)(void*, int);
// return CallVirtualFunction<GetClientEntityFn>(this, 3)(this, index);
//}
IClientEntity* GetClientEntityFromHandle(DWORD handle)
{
typedef IClientEntity* (__thiscall* GetClientEntityFromHandleFn)(void*, int);
return CallVirtualFunction<GetClientEntityFromHandleFn>(this, 4)(this, handle);
}
int GetHighestEntityIndex()
{
typedef int(__thiscall* GetHighestEntityIndexFn)(void*);
return CallVirtualFunction<GetHighestEntityIndexFn>(this, 6)(this);
}
};
And yes, i am totally mentally disabled right now... :/