> ## Documentation Index
> Fetch the complete documentation index at: https://lationscripts.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Drug Sales - Changelog

> A chronological log of every release, feature addition, and bug fix

<Update label="2.4.0" description="Jun 19, 2026">
  * **Duplicate ped selling fix**
    * Fixed a rare issue where the same ped could be sold to multiple times. Ped sale state is now tracked server-side with `drugSale` pending/sold state bags, reserving the ped when the menu opens and marking it used on success, reject, or cancel.
  * **DrugSold metadata parameter**
    * `DrugSold()` in `server/functions.lua` now receives item metadata as a parameter, making it easier for third-party scripts (gang systems, XP hooks, logging, etc.) to read purity, strain, or other item data at sale time.
  * **Missing metadata F8 warning**
    * When an item is listed in `Config.Metadata` but the sold item has no metadata (e.g. spawned items), the client now prints a multi-line amber warning in F8 explaining why pricing fell back and what to change in config.
  * **Weed item name updates**
    * Updated config item names to match recent changes in the weed script (e.g. plain jane → OG Kush bag items).
  * **Server-authoritative pricing & sales**
    * Sale totals are no longer trusted from the client. Quotes are generated and stored on the server, and payment only uses the stored quote at finalize time, closing a price manipulation exploit.
  * **Open-source price generation**
    * Price calculation logic is now in `CreateSaleQuote()` in `server/functions.lua`, so server owners can view and customize how prices, quantities, police risk, rep boosts, and purity metadata affect payouts.
  * **Removed legacySelling option**
    * Removed the `legacySelling` config toggle and its dual code paths. All sales now use the unified server-owned ped reservation and state bag flow.
  * **Non-networked ped handling**
    * Selling now requires a networked ped the server can resolve. Local-only or released script-spawned peds no longer show the sell prompt or spam F8 with network ID warnings when interacted with.
  * **Misc refactors**
    * Renamed internal sale flow events/callbacks and reformatted some files for readability, and other misc work.
</Update>

<Update label="2.3.0">
  * **New Purity Pricing System**
    * Replaces the three separate `Config.LationCoke`, `Config.LationMeth`, and `Config.LationWeed` config blocks with a single, unified `Config.Metadata` table. Each item now has its own independent `price_per_purity`, `perfect_bonus`, and `key` (the metadata field to read the value from). This means weed strains can each have their own unique purity pricing, cocaine and crack can be priced separately, and any item from any script can be given metadata-based pricing - not just Lation Script items. To enable metadata pricing for an item, add it to `Config.Metadata`. To disable it and fall back to the fixed min/max price range in the zone drugs table, simply remove it.
    * Breaking Change: The old `Config.LationCoke`, `Config.LationMeth`, and `Config.LationWeed` blocks have been removed. You must replace them with the new `Config.Metadata` table. Refer to the updated `config.lua` for the new format.
  * **Fix** `tgiann-inventory `**Error**
    * Fixed a Lua error ("attempt to perform arithmetic on a nil value") that could occur when using `tgiann-inventory`.
  * **New Config Option:** `excludeScriptPeds`
    * Added `excludeScriptPeds` to `Config.Setup`. When `true` (default), only naturally spawned world/ambient peds can be sold to — this preserves existing behavior. Set to `false` to allow selling interactions on any ped regardless of origin, including peds spawned by other scripts.
  * **New Hook:** `ItemsClaimed`
    * Added an empty `ItemsClaimed(source, item, quantity)` function to `server/functions.lua`. This is triggered server-side when a player successfully claims back items that were stolen from them during a robbery. Can be used with XP systems, gang scripts, or any other custom integration. Default behavior is unchanged.

  ```text changed-files theme={null}
  bridge/client.lua
  client/main.lua
  config.lua
  server/functions.lua
  server/main.lua
  fxmanifest.lua
  ```
</Update>

<Update label="2.2.0" description="Dec 20, 2025">
  Added tgiann & jaksam inventory support\
  Config option to revert back to old selling backend\
  Fixed resource not starting properly on server start up
</Update>

<Update label="2.1.10" description="Sep 23, 2025">
  Fixed multiple players selling to a single ped (its now essentially server-synced, once a ped bought drugs, it no longer wants drugs from anyone)\
  Added "xpAdded" variable to DrugSold function
</Update>

<Update label="2.1.9" description="Jul 2, 2025">
  Maintenance release for lation\_ui
</Update>

<Update label="2.1.8" description="Mar 6, 2025">
  Fixed robbed coke items returning with no metadata
</Update>

<Update label="2.1.7" description="Feb 20, 2025">
  Added support for lation\_coke\
  Added check for install folder/.sql file(s)\
  Update to new version checking API\
  Update docs url(s) to new path
</Update>

<Update label="2.1.6" description="Nov 18, 2024">
  Add ability to add an iconColor field to drugs\
  Fix robbed items not returning
</Update>

<Update label="2.1.5" description="Nov 7, 2024">
  Added metadata support for weed v3 items to sell based on purity\
  Fixed default rcore\_dispatch implementation\
  Updated config with new item names and new section\
  Updated GetPlayerInventory function\
  Reduced the number of calls to GetData function
</Update>

<Update label="2.1.4" description="Oct 22, 2024">
  Fixed minor exploit reported today
</Update>

<Update label="2.1.3" description="Oct 18, 2024">
  Remove ped freezing during reject\
  Add meth prop for ls\_meth items
</Update>

<Update label="2.1.2" description="Oct 10, 2024">
  Fix meth item not maintaining metadata after robbery
</Update>

<Update label="2.1.1" description="Oct 9, 2024">
  Fix PayPlayer function
</Update>

<Update label="2.1.0" description="Oct 9, 2024">
  Added new config options for lation\_meth integration to price meth based on purity\
  Added new bridge with native support for QBox & ox\_core\
  Added support for Fivemanage & Fivemerr logging systems\
  Added chance for "silent" police calls to give police more chances to catch sales in progress\
  Player character is now frozen in place during rejection animation\
  Fixed stolen items sometimes returning as a different item
</Update>

<Update label="2.0.2" description="Jun 11, 2024">
  Fix flawed logic regarding drug quantity minimums
</Update>

<Update label="2.0.1" description="Jun 11, 2024">
  Added ability to lock individual drugs by rep level
</Update>

<Update label="2.0.0" description="Jun 11, 2024">
  Initial v2 release
</Update>
