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