Guest User

Untitled

a guest
Sep 17th, 2025
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. // Native:
  2. // int PED::_GET_CARRIED_PELT_SKINS(Ped mount, void* outBuf); // 0x6F43C351A5D51E2F
  3.  
  4. struct PeltEntry
  5. {
  6.     Hash itemHash;    // inventory item hash passed to SetPeltForHorseByInventoryItem
  7.     Hash albedoHash;  // albedo texture hash
  8.     Hash normalHash;  // normal map hash
  9. };
  10.  
  11. // Returns number of pelts written (0..3). out[] gets only valid entries (itemHash != 0).
  12. inline int GetCarriedPeltSkins(Ped mount, PeltEntry out[3])
  13. {
  14.     alignas(8) std::uint8_t buf[0x78]{};            // 120 bytes total (header + 3 entries)
  15.     *reinterpret_cast<int*>(buf) = 3;               // header: max pelts to query (IDA: *a2)
  16.     // second header int (at +4) is reserved/unused; leave zero.
  17.  
  18.     int count = PED::_GET_CARRIED_PELT_SKINS(mount, buf);
  19.     if (count > 3) count = 3;
  20.  
  21.     // Each entry is 10 ints (40 bytes), starting at byte offset 8.
  22.     // Within an entry (int indices): [0]=item, [2]=albedo, [4]=normal (padding between).
  23.     for (int i = 0, w = 0; i < count && w < 3; ++i)
  24.     {
  25.         const int* base = reinterpret_cast<const int*>(buf + 8 + i * 40);
  26.         Hash item   = static_cast<Hash>(base[0]); // item hash
  27.         Hash albedo = static_cast<Hash>(base[2]); // albedo hash
  28.         Hash normal = static_cast<Hash>(base[4]); // normal hash
  29.         if (item != 0) // skip empty slots (engine can return 0)
  30.         {
  31.             out[w++] = { item, albedo, normal };
  32.         }
  33.     }
  34.     return count; // how many pelts were **considered** (0..3). Empty entries have `itemHash==0`.
  35. }
Add Comment
Please, Sign In to add comment