Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum DataUpdateType_t
- {
- DATA_UPDATE_CREATED = 0,
- DATA_UPDATE_DATATABLE_CHANGED,
- };
- #define RandomInt(nMin, nMax) (rand() % (nMax - nMin + 1) + nMin);
- void C_Skins::Glovechanger()
- {
- auto local_id = g_EngineClient->GetLocalPlayer();
- if (!local_id) return;
- player_info_t localPlayerInfo;
- if (!g_EngineClient->GetPlayerInfo(local_id, &localPlayerInfo)) return;
- C_BasePlayer* local = (C_BasePlayer*)g_EntityList->GetClientEntity(local_id);
- if (!local) return;
- auto wearables = local->m_hMyWearables();
- if (!wearables) return;
- static CBaseHandle glove_handle = 0;
- auto glove = reinterpret_cast<CGloves*>(g_EntityList->GetClientEntityFromHandle(wearables[0]));
- if (!glove)
- {
- auto our_glove = reinterpret_cast<CGloves*>(g_EntityList->GetClientEntityFromHandle(glove_handle));
- if (our_glove) // Our glove still exists
- {
- wearables[0] = glove_handle;
- glove = our_glove;
- }
- }
- if (!local->IsAlive())
- {
- if (glove)
- {
- glove->SetDestroyedOnRecreateEntities();
- glove->Release();
- }
- return;
- }
- if (!glove)
- {
- int iEnt = g_EntityList->GetHighestEntityIndex() + 1;
- int iSerialNumber = RandomInt(0x0, 0xFFF);
- C_BaseCombatWeapon* pWeapon = (C_BaseCombatWeapon*)CL_CreateDLLEntity(iEnt, (int)ClassId::ClassId_CEconWearable, iSerialNumber);
- if (pWeapon)
- {
- auto m_Index = iEnt | (iSerialNumber << 16);
- glove_handle = m_Index;
- *(DWORD*)((DWORD)local + NetvarSys::Get().GetOffset("DT_BaseCombatCharacter", "m_hMyWearables")) = m_Index;
- glove = (CGloves*)g_EntityList->GetClientEntity(iEnt);
- }
- {
- static auto set_abs_origin_fn = reinterpret_cast<void(__thiscall*)(void*, const Vector&)>
- (Utils::FindPattern("client.dll", (BYTE*)"\x55\x8B\xEC\x83\xE4\xF8\x51\x53\x56\x57\x8B\xF1", "xxxxxxxxxxxx"));
- static const Vector new_pos = { 10000.f, 10000.f, 10000.f };
- set_abs_origin_fn(glove, new_pos);
- }
- }
- *reinterpret_cast<int*>(uintptr_t(glove) + 0x64) = -1;
- if (glove)
- {
- switch (g_Options.skins_glove_model)
- {
- case 1: //bloodhound
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5027 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(0, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5027;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(0, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 2: //sporty
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5030 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(1, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5030;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(1, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_sporty/v_glove_sporty.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 3://SLICK_GLOVES
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5031 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(2, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5031;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(2, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_slick/v_glove_slick.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 4://LEATHER_HANDWRAPS
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5032|| glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(3, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5032;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(3, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_handwrap_leathery/v_glove_handwrap_leathery.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 5://MOTORCYCLE_GLOVES
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5033|| glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(4, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5033;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(4, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_motorcycle/v_glove_motorcycle.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 6://SPECIALIST_GLOVES
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5034 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(5, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5034;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(5, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_specialist/v_glove_specialist.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- case 7://hydra
- {
- if (glove->m_Item().m_iItemDefinitionIndex() != 5035 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(6, g_Options.skins_glove_skin))
- {
- glove->m_Item().m_iItemDefinitionIndex() = 5035;
- glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(6, g_Options.skins_glove_skin);
- glove->m_Item().m_iEntityQuality() = 4;
- glove->m_Item().m_iItemIDHigh() = -1;
- glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
- glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound_hydra.mdl"));
- glove->PreDataUpdate(DATA_UPDATE_CREATED);
- }
- }
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment