Question Model changer

Guncom

Newbie
Newbie
Newbie
Newbie
Status
Offline
Joined
Nov 15, 2019
Messages
27
Reaction score
12
Can someone halp me add model changer (agent changer) for csgo simple
 

R G T X

std namespace;
Member
std namespace;
Member
Status
Offline
Joined
Jul 8, 2019
Messages
204
Reaction score
630

Mr House

Moderator
Experienced
Moderator
Experienced
Status
Offline
Joined
Mar 27, 2019
Messages
382
Reaction score
1,016

BunnyLock

Newbie
Newbie
Newbie
Newbie
Status
Offline
Joined
Mar 13, 2020
Messages
4
Reaction score
1


//Menu.cpp

ImGui::Combo("T Karakter", &g_Options.playerModelT, "Special Agent Ava | FBI\0Operator | FBI SWAT\0Markus Delrow | FBI HRT\0Michael Syfers | FBI Sniper\0B Squadron Officer | SAS\0Seal Team 6 Soldier | NSWC SEAL\0Buckshot | NSWC SEAL\0Lt. Commander Ricksaw | NSWC SEAL\0Third Commando Company | KSK\0'Two Times' McCoy | USAF TACP\0Dragomir | Sabre\0Rezan The Ready | Sabre\0'The Doctor' Romanov | Sabre\0Maximus | Sabre\0Blackwolf | Sabre\0The Elite Mr. Muhlik | Elite Crew\0Ground Rebel | Elite Crew\0Osiris | Elite Crew\0Prof. Shahmat | Elite Crew\0Enforcer | Phoenix\0Slingshot | Phoenix\0Soldier | Phoenix\0");


ImGui::Combo("Ct Karakter", &g_Options.playerModelCT, "Special Agent Ava | FBI\0Operator | FBI SWAT\0Markus Delrow | FBI HRT\0Michael Syfers | FBI Sniper\0B Squadron Officer | SAS\0Seal Team 6 Soldier | NSWC SEAL\0Buckshot | NSWC SEAL\0Lt. Commander Ricksaw | NSWC SEAL\0Third Commando Company | KSK\0'Two Times' McCoy | USAF TACP\0Dragomir | Sabre\0Rezan The Ready | Sabre\0'The Doctor' Romanov | Sabre\0Maximus | Sabre\0Blackwolf | Sabre\0The Elite Mr. Muhlik | Elite Crew\0Ground Rebel | Elite Crew\0Osiris | Elite Crew\0Prof. Shahmat | Elite Crew\0Enforcer | Phoenix\0Slingshot | Phoenix\0Soldier | Phoenix\0");



//options.hpp

//modelchanger
OPTION(int, playerModelT, 0);
OPTION(int, playerModelCT, 0);

//visual.cpp

void Visuals::playerChanger(ClientFrameStage_t stage)
{

static int originalIdx = 0;

auto pLocal = static_cast<C_BasePlayer*>(g_EntityList->GetClientEntity(g_EngineClient->GetLocalPlayer()));
if (!pLocal) {
originalIdx = 0;
return;
}

constexpr auto getModel = [](int team) constexpr -> const char* {
constexpr std::array models{
"models/player/custom_player/legacy/ctm_fbi_variantb.mdl",
"models/player/custom_player/legacy/ctm_fbi_variantf.mdl",
"models/player/custom_player/legacy/ctm_fbi_variantg.mdl",
"models/player/custom_player/legacy/ctm_fbi_varianth.mdl",
"models/player/custom_player/legacy/ctm_sas_variantf.mdl",
"models/player/custom_player/legacy/ctm_st6_variante.mdl",
"models/player/custom_player/legacy/ctm_st6_variantg.mdl",
"models/player/custom_player/legacy/ctm_st6_varianti.mdl",
"models/player/custom_player/legacy/ctm_st6_variantk.mdl",
"models/player/custom_player/legacy/ctm_st6_variantm.mdl",
"models/player/custom_player/legacy/tm_balkan_variantf.mdl",
"models/player/custom_player/legacy/tm_balkan_variantg.mdl",
"models/player/custom_player/legacy/tm_balkan_varianth.mdl",
"models/player/custom_player/legacy/tm_balkan_varianti.mdl",
"models/player/custom_player/legacy/tm_balkan_variantj.mdl",
"models/player/custom_player/legacy/tm_leet_variantf.mdl",
"models/player/custom_player/legacy/tm_leet_variantg.mdl",
"models/player/custom_player/legacy/tm_leet_varianth.mdl",
"models/player/custom_player/legacy/tm_leet_varianti.mdl",
"models/player/custom_player/legacy/tm_phoenix_variantf.mdl",
"models/player/custom_player/legacy/tm_phoenix_variantg.mdl",
"models/player/custom_player/legacy/tm_phoenix_varianth.mdl"
};

switch (team) {
case 2: return static_cast<std::size_t>(g_Options.playerModelT) < models.size() ? models[g_Options.playerModelT] : nullptr;
case 3: return static_cast<std::size_t>(g_Options.playerModelCT) < models.size() ? models[g_Options.playerModelCT] : nullptr;
default: return nullptr;
}
};

if (const auto model = getModel(pLocal->m_iTeamNum())) {
if (stage == ClientFrameStage_t::FRAME_RENDER_START)
originalIdx = pLocal->m_nModelIndex();

const auto idx = stage == ClientFrameStage_t::FRAME_RENDER_END && originalIdx ? originalIdx : g_MdlInfo->GetModelIndex(model);

pLocal->SetGloveModelIIndex(idx);
}
}



Good Uses ..
 
Top