Guest User

Untitled

a guest
Jul 4th, 2018
452
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. enum DataUpdateType_t
  2. {
  3. DATA_UPDATE_CREATED = 0,
  4. DATA_UPDATE_DATATABLE_CHANGED,
  5. };
  6.  
  7. #define RandomInt(nMin, nMax) (rand() % (nMax - nMin + 1) + nMin);
  8. void C_Skins::Glovechanger()
  9. {
  10. auto local_id = g_EngineClient->GetLocalPlayer();
  11. if (!local_id) return;
  12.  
  13. player_info_t localPlayerInfo;
  14. if (!g_EngineClient->GetPlayerInfo(local_id, &localPlayerInfo)) return;
  15.  
  16. C_BasePlayer* local = (C_BasePlayer*)g_EntityList->GetClientEntity(local_id);
  17. if (!local) return;
  18.  
  19. auto wearables = local->m_hMyWearables();
  20. if (!wearables) return;
  21.  
  22. static CBaseHandle glove_handle = 0;
  23. auto glove = reinterpret_cast<CGloves*>(g_EntityList->GetClientEntityFromHandle(wearables[0]));
  24.  
  25. if (!glove)
  26. {
  27. auto our_glove = reinterpret_cast<CGloves*>(g_EntityList->GetClientEntityFromHandle(glove_handle));
  28.  
  29. if (our_glove) // Our glove still exists
  30. {
  31. wearables[0] = glove_handle;
  32. glove = our_glove;
  33. }
  34. }
  35.  
  36. if (!local->IsAlive())
  37. {
  38. if (glove)
  39. {
  40. glove->SetDestroyedOnRecreateEntities();
  41. glove->Release();
  42. }
  43. return;
  44. }
  45.  
  46. if (!glove)
  47. {
  48. int iEnt = g_EntityList->GetHighestEntityIndex() + 1;
  49. int iSerialNumber = RandomInt(0x0, 0xFFF);
  50.  
  51. C_BaseCombatWeapon* pWeapon = (C_BaseCombatWeapon*)CL_CreateDLLEntity(iEnt, (int)ClassId::ClassId_CEconWearable, iSerialNumber);
  52. if (pWeapon)
  53. {
  54. auto m_Index = iEnt | (iSerialNumber << 16);
  55. glove_handle = m_Index;
  56. *(DWORD*)((DWORD)local + NetvarSys::Get().GetOffset("DT_BaseCombatCharacter", "m_hMyWearables")) = m_Index;
  57. glove = (CGloves*)g_EntityList->GetClientEntity(iEnt);
  58. }
  59.  
  60. {
  61. static auto set_abs_origin_fn = reinterpret_cast<void(__thiscall*)(void*, const Vector&)>
  62. (Utils::FindPattern("client.dll", (BYTE*)"\x55\x8B\xEC\x83\xE4\xF8\x51\x53\x56\x57\x8B\xF1", "xxxxxxxxxxxx"));
  63.  
  64. static const Vector new_pos = { 10000.f, 10000.f, 10000.f };
  65.  
  66. set_abs_origin_fn(glove, new_pos);
  67. }
  68. }
  69.  
  70. *reinterpret_cast<int*>(uintptr_t(glove) + 0x64) = -1;
  71.  
  72. if (glove)
  73. {
  74. switch (g_Options.skins_glove_model)
  75. {
  76. case 1: //bloodhound
  77. {
  78. if (glove->m_Item().m_iItemDefinitionIndex() != 5027 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(0, g_Options.skins_glove_skin))
  79. {
  80. glove->m_Item().m_iItemDefinitionIndex() = 5027;
  81. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(0, g_Options.skins_glove_skin);
  82. glove->m_Item().m_iEntityQuality() = 4;
  83. glove->m_Item().m_iItemIDHigh() = -1;
  84. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  85. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound.mdl"));
  86. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  87. }
  88. }
  89. break;
  90. case 2: //sporty
  91. {
  92. if (glove->m_Item().m_iItemDefinitionIndex() != 5030 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(1, g_Options.skins_glove_skin))
  93. {
  94. glove->m_Item().m_iItemDefinitionIndex() = 5030;
  95. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(1, g_Options.skins_glove_skin);
  96. glove->m_Item().m_iEntityQuality() = 4;
  97. glove->m_Item().m_iItemIDHigh() = -1;
  98. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  99. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_sporty/v_glove_sporty.mdl"));
  100. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  101. }
  102. }
  103. break;
  104. case 3://SLICK_GLOVES
  105. {
  106. if (glove->m_Item().m_iItemDefinitionIndex() != 5031 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(2, g_Options.skins_glove_skin))
  107. {
  108. glove->m_Item().m_iItemDefinitionIndex() = 5031;
  109. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(2, g_Options.skins_glove_skin);
  110. glove->m_Item().m_iEntityQuality() = 4;
  111. glove->m_Item().m_iItemIDHigh() = -1;
  112. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  113. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_slick/v_glove_slick.mdl"));
  114. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  115. }
  116. }
  117. break;
  118. case 4://LEATHER_HANDWRAPS
  119. {
  120. if (glove->m_Item().m_iItemDefinitionIndex() != 5032|| glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(3, g_Options.skins_glove_skin))
  121. {
  122. glove->m_Item().m_iItemDefinitionIndex() = 5032;
  123. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(3, g_Options.skins_glove_skin);
  124. glove->m_Item().m_iEntityQuality() = 4;
  125. glove->m_Item().m_iItemIDHigh() = -1;
  126. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  127. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_handwrap_leathery/v_glove_handwrap_leathery.mdl"));
  128. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  129. }
  130. }
  131. break;
  132. case 5://MOTORCYCLE_GLOVES
  133. {
  134. if (glove->m_Item().m_iItemDefinitionIndex() != 5033|| glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(4, g_Options.skins_glove_skin))
  135. {
  136. glove->m_Item().m_iItemDefinitionIndex() = 5033;
  137. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(4, g_Options.skins_glove_skin);
  138. glove->m_Item().m_iEntityQuality() = 4;
  139. glove->m_Item().m_iItemIDHigh() = -1;
  140. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  141. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_motorcycle/v_glove_motorcycle.mdl"));
  142. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  143. }
  144. }
  145. break;
  146. case 6://SPECIALIST_GLOVES
  147. {
  148. if (glove->m_Item().m_iItemDefinitionIndex() != 5034 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(5, g_Options.skins_glove_skin))
  149. {
  150. glove->m_Item().m_iItemDefinitionIndex() = 5034;
  151. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(5, g_Options.skins_glove_skin);
  152. glove->m_Item().m_iEntityQuality() = 4;
  153. glove->m_Item().m_iItemIDHigh() = -1;
  154. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  155. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_specialist/v_glove_specialist.mdl"));
  156. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  157. }
  158. }
  159. break;
  160. case 7://hydra
  161. {
  162. if (glove->m_Item().m_iItemDefinitionIndex() != 5035 || glove->m_nFallbackPaintKit() != GetGloveSkinByMenu(6, g_Options.skins_glove_skin))
  163. {
  164. glove->m_Item().m_iItemDefinitionIndex() = 5035;
  165. glove->m_nFallbackPaintKit() = GetGloveSkinByMenu(6, g_Options.skins_glove_skin);
  166. glove->m_Item().m_iEntityQuality() = 4;
  167. glove->m_Item().m_iItemIDHigh() = -1;
  168. glove->m_Item().m_iAccountID() = localPlayerInfo.userId;
  169. glove->SetGloveModelIndex(g_MdlInfo->GetModelIndex("models/weapons/v_models/arms/glove_bloodhound/v_glove_bloodhound_hydra.mdl"));
  170. glove->PreDataUpdate(DATA_UPDATE_CREATED);
  171. }
  172. }
  173. break;
  174. }
  175. }
  176. }
Advertisement
Add Comment
Please, Sign In to add comment