Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Спойлер: Code(1)
- Код:
- #pragma once
- struct WearableItemConfig
- {
- int iItemDefinitionIndex = 0;
- int nFallbackPaintKit = 0;
- int nFallbackSeed = 0;
- int nFallbackStatTrak = -1;
- int iEntityQuality = 4;
- float flFallbackWear = 0.1f;
- char* szModelFileName = nullptr;
- bool bUpdateStatus = false;
- };
- std::unordered_map<int, WearableItemConfig> g_GloveChangerCfg;
- class GloveFunctions
- {
- public:
- static bool ApplyCustomSkin(C_BaseCombatWeapon* pEntity, int nWeaponIndex)
- {
- if (g_GloveChangerCfg.find(nWeaponIndex) == g_GloveChangerCfg.end())
- return false;
- *pEntity->GetFallbackPaintKit() = g_GloveChangerCfg[nWeaponIndex].nFallbackPaintKit;
- *pEntity->GetEntityQuality() = g_GloveChangerCfg[nWeaponIndex].iEntityQuality;
- *pEntity->GetFallbackSeed() = g_GloveChangerCfg[nWeaponIndex].nFallbackSeed;
- *pEntity->GetFallbackStatTrak() = g_GloveChangerCfg[nWeaponIndex].nFallbackStatTrak;
- *pEntity->GetFallbackWear() = g_GloveChangerCfg[nWeaponIndex].flFallbackWear;
- if (g_GloveChangerCfg[nWeaponIndex].iItemDefinitionIndex)
- *pEntity->GetItemDefinitionIndex() = g_GloveChangerCfg[nWeaponIndex].iItemDefinitionIndex;
- *pEntity->GetItemIDHigh() = -1;
- pEntity->SetModelIndex2(Interfaces::ModelInfo()->GetModelIndex(g_GloveChangerCfg[nWeaponIndex].szModelFileName));
- pEntity->PreDataUpdate(DATA_UPDATE_CREATED);
- g_GloveChangerCfg[nWeaponIndex].bUpdateStatus = true;
- return true;
- }
- static void SetSkinConfig()
- {
- using namespace SourceEngine;
- //sample code
- g_GloveChangerCfg[0].iItemDefinitionIndex = 5033;
- g_GloveChangerCfg[0].nFallbackPaintKit = 10027;
- g_GloveChangerCfg[0].nFallbackSeed = 0;
- g_GloveChangerCfg[0].flFallbackWear = 0.00000001f;
- g_GloveChangerCfg[0].nFallbackStatTrak = -1;
- g_GloveChangerCfg[0].szModelFileName = "models/weapons/v_models/arms/glove_motorcycle/v_glove_motorcycle.mdl";
- }
- };
- Спойлер: Code(2)
- Код:
- DWORD* hMyWearables = (DWORD*)((size_t)pLocal + 0x2EF4);
- if (hMyWearables != NULL)
- {
- for (ClientClass *pClass = Interfaces::Client()->GetAllClasses(); pClass; pClass = pClass->m_pNext)
- {
- if (pClass->m_ClassID != CEconWearable)
- continue;
- int iEntry = (Interfaces::EntityList()->GetHighestEntityIndex() + 1),
- iSerial = RandomInt(0x0, 0xFFF);
- pClass->m_pCreateFn(iEntry, iSerial);
- hMyWearables[0] = iEntry | (iSerial « 16);
- break;
- }
- C_BaseCombatWeapon* pEnt = (C_BaseCombatWeapon*)Interfaces::EntityList()->GetClientEntity(hMyWearables[0] & 0xFFF);
- if (pEnt)
- {
- GloveFunctions::ApplyCustomSkin(pEnt, 0);
- *pEnt->GetAccountID() = playerInfo.m_nXuidLow;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement