Guest User

Untitled

a guest
Sep 27th, 2025
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.73 KB | None | 0 0
  1. // 0xB29C553BA582D09E
  2. // namespace PED
  3.  
  4. // Computes the loot table for an animal/human carcass given its model and processing quality.
  5. // Returns the number of loot entries written. Results are written into outLoot starting at index 1.
  6. // NOTE: outLoot[0] MUST be set to the buffer capacity before the call (R* uses 15).
  7. int _COMPUTE_LOOT_FOR_PED_CARCASS(int* outLoot, Hash model, int damageCleanliness, int skinningQuality);
  8.  
  9. ### Parameters
  10.  
  11. * `outLoot`: Int buffer. **outLoot[0] = capacity** (e.g. 15). On success, the function writes up to `capacity` loot hashes starting at `outLoot[1]`.
  12. * `model`: Ped model hash (e.g., an animal carcass model).
  13. * `damageCleanliness`: Cleanliness/tier of the carcass (e.g., poor/good/perfect).
  14. * `skinningQuality`: Processing/recipe variant used for the breakdown (scripts often pass `1` or a value derived from the target item).
  15.  
  16. ### Return
  17.  
  18. * `int` — number of loot items produced (0..capacity). Items are 32-bit hashes in `outLoot[1..return]`.
  19.  
  20. ### Minimal C++ helper (safe copy into a flat array)
  21.  
  22. // Convenience wrapper that fills a std::array<Hash,15> with results.
  23. int ComputeCarcassLoot(Hash model, int cleanliness, int quality, std::array<Hash,15>& lootOut) {
  24.     int buf[16] = {};            // one larger so index 1..N maps cleanly
  25.     buf[0] = 15;                 // capacity (R* scripts use 15)
  26.     int count = PED::_COMPUTE_LOOT_FOR_PED_CARCASS(buf, model, cleanliness, quality);
  27.     for (int i = 0; i < count && i < 15; ++i) lootOut[i] = static_cast<Hash>(buf[i + 1]);
  28.     return count;
  29. }
  30.  
  31. ### Notes
  32.  
  33. * The native respects the capacity you put in `outLoot[0]` and won’t overflow it.
  34. * Internally it selects different loot datasets in SP vs MP, so results can differ between modes.
  35.  
Advertisement
Add Comment
Please, Sign In to add comment