-
Автор темы
- #1
Хочу сделать лист бокс из списка чамсов и менять их в игре. В imgui demo взял код, пытался чето выпкнуть сам. По итогу чат гпт насрал мне этот код, но у меня идет перегрузка.
chams.cpp:
void __stdcall hooks::DrawModel(
void* results,
const CDrawModelInfo& info,
CMatrix3x4* bones,
float* flexWeights,
float* flexDelayedWeights,
const CVector& modelOrigin,
const int32_t flags
) noexcept
{
if (globals::localPlayer && info.renderable) {
CEntity* entity = info.renderable->GetIClientUnknown()->GetBaseEntity();
if (Functional::Chams::chams) {
if (entity && entity->IsPlayer() && entity->GetTeam() != globals::localPlayer->GetTeam()) {
static IMaterial* material = interfaces::materialSystem->FindMaterial(Functional::Chams::items[Functional::Chams::chamsName]);
// при изменении помещать в глобалы
constexpr float hidden[3] = { 1.06f, 0.38f, 1.73f };
const float visible[3] = { 1.06f, 0.38f, 1.73f };
interfaces::studioRender->SetAlphaModulation(1.f); // прозрачность
// show thr walls
material->SetMaterialVarFlag(IMaterial::IGNOREZ, true);
interfaces::studioRender->SetColorModulation(hidden);
interfaces::studioRender->ForcedMaterialOverride(material);
DrawModelOriginal(interfaces::studioRender, results, info, bones, flexWeights, flexDelayedWeights, modelOrigin, flags);
// dnt show thr walls
material->SetMaterialVarFlag(IMaterial::IGNOREZ, false);
interfaces::studioRender->SetColorModulation(visible);
interfaces::studioRender->ForcedMaterialOverride(material);
DrawModelOriginal(interfaces::studioRender, results, info, bones, flexWeights, flexDelayedWeights, modelOrigin, flags);
return interfaces::studioRender->ForcedMaterialOverride(nullptr);
}
}
}
DrawModelOriginal(interfaces::studioRender, results, info, bones, flexWeights, flexDelayedWeights, modelOrigin, flags);
}
gui.cpp:
case 3:
ImGui::Checkbox("Chams", &Functional::Chams::chams);
if (Functional::Chams::chams) {
static int item_current = 2;
ImGui::ListBox("Type chams", &item_current, Functional::Chams::items[Functional::Chams::chamsName], IM_ARRAYSIZE(Functional::Chams::items[Functional::Chams::chamsName]), 4);
}
break;
vars.h:
namespace Chams {
inline bool chams = false;
//inline const char* chamsName = "models/inventory_items/trophy_majors/crystal_blue";
inline int chamsName = 0;
inline const char* items[] = {
"models/inventory_items/trophy_majors/gold",
"models/gibs/glass/glass",
"models/inventory_items/trophy_majors/gloss",
"vgui/achievements/glow",
"models/inventory_items/wildfire_gold/wildfire_gold_detail",
"models/inventory_items/trophy_majors/velvet",
"models/inventory_items/trophy_majors/crystal_blue",
};
}