CSGO: Knifechanger probs
Yo,
since my recode my skinchanger partially works, which means, skins for weapons get applied but for knifes not.
The icon gets replaced and my console get spammed by
Failed to set custom material for ‘karam’, no matching material name found on model models/weapons/v_knife_default_t.mdl
The funny thing, in the old cheat(which I pub released here) still works.
some pasta:
void Skinchanger::FrameStageNotify(ClientFrameStage_t stage)
{
if (!g_EngineClient->IsInGame() || !g_EngineClient->IsConnected())
return;
if (stage == ClientFrameStage_t::FRAME_NET_UPDATE_POSTDATAUPDATE_START)
{
int localIndex = g_EngineClient->GetLocalPlayer();
auto localPlayer = C_BasePlayer::GetPlayerByIndex(localIndex);
if (!localPlayer)
return;
auto weapons = localPlayer->m_hMyWeapons();
for (size_t i = 0; weapons[i].IsValid(); i++)
{
auto weapon = weapons[i].Get();
if (!weapon)
continue;
auto kExist = skins.find(weapon->m_iItemDefinitionIndex());
if (kExist == skins.end())
continue;
Skin curSkin = skins[weapon->m_iItemDefinitionIndex()];
if (curSkin.pk != -1)
weapon->m_nFallbackPaintKit() = curSkin.pk;
if (curSkin.itemDI != -1)
weapon->m_iItemDefinitionIndex() = curSkin.itemDI;
if (const char *modelFileName = GetModelByItemDefinitionIndex(weapon->m_iItemDefinitionIndex()))
{
weapon->m_nModelIndex() = g_MdlInfo->GetModelIndex(modelFileName);
*(int*)((uintptr_t)weapon + NetMngr::Get().getOffs("CBaseViewModel", "m_nModelIndex")) = g_MdlInfo->GetModelIndex(modelFileName); // some ghettoing, cause old cheat used this one
}
if (curSkin.s != -1)
weapon->m_nFallbackSeed() = curSkin.s;
if (curSkin.w != -1)
weapon->m_flFallbackWear() = curSkin.w;
if (curSkin.st != -1)
{
weapon->m_nFallbackStatTrak() = curSkin.st;
player_info_t player_info;
if (g_EngineClient->GetPlayerInfo(localIndex, &player_info))
weapon->m_iAccountID() = player_info.xuid_low;
}
if (curSkin.custName != "")
snprintf(weapon->m_szCustomName(), 32, "%s", curSkin.custName.c_str());
weapon->m_iItemIDHigh() = -1;
}
auto view_model_handle = localPlayer->m_hViewModel();
if (!view_model_handle.IsValid())
return;
auto view_model = view_model_handle.Get();
if (!view_model)
return;
auto view_model_weapon_handle = view_model->m_hWeapon();
if (!view_model_weapon_handle.IsValid())
return;
auto view_model_weapon = view_model_weapon_handle.Get();
if (!view_model_weapon)
return;
auto kExist = skins.find(view_model_weapon->m_iItemDefinitionIndex());
if (kExist == skins.end())
return;
Skin curSkin = skins[view_model_weapon->m_iItemDefinitionIndex()];
if (curSkin.model != "")
view_model_weapon->m_nModelIndex() = g_MdlInfo->GetModelIndex(curSkin.model.c_str());
if (bForceFullUpdate)
{
g_ClientState->ForceFullUpdate();
bForceFullUpdate = false;
}
}
}
And no, ForceFullUpdate() is not the fault one 🙂
|