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

# Installation

> Drop the resource in, import the SQL, paste the ox_inventory items, ensure after cc_lib.

## Requirements

* A working [`cc_lib`](/cc_lib/index) install (provides the framework, inventory, notification, and target wrappers).
* [ox\_lib](https://github.com/overextended/ox_lib) and [oxmysql](https://github.com/overextended/oxmysql).
* An inventory system — **ox\_inventory** or **qb-inventory**.
* A MySQL database reachable via oxmysql.

The treasure safe uses the built-in ox\_lib skill check by default. [`cc_minigames`](/cc_minigames/index) is only needed if you switch to it in `client/minigames.lua` — see [configuration](/cc_fishing/configuration#treasure-minigame).

## Steps

<Steps>
  <Step title="Place the resource">
    Copy `cc_fishing` into a resources directory the server loads. The repo ships under `resources/[cc]/cc_fishing/`.
  </Step>

  <Step title="Database tables">
    The resource creates its four tables on first start (`cfg.autoInstallDatabase = true`), so there's nothing to do here in most cases:

    ```
    cc_fishing_player         -- per-player level, xp, logbook, challenges
    cc_fishing_leaderboard    -- per-fish, per-player best length
    cc_fishing_tournaments    -- weekly tournament history + prizes
    cc_fishing_nets           -- placed fish nets
    ```

    If your MySQL user can't run `CREATE TABLE` at runtime, set `cfg.autoInstallDatabase = false` and import `sql/install.sql` by hand instead:

    ```bash theme={null}
    mysql -u <user> -p <database> < resources/[cc]/cc_fishing/sql/install.sql
    ```
  </Step>

  <Step title="Add the inventory items">
    Add the item definitions below, then drop the matching PNGs into your inventory's images folder (each filename must match the item's `image` field). The block reuses the legacy fishing image names, so any existing fishing image pack plugs in directly.

    `weapon_pistol` and `weapon_marksmanpistol` are GTA weapon hashes — no item entry needed. `lockpick` ships in the default lists, so skip it if it's already there.

    <Tabs>
      <Tab title="ox_inventory">
        Add the following items to `ox_inventory/data/items.lua`

        ```lua theme={null}
        -- Rods
        fishingrod  = { label = 'EZ Cast 2000',        weight = 1500, stack = false, close = true },
        fishingrod2 = { label = 'Coastal Caster Plus', weight = 1700, stack = false, close = true },
        fishingrod3 = { label = 'Predator Pro Rod',    weight = 2000, stack = false, close = true },

        -- Baits
        earthworms    = { label = 'Earthworms',           weight = 50 },
        crickets      = { label = 'Crickets',             weight = 50 },
        leeches       = { label = 'Leeches',              weight = 50 },
        glowworms     = { label = 'Glowworms',            weight = 50 },
        treasure_bait = { label = 'Treasure Hunter Bait', weight = 50 },

        -- Equipment
        logbook        = { label = 'Fishing Logbook',   weight = 250,  stack = false, close = true },
        anchor         = { label = 'Anchor',            weight = 4000 },
        bait_shovel    = { label = 'Bait Shovel',       weight = 1500, stack = false },
        fishinghat     = { label = 'Lucky Fishing Hat', weight = 200,  stack = false, close = true },
        fishingnet     = { label = 'Fishing Net',       weight = 2500 },
        net_repair_kit = { label = 'Net Repair Kit',    weight = 800 },
        illegal_hook   = { label = 'Illegal Hook',      weight = 50 },

        -- Fish (common)
        salmon  = { label = 'Salmon',  weight = 800 },
        trout   = { label = 'Trout',   weight = 600 },
        bass    = { label = 'Bass',    weight = 700 },
        catfish = { label = 'Catfish', weight = 900 },
        perch   = { label = 'Perch',   weight = 300 },
        pike    = { label = 'Pike',    weight = 700 },
        carp    = { label = 'Carp',    weight = 700 },

        -- Fish (uncommon)
        bluegill = { label = 'Bluegill', weight = 400 },
        cod      = { label = 'Cod',      weight = 1100 },
        herring  = { label = 'Herring',  weight = 300 },
        walleye  = { label = 'Walleye',  weight = 800 },
        bream    = { label = 'Bream',    weight = 500 },
        zander   = { label = 'Zander',   weight = 700 },

        -- Fish (rare)
        sturgeon     = { label = 'Sturgeon',     weight = 4000 },
        swordfish    = { label = 'Swordfish',    weight = 3000 },
        tuna         = { label = 'Tuna',         weight = 2500 },
        muskellunge  = { label = 'Muskellunge',  weight = 1200 },
        tarpon       = { label = 'Tarpon',       weight = 3500 },
        giantcatfish = { label = 'Giant Catfish', weight = 4500 },

        -- Fish (very rare)
        whale            = { label = 'Whale',             weight = 50000, stack = false },
        shark            = { label = 'Shark',             weight = 8000 },
        eel              = { label = 'Eel',               weight = 800 },
        arapaima         = { label = 'Arapaima',          weight = 6000 },
        giantsnakehead   = { label = 'Giant Snakehead',   weight = 1500 },
        goliathtigerfish = { label = 'Goliath Tigerfish', weight = 3000 },

        -- Fish (legendary)
        devilray        = { label = 'Devil Ray',        weight = 9000,  stack = false },
        kraken          = { label = 'Kraken',           weight = 80000, stack = false },
        megalodon       = { label = 'Megalodon',        weight = 60000, stack = false },
        giantcoelacanth = { label = 'Giant Coelacanth', weight = 7000,  stack = false },
        goldenfish      = { label = 'Golden Fish',      weight = 500,   stack = false },

        -- Treasure loot (pawnshop sellable)
        gold_coin        = { label = 'Gold Coin',          weight = 30 },
        vintage_watch    = { label = 'Vintage Watch',      weight = 100 },
        antique_locket   = { label = 'Antique Locket',     weight = 80 },
        captain_spyglass = { label = "Captain's Spyglass", weight = 600 },
        captain_compass  = { label = "Captain's Compass",  weight = 250 },
        treasure_map     = { label = 'Treasure Map',       weight = 50, stack = false },
        pharaohs_scarab  = { label = "Pharaoh's Scarab",   weight = 200 },
        emperors_jade    = { label = "Emperor's Jade",     weight = 300 },
        megalodon_tooth  = { label = 'Megalodon Tooth',    weight = 700 },
        atlantean_coin   = { label = 'Atlantean Coin',     weight = 50 },

        -- Safe loot (skip any that already exist in your items.lua)
        goldchain = { label = 'Gold Chain', weight = 80 },
        goldbar   = { label = 'Gold Bar',   weight = 1500 },
        diamond   = { label = 'Diamond',    weight = 50 },
        ```

        Drop the matching item images into `ox_inventory/web/images/` (filenames must match the name of the item).

        <Note>
          `fishingrod*`, `treasure_map`, and `logbook` register their own item-use handlers server-side at boot. You don't need to wire anything in `items.lua` for those.
        </Note>
      </Tab>

      <Tab title="qb-inventory">
        Add the following items to `qb-core/shared/items.lua`

        ```lua theme={null}
        -- Rods
        fishingrod  = { name = 'fishingrod',  label = 'EZ Cast 2000',        weight = 1500, type = 'item', unique = true,  useable = true,  image = 'fishingrod.png' },
        fishingrod2 = { name = 'fishingrod2', label = 'Coastal Caster Plus', weight = 1700, type = 'item', unique = true,  useable = true,  image = 'fishingrod2.png' },
        fishingrod3 = { name = 'fishingrod3', label = 'Predator Pro Rod',    weight = 2000, type = 'item', unique = true,  useable = true,  image = 'fishingrod3.png' },

        -- Baits
        earthworms    = { name = 'earthworms',    label = 'Earthworms',           weight = 50, type = 'item', unique = false, useable = false, image = 'earthworms.png' },
        crickets      = { name = 'crickets',      label = 'Crickets',             weight = 50, type = 'item', unique = false, useable = false, image = 'crickets.png' },
        leeches       = { name = 'leeches',       label = 'Leeches',              weight = 50, type = 'item', unique = false, useable = false, image = 'leeches.png' },
        glowworms     = { name = 'glowworms',     label = 'Glowworms',            weight = 50, type = 'item', unique = false, useable = false, image = 'glowworms.png' },
        treasure_bait = { name = 'treasure_bait', label = 'Treasure Hunter Bait', weight = 50, type = 'item', unique = false, useable = false, image = 'treasure_bait.png' },

        -- Equipment
        logbook        = { name = 'logbook',        label = 'Fishing Logbook',   weight = 250,  type = 'item', unique = true,  useable = true,  image = 'logbook.png' },
        anchor         = { name = 'anchor',         label = 'Anchor',            weight = 4000, type = 'item', unique = false, useable = false, image = 'anchor.png' },
        bait_shovel    = { name = 'bait_shovel',    label = 'Bait Shovel',       weight = 1500, type = 'item', unique = true,  useable = false, image = 'bait_shovel.png' },
        fishinghat     = { name = 'fishinghat',     label = 'Lucky Fishing Hat', weight = 200,  type = 'item', unique = true,  useable = false, image = 'fishinghat.png' },
        fishingnet     = { name = 'fishingnet',     label = 'Fishing Net',       weight = 2500, type = 'item', unique = false, useable = false, image = 'fishingnet.png' },
        net_repair_kit = { name = 'net_repair_kit', label = 'Net Repair Kit',    weight = 800,  type = 'item', unique = false, useable = false, image = 'net_repair_kit.png' },
        illegal_hook   = { name = 'illegal_hook',   label = 'Illegal Hook',      weight = 50,   type = 'item', unique = false, useable = false, image = 'illegal_hook.png' },

        -- Fish (common)
        salmon  = { name = 'salmon',  label = 'Salmon',  weight = 800, type = 'item', unique = false, useable = false, image = 'salmon.png' },
        trout   = { name = 'trout',   label = 'Trout',   weight = 600, type = 'item', unique = false, useable = false, image = 'trout.png' },
        bass    = { name = 'bass',    label = 'Bass',    weight = 700, type = 'item', unique = false, useable = false, image = 'bass.png' },
        catfish = { name = 'catfish', label = 'Catfish', weight = 900, type = 'item', unique = false, useable = false, image = 'catfish.png' },
        perch   = { name = 'perch',   label = 'Perch',   weight = 300, type = 'item', unique = false, useable = false, image = 'perch.png' },
        pike    = { name = 'pike',    label = 'Pike',    weight = 700, type = 'item', unique = false, useable = false, image = 'pike.png' },
        carp    = { name = 'carp',    label = 'Carp',    weight = 700, type = 'item', unique = false, useable = false, image = 'carp.png' },

        -- Fish (uncommon)
        bluegill = { name = 'bluegill', label = 'Bluegill', weight = 400,  type = 'item', unique = false, useable = false, image = 'bluegill.png' },
        cod      = { name = 'cod',      label = 'Cod',      weight = 1100, type = 'item', unique = false, useable = false, image = 'cod.png' },
        herring  = { name = 'herring',  label = 'Herring',  weight = 300,  type = 'item', unique = false, useable = false, image = 'herring.png' },
        walleye  = { name = 'walleye',  label = 'Walleye',  weight = 800,  type = 'item', unique = false, useable = false, image = 'walleye.png' },
        bream    = { name = 'bream',    label = 'Bream',    weight = 500,  type = 'item', unique = false, useable = false, image = 'bream.png' },
        zander   = { name = 'zander',   label = 'Zander',   weight = 700,  type = 'item', unique = false, useable = false, image = 'zander.png' },

        -- Fish (rare)
        sturgeon     = { name = 'sturgeon',     label = 'Sturgeon',     weight = 4000, type = 'item', unique = false, useable = false, image = 'sturgeon.png' },
        swordfish    = { name = 'swordfish',    label = 'Swordfish',    weight = 3000, type = 'item', unique = false, useable = false, image = 'swordfish.png' },
        tuna         = { name = 'tuna',         label = 'Tuna',         weight = 2500, type = 'item', unique = false, useable = false, image = 'tuna.png' },
        muskellunge  = { name = 'muskellunge',  label = 'Muskellunge',  weight = 1200, type = 'item', unique = false, useable = false, image = 'muskellunge.png' },
        tarpon       = { name = 'tarpon',       label = 'Tarpon',       weight = 3500, type = 'item', unique = false, useable = false, image = 'tarpon.png' },
        giantcatfish = { name = 'giantcatfish', label = 'Giant Catfish',weight = 4500, type = 'item', unique = false, useable = false, image = 'giantcatfish.png' },

        -- Fish (very rare)
        whale            = { name = 'whale',            label = 'Whale',             weight = 50000, type = 'item', unique = true,  useable = false, image = 'whale.png' },
        shark            = { name = 'shark',            label = 'Shark',             weight = 8000,  type = 'item', unique = false, useable = false, image = 'shark.png' },
        eel              = { name = 'eel',              label = 'Eel',               weight = 800,   type = 'item', unique = false, useable = false, image = 'eel.png' },
        arapaima         = { name = 'arapaima',         label = 'Arapaima',          weight = 6000,  type = 'item', unique = false, useable = false, image = 'arapaima.png' },
        giantsnakehead   = { name = 'giantsnakehead',   label = 'Giant Snakehead',   weight = 1500,  type = 'item', unique = false, useable = false, image = 'giantsnakehead.png' },
        goliathtigerfish = { name = 'goliathtigerfish', label = 'Goliath Tigerfish', weight = 3000,  type = 'item', unique = false, useable = false, image = 'goliathtigerfish.png' },

        -- Fish (legendary)
        devilray        = { name = 'devilray',        label = 'Devil Ray',        weight = 9000,  type = 'item', unique = true, useable = false, image = 'devilray.png' },
        kraken          = { name = 'kraken',          label = 'Kraken',           weight = 80000, type = 'item', unique = true, useable = false, image = 'kraken.png' },
        megalodon       = { name = 'megalodon',       label = 'Megalodon',        weight = 60000, type = 'item', unique = true, useable = false, image = 'megalodon.png' },
        giantcoelacanth = { name = 'giantcoelacanth', label = 'Giant Coelacanth', weight = 7000,  type = 'item', unique = true, useable = false, image = 'giantcoelacanth.png' },
        goldenfish      = { name = 'goldenfish',      label = 'Golden Fish',      weight = 500,   type = 'item', unique = true, useable = false, image = 'goldenfish.png' },

        -- Treasure loot (pawnshop sellable)
        gold_coin        = { name = 'gold_coin',        label = 'Gold Coin',          weight = 30,  type = 'item', unique = false, useable = false, image = 'gold_coin.png' },
        vintage_watch    = { name = 'vintage_watch',    label = 'Vintage Watch',      weight = 100, type = 'item', unique = false, useable = false, image = 'vintage_watch.png' },
        antique_locket   = { name = 'antique_locket',   label = 'Antique Locket',     weight = 80,  type = 'item', unique = false, useable = false, image = 'antique_locket.png' },
        captain_spyglass = { name = 'captain_spyglass', label = "Captain's Spyglass", weight = 600, type = 'item', unique = false, useable = false, image = 'captain_spyglass.png' },
        captain_compass  = { name = 'captain_compass',  label = "Captain's Compass",  weight = 250, type = 'item', unique = false, useable = false, image = 'captain_compass.png' },
        treasure_map     = { name = 'treasure_map',     label = 'Treasure Map',       weight = 50,  type = 'item', unique = true,  useable = true,  image = 'treasure_map.png' },
        pharaohs_scarab  = { name = 'pharaohs_scarab',  label = "Pharaoh's Scarab",   weight = 200, type = 'item', unique = false, useable = false, image = 'pharaohs_scarab.png' },
        emperors_jade    = { name = 'emperors_jade',    label = "Emperor's Jade",     weight = 300, type = 'item', unique = false, useable = false, image = 'emperors_jade.png' },
        megalodon_tooth  = { name = 'megalodon_tooth',  label = 'Megalodon Tooth',    weight = 700, type = 'item', unique = false, useable = false, image = 'megalodon_tooth.png' },
        atlantean_coin   = { name = 'atlantean_coin',   label = 'Atlantean Coin',     weight = 50,  type = 'item', unique = false, useable = false, image = 'atlantean_coin.png' },

        -- Safe loot (skip any that already exist in your items.lua)
        goldchain = { name = 'goldchain', label = 'Gold Chain', weight = 80,   type = 'item', unique = false, useable = false, image = 'goldchain.png' },
        goldbar   = { name = 'goldbar',   label = 'Gold Bar',   weight = 1500, type = 'item', unique = false, useable = false, image = 'goldbar.png' },
        diamond   = { name = 'diamond',   label = 'Diamond',    weight = 50,   type = 'item', unique = false, useable = false, image = 'diamond.png' },
        ```

        Drop the matching PNGs into `qb-inventory/html/images/`.

        <Note>
          `fishingrod*`, `treasure_map`, and `logbook` register their own item-use handlers server-side at boot. You don't need to wire anything in `items.lua` for those.
        </Note>
      </Tab>
    </Tabs>
  </Step>

  <Step title="Ensure after cc_lib">
    Order matters in `server.cfg`:

    ```
    ensure oxmysql
    ensure ox_lib
    ensure ox_inventory
    ensure cc_lib
    ensure cc_fishing
    ```

    `cc_fishing`'s `fxmanifest.lua` declares `cc_lib`, `ox_lib`, and `oxmysql` as dependencies — FXServer won't start it before they're up. If you switch the treasure safe to `cc_minigames`, add `ensure cc_minigames` before `cc_fishing`.
  </Step>

  <Step title="Restart the server">
    Restart so the new items and resource load.
  </Step>

  <Step title="Verify in-game">
    1. Drive to Cassidy Creek (default fishing NPC location, `(1302.95, 4228.7, 33.91)`). A boat-rod blip should be on your map.
    2. Buy an `EZ Cast 2000` and some `Earthworms` from the NPC.
    3. Walk to the water's edge, equip the rod, and use the cast prompt.
    4. After the bite, complete the minigame — the catch should land in your inventory with `length` and `caught_at` metadata visible on hover.
    5. Drive to the pawnshop NPC in Mission Row (`(-1459.56, -413.97, 35.74)`) and sell the catch.

    <Tip>
      Set `cfg.debug = true` in `shared/config.lua` for verbose server logging while you test.
    </Tip>
  </Step>

  <Step title="Configure">
    Defaults are sensible, but most servers will want to move the NPCs, adjust payment sources, or rebalance prices. All tunables, NPC placement, and editable Lua files are covered in the [configuration guide](/cc_fishing/configuration).
  </Step>
</Steps>
