Hi
I have this shitty paste for ayyware but the knife changer doesnt work and it flickers. It gives me an error in console (Failed to set custom material for 'knife_m9_bay', no matching material name found on model models/weapons/v_knife_default_t.mdl) and I know where the issue is I just don't know how to fix it. I will post the relavent code which will help.
Code:
if (Interfaces::Engine->IsConnected() && Interfaces::Engine->IsInGame() && curStage == FRAME_NET_UPDATE_POSTDATAUPDATE_START)
{
IClientEntity *pLocal = Interfaces::EntList->GetClientEntity(Interfaces::Engine->GetLocalPlayer());
if (Menu::Window.SkinTab.SkinEnable.GetState() && pLocal)
{
IClientEntity* WeaponEnt = Interfaces::EntList->GetClientEntityFromHandle(pLocal->GetActiveWeaponHandle());
// Utilities::Log("APPLY SKIN APPLY SKIN");
int iBayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_bayonet.mdl");
int iButterfly = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_butterfly.mdl");
int iFlip = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_flip.mdl");
int iGut = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_gut.mdl");
int iKarambit = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_karam.mdl");
int iM9Bayonet = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_m9_bay.mdl");
int iHuntsman = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_tactical.mdl");
int iFalchion = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_falchion_advanced.mdl");
int iDagger = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_push.mdl");
int iBowie = Interfaces::ModelInfo->GetModelIndex("models/weapons/v_knife_survival_bowie.mdl");
for (int i = 0; i <= Interfaces::EntList->GetHighestEntityIndex(); i++) // CHANGE
{
IClientEntity *pEntity = Interfaces::EntList->GetClientEntity(i);
IClientEntity* WeaponEnt = Interfaces::EntList->GetClientEntityFromHandle(pLocal->GetActiveWeaponHandle());
CBaseCombatWeapon* Weapon = (CBaseCombatWeapon*)WeaponEnt;
if (pEntity)
{
ULONG hOwnerEntity = *(PULONG)((DWORD)pEntity + 0x148);
IClientEntity* pOwner = Interfaces::EntList->GetClientEntityFromHandle((HANDLE)hOwnerEntity);
if (pOwner)
{
if (pOwner == pLocal)
{
std::string sWeapon = Interfaces::ModelInfo->GetModelName(pEntity->GetModel());
if (!(sWeapon.find("models/weapons", 0) != std::string::npos))
continue;
if (sWeapon.find("c4_planted", 0) != std::string::npos)
continue;
if (sWeapon.find("thrown", 0) != std::string::npos)
continue;
if (sWeapon.find("smokegrenade", 0) != std::string::npos)
continue;
if (sWeapon.find("flashbang", 0) != std::string::npos)
continue;
if (sWeapon.find("fraggrenade", 0) != std::string::npos)
continue;
if (sWeapon.find("molotov", 0) != std::string::npos)
continue;
if (sWeapon.find("decoy", 0) != std::string::npos)
continue;
if (sWeapon.find("incendiarygrenade", 0) != std::string::npos)
continue;
if (sWeapon.find("ied", 0) != std::string::npos)
continue;
if (sWeapon.find("w_eq_", 0) != std::string::npos)
continue;
CBaseCombatWeapon* pWeapon = (CBaseCombatWeapon*)pEntity;
ClientClass *pClass = Interfaces::Client->GetAllClasses();
Two examples of how the knives work
Code:
if (pEntity->GetClientClass()->m_ClassID == (int)CSGOClassID::CKnife)
{
if (Model == 0) // Bayonet
{
*pWeapon->ModelIndex() = iBayonet; // m_nModelIndex
*pWeapon->ViewModelIndex() = iBayonet;
*pWeapon->WorldModelIndex() = iBayonet + 1;
*pWeapon->m_AttributeManager()->m_Item()->ItemDefinitionIndex() = 500;
int Skin = Menu::Window.SkinTab.KnifeSkin.GetIndex();
if (Skin == 0)
{
*pWeapon->FallbackPaintKit() = 0; // Forest DDPAT
}
else if (Skin == 1)
{
*pWeapon->FallbackPaintKit() = 12; // Crimson Web
}
else if (Skin == 2)
{
*pWeapon->FallbackPaintKit() = 27; // Bone Mask
}
else if (Skin == 3)
{
*pWeapon->FallbackPaintKit() = 38; // Fade
}
else if (Skin == 4)
{
*pWeapon->FallbackPaintKit() = 40; // Night
}
else if (Skin == 5)
{
*pWeapon->FallbackPaintKit() = 42; // Blue Steel
}
else if (Skin == 6)
{
*pWeapon->FallbackPaintKit() = 43; // Stained
}
else if (Skin == 7)
{
*pWeapon->FallbackPaintKit() = 44; // Case Hardened
}
else if (Skin == 8)
{
*pWeapon->FallbackPaintKit() = 59; // Slaughter
}
else if (Skin == 9)
{
*pWeapon->FallbackPaintKit() = 72; // Safari Mesh
}
else if (Skin == 10)
{
*pWeapon->FallbackPaintKit() = 77; // Boreal Forest
}
else if (Skin == 11)
{
*pWeapon->FallbackPaintKit() = 98; // Ultraviolet
}
else if (Skin == 12)
{
*pWeapon->FallbackPaintKit() = 143; // Urban Masked
}
else if (Skin == 13)
{
*pWeapon->FallbackPaintKit() = 175; // Scorched
}
else if (Skin == 14)
{
*pWeapon->FallbackPaintKit() = 323; // Rust Coat
}
else if (Skin == 15)
{
*pWeapon->FallbackPaintKit() = 409; // Tiger Tooth
}
else if (Skin == 16)
{
*pWeapon->FallbackPaintKit() = 410; // Damascus Steel
}
else if (Skin == 17)
{
*pWeapon->FallbackPaintKit() = 411; // Damascus Steel
}
else if (Skin == 18)
{
*pWeapon->FallbackPaintKit() = 413; // Marble Fade
}
else if (Skin == 19)
{
*pWeapon->FallbackPaintKit() = 414; // Rust Coat
}
else if (Skin == 20)
{
*pWeapon->FallbackPaintKit() = 415; // Doppler Ruby
}
else if (Skin == 21)
{
*pWeapon->FallbackPaintKit() = 416; // Doppler Sapphire
}
else if (Skin == 22)
{
*pWeapon->FallbackPaintKit() = 417; // Doppler Blackpearl
}
else if (Skin == 23)
{
*pWeapon->FallbackPaintKit() = 418; // Doppler Phase 1
}
else if (Skin == 24)
{
*pWeapon->FallbackPaintKit() = 419; // Doppler Phase 2
}
else if (Skin == 25)
{
*pWeapon->FallbackPaintKit() = 420; // Doppler Phase 3
}
else if (Skin == 26)
{
*pWeapon->FallbackPaintKit() = 421; // Doppler Phase 4
}
else if (Skin == 27)
{
*pWeapon->FallbackPaintKit() = 569; // Gamma Doppler Phase1
}
else if (Skin == 28)
{
*pWeapon->FallbackPaintKit() = 570; // Gamma Doppler Phase2
}
else if (Skin == 29)
{
*pWeapon->FallbackPaintKit() = 571; // Gamma Doppler Phase3
}
else if (Skin == 30)
{
*pWeapon->FallbackPaintKit() = 568; // Gamma Doppler Phase4
}
else if (Skin == 31)
{
*pWeapon->FallbackPaintKit() = 568; // Gamma Doppler Emerald
}
else if (Skin == 32)
{
*pWeapon->FallbackPaintKit() = 558; // Lore
}
}
else if (Model == 1) // Bowie Knife
{
*pWeapon->ModelIndex() = iBowie; // m_nModelIndex
*pWeapon->ViewModelIndex() = iBowie;
*pWeapon->WorldModelIndex() = iBowie + 1;
*pWeapon->m_AttributeManager()->m_Item()->ItemDefinitionIndex() = 514;
int Skin = Menu::Window.SkinTab.KnifeSkin.GetIndex();
if (Skin == 0)
{
*pWeapon->FallbackPaintKit() = 0; // Forest DDPAT
}
else if (Skin == 1)
{
*pWeapon->FallbackPaintKit() = 12; // Crimson Web
}
else if (Skin == 2)
{
*pWeapon->FallbackPaintKit() = 27; // Bone Mask
}
else if (Skin == 3)
{
*pWeapon->FallbackPaintKit() = 38; // Fade
}
else if (Skin == 4)
{
*pWeapon->FallbackPaintKit() = 40; // Night
}
else if (Skin == 5)
{
*pWeapon->FallbackPaintKit() = 42; // Blue Steel
}
else if (Skin == 6)
{
*pWeapon->FallbackPaintKit() = 43; // Stained
}
else if (Skin == 7)
{
*pWeapon->FallbackPaintKit() = 44; // Case Hardened
}
else if (Skin == 8)
{
*pWeapon->FallbackPaintKit() = 59; // Slaughter
}
else if (Skin == 9)
{
*pWeapon->FallbackPaintKit() = 72; // Safari Mesh
}
else if (Skin == 10)
{
*pWeapon->FallbackPaintKit() = 77; // Boreal Forest
}
else if (Skin == 11)
{
*pWeapon->FallbackPaintKit() = 98; // Ultraviolet
}
else if (Skin == 12)
{
*pWeapon->FallbackPaintKit() = 143; // Urban Masked
}
else if (Skin == 13)
{
*pWeapon->FallbackPaintKit() = 175; // Scorched
}
else if (Skin == 14)
{
*pWeapon->FallbackPaintKit() = 323; // Rust Coat
}
else if (Skin == 15)
{
*pWeapon->FallbackPaintKit() = 409; // Tiger Tooth
}
else if (Skin == 16)
{
*pWeapon->FallbackPaintKit() = 410; // Damascus Steel
}
else if (Skin == 17)
{
*pWeapon->FallbackPaintKit() = 411; // Damascus Steel
}
else if (Skin == 18)
{
*pWeapon->FallbackPaintKit() = 413; // Marble Fade
}
else if (Skin == 19)
{
*pWeapon->FallbackPaintKit() = 414; // Rust Coat
}
else if (Skin == 20)
{
*pWeapon->FallbackPaintKit() = 415; // Doppler Ruby
}
else if (Skin == 21)
{
*pWeapon->FallbackPaintKit() = 416; // Doppler Sapphire
}
else if (Skin == 22)
{
*pWeapon->FallbackPaintKit() = 417; // Doppler Blackpearl
}
else if (Skin == 23)
{
*pWeapon->FallbackPaintKit() = 418; // Doppler Phase 1
}
else if (Skin == 24)
{
*pWeapon->FallbackPaintKit() = 419; // Doppler Phase 2
}
else if (Skin == 25)
{
*pWeapon->FallbackPaintKit() = 420; // Doppler Phase 3
}
else if (Skin == 26)
{
*pWeapon->FallbackPaintKit() = 421; // Doppler Phase 4
}
else if (Skin == 27)
{
*pWeapon->FallbackPaintKit() = 569; // Gamma Doppler Phase1
}
else if (Skin == 28)
{
*pWeapon->FallbackPaintKit() = 570; // Gamma Doppler Phase2
}
else if (Skin == 29)
{
*pWeapon->FallbackPaintKit() = 571; // Gamma Doppler Phase3
}
else if (Skin == 30)
{
*pWeapon->FallbackPaintKit() = 568; // Gamma Doppler Phase4
}
else if (Skin == 31)
{
*pWeapon->FallbackPaintKit() = 568; // Gamma Doppler Emerald
}
else if (Skin == 32)
{
*pWeapon->FallbackPaintKit() = 558; // Lore
}
}
what do i need to change to fix this