Hey thanks that you visit my thread
Okay lets start, i post all my relevant code now, its a mixture of mine and some copy paste things from teamgamerfoods source code i think.
The game just crashes whatever i do...
If you could help me that would be amazing !
Code:
DWORD clientDLL;
Vector2D D::WorldToScreen( const Vector from ) {
while(!clientDLL)
clientDLL = (DWORD)GetModuleHandle("client.dll");
const VMatrix worldToScreen = *(VMatrix*)((DWORD)clientDLL + 0x4A6B964);
float w = 0.0f;
Vector2D to;
to.x = worldToScreen[0][0] * from.x + worldToScreen[0][1] * from.y + worldToScreen[0][2] * from.z + worldToScreen[0][3];
to.y = worldToScreen[1][0] * from.x + worldToScreen[1][1] * from.y + worldToScreen[1][2] * from.z + worldToScreen[1][3];
w = worldToScreen[3][0] * from.x + worldToScreen[3][1] * from.y + worldToScreen[3][2] * from.z + worldToScreen[3][3];
if (w < 0.01f) {
Vector2D empty;
return empty;
}
float invw = 1.0f / w;
to.x *= invw;
to.y *= invw;
int width, height;
I::Engine->GetScreenSize( width, height );
float x = width / 2.0f;
float y = height / 2.0f;
x += 0.5f * to.x * width + 0.5f;
y -= 0.5f * to.y * height + 0.5f;
to.x = x;
to.y = y;
return to;
}
Code:
Vector max = Entity->GetCollideable()->OBBMaxs();
Vector pos3D;
Vector top3D;
pos3D = Entity->GetOrigin();
top3D = pos3D + Vector( 0, 0, max.z );
Vector2D pos = D::WorldToScreen(pos3D);
Vector2D top = D::WorldToScreen(top3D);
float height = ( top.y - pos.y );
Code:
if( Entity->IsVisible( 8 ) && Vars.Visuals.Box )
PlayerBox2( pos.x - (height / 4.0f), pos.y, height / 2.0f, height, Entity->IsEnemy() ? Color( 200, 60, 60 ) : Color( 84, 167, 255 ) );
else if( !Entity->IsVisible( 8 ) && Vars.Visuals.Box )
PlayerBox2(pos.x - (height / 4.0f), pos.y, height / 2.0f, height, Entity->IsEnemy() ? Color(232, 209, 32) : Color(72, 219, 75));
Thanks in advance!