Hooked sceneend chams but crashes when i load map
Hres the code etc idk why the fuck it crashes xd its ayy
The hook
VMTRenderView.Initialise((DWORD*)Interfaces::RenderView);
oscene_end = (SceneEnd_t)VMTRenderView.HookMethod((DWORD)&hkSceneEnd, 9);
on function typedefs
typedef void(__thiscall* SceneEnd_t)(void*);
on pointers to originals
SceneEnd_t oscene_end;
on hook function prototypes
void __stdcall hkSceneEnd(void* edx);
and finally
heres the code
void __stdcall hkSceneEnd(void* edx)
{
oscene_end(edx);
for (int i = 1; i <= Interfaces::EntList->GetHighestEntityIndex(); ++i) {
auto entity = Interfaces::EntList->GetClientEntity(i);
if (!entity) continue;
static IMaterial* mat = CreateMaterial(true);
if (mat) {
Interfaces::ModelRender->ForcedMaterialOverride(mat);
entity->DrawModel2(STUDIO_RENDER, 255);
Interfaces::ModelRender->ForcedMaterialOverride(nullptr);
}
if (Menu::Window.VisualsTab.OtherFakeChams.GetState()) {
IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (pLocal)
{
static IMaterial* norm = CreateMaterial(false, true, false);
if (norm)
{
Vector3D OrigAng;
OrigAng = pLocal->GetEyeAngles();
pLocal->SetAngle2(Vector3D(0, pLocal->GetLowerBodyYaw(), 0)); // paste here ur AA.y value or pLocal->GetLby() (for example)
bool LbyColor = false; // u can make LBY INDICATOR. When LbyColor is true. Color will be Green , if false it will be White
float NormalColor[3] = { 1, 1, 1 };
float lbyUpdateColor[3] = { 0, 1, 0 };
Interfaces::RenderView->SetColorModulation(LbyColor ? lbyUpdateColor : NormalColor);
Interfaces::ModelRender->ForcedMaterialOverride(mat);
pLocal->DrawModel(STUDIO_RENDER, 255);
Interfaces::ModelRender->ForcedMaterialOverride(nullptr);
pLocal->SetAngle2(OrigAng);
}
}
}
}
oscene_end(edx);
}
|