#include <sdk/IVModelRender.h>
void draw_player_model(const C_BaseEntity *player, const Vector &origin, const QAngle &angles) {
IVModelRender *pModelRender = g_pModelRender;
model_render_info_t render_info;
render_info.origin = origin;
render_info.angles = angles;
render_info.pModel = player->GetModel();
render_info.pRenderable = player;
render_info.flags = STUDIO_RENDER;
lighting_query_t lighting;
lighting.pos = origin;
lighting.normal = Vector(0.0f, 0.0f, 1.0f);
lighting.ambient_light_color = Color(255, 255, 255, 255);
lighting.direct_light_color = Color(255, 255, 255, 255);
lighting.pMaterial = nullptr;
lighting.flags = LIGHTING_LIGHT_AMBIENT | LIGHTING_LIGHT_DIRECT;
lighting_state_t lighting_state;
lighting_state.pLighting = &lighting;
lighting_state.pLightingState = &lighting_state;
pModelRender->DrawModelEx(render_info, lighting_state);
}
int main() {
for (int i = 1; i <= g_pGlobalVars->maxClients; i++) {
C_BaseEntity *player = g_pEntityList->GetClientEntity(i);
if (!player || player->GetDormant() || player->GetHealth() <= 0) continue;
draw_player_model(player, player->GetAbsOrigin(), player->GetAbsAngles());
}
}