Skip to content

Z3MO/z-weedsystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

z-weedsystem

A modern, feature-rich weed cultivation system for FiveM servers using QBCore/QBXCore with ox_lib/ox_inventory support.

๐ŸŒฟ Features

  • Realistic Growth System - Plants grow over 2 hours with 5 visual stages
  • NPK Fertilizer System - Nitrogen, Phosphorus, Potassium management with min/max values
  • Strain Genetics - Deterministic strain naming based on NPK values (63,000+ possible strains)
  • Quality System - Dynamic quality calculation based on NPK ratios and water levels
  • Water Management - Plants require watering every 15 minutes
  • Ground Type Modifiers - 9 different ground surfaces affect plant growth
  • Male/Female Plants - Breeding system with seed generation
  • Reputation System - Track player expertise with named strains
  • Modern UI - Support for ox_lib, qb-input, qb-menu, ox_target
  • Inventory Integration - Works with ox_inventory and qb-core inventory

๐Ÿ“‹ Requirements

๐Ÿš€ Installation

1. Download & Install

  1. Download or clone this repository
  2. Place the z-weedsystem folder in your server's directory and enusre in server.cfg
  3. Ensure all dependencies are installed and started before z-weedsystem

2. Database Setup

Import the SQL file to your database: Or import via phpMyAdmin/HeidiSQL by running the weed.sql file.

3. Configuration

Edit config.lua to customize:

PlantConfig = {
    GrowthTime = 120,        -- Plant growth time in minutes (120 = 2 hours)
    WaterDepletion = 5,      -- Water depletion interval in minutes and also level of water depleted
    WaterAdd = 20,            -- How much water one bottle adds
    HarvestPercent = 95,       -- Minimum growth % to harvest
    MaleFactor = 1.3,         -- Male plants grow 30% slower compared to female plant
    FertilizerFactor = 1.54,   -- Fertilizer effectiveness multiplier
    -- ... more settings
}

4. Add to server.cfg

ensure ox_lib
ensure ox_target / qb-target
ensure oxmysql
ensure ox_inventory  # Optional
ensure z-weedsystem

๐ŸŽฎ How It Works

Planting Seeds

  1. Get a female weed seed (from male plants or NPC shops)
  2. Use the seed item from your inventory
  3. Aim at valid ground (grass, wet ground, etc.)
  4. Press E to plant (within 2.5m of your character)
  5. Press Backspace to cancel

Growing Plants

  1. Water plants every 15 minutes using water bottles
  2. Add fertilizer (once per plant) with custom NPK values:
    • Nitrogen (N): 1-80
    • Phosphorus (P): 1-61
    • Potassium (K): 1-20
  3. Monitor growth - 5 visual stages from seedling to harvest-ready
  4. Harvest at 95%+ growth for best yields

Strain System

  1. Hold a female seed with genetics
  2. Access the strain menu (via item or command)
  3. Name your strain - creates a unique name based on NPK values
  4. Reuse strains - plant new seeds with the same genetics

NPK & Quality

Quality is calculated based on:

  • NPK Sum - Higher values = better quality
  • Water Factor - Optimal at 70-80% water
  • Ground Type - Wet ground (type 8) gives best modifiers
  • Fertilizer - Apply once at the right growth stage

Perfect Strain Example:

  • N=80, P=61, K=20 (max values)
  • Water at 75%
  • Plant on wet ground
  • Result: Legendary quality!

๐ŸŽฏ Controls

Action Control
Plant Seed E (when aiming at valid ground)
Cancel Planting Backspace or G
Harvest Plant E (when near mature plant)
Inspect Plant E (target interaction)

๐Ÿ“ฆ Item List

  • female_weed_seed - Produces buds when harvested
  • male_weed_seed - Produces more seeds when harvested
  • trowel - Required to plant seeds
  • small_scale - Required for packaging
  • rolling_paper - Required for making joints
  • water_bottle - Waters plants (adds 20% water)
  • weed_nutrition - Fertilizer (adds NPK values)
  • wet_weed_bud - Harvested buds (needs drying)
  • dry_weed_bud - Dried buds (can package)
  • packed_weed_bud - Packaged weed (can make joints)
  • weed_baggy - Bagged weed (24 per package)
  • joint - Ready-to-smoke joints (10 per pack)

๐Ÿ”ง Framework Compatibility

QBCore

-- Works out of the box
-- Uses: Framework.Functions.GetPlayerData()
-- Uses: Framework.Functions.HasItem()
-- Uses: Framework.Functions.Notify()

QBXCore

-- Auto-detected
-- Uses: exports.qbx_core:GetCoreObject()
-- Uses: exports.qbx_core:GetPlayer()

Inventory Systems

ox_inventory

-- Auto-detected
-- Uses: exports.ox_inventory:Search()
-- Uses: exports.ox_inventory:AddItem()
-- Uses: exports.ox_inventory:RegisterUsableItem()

QBCore Inventory

-- Falls back automatically
-- Uses: Framework.Functions.GetItemByName()
-- Uses: Framework.Functions.AddItem()

๐ŸŽจ UI Compatibility

ox_lib (Recommended)

  • Uses lib.notify() for notifications
  • Uses lib.progressBar() for progress bars
  • Uses lib.inputDialog() for input dialogs
  • Uses lib.showContext() for context menus

QB-Input / QB-Menu

  • Falls back automatically
  • Uses exports['qb-input']:ShowInput()
  • Uses exports['qb-menu']:openMenu()

Target Systems

ox_target (Recommended)

exports.ox_target:addModel()
exports.ox_target:addLocalEntity()

qb-target

exports['qb-target']:AddTargetModel()
exports['qb-target']:AddTargetEntity()

๐Ÿ› Troubleshooting

Plants not growing?

  • Check GrowthTime in config (default 120 minutes)
  • Verify server time with GetCloudTimeAsInt()

Can't add fertilizer?

  • Ensure plant is not at 100% growth
  • Check if fertilizer was already added (plant.fertilizer == 1)
  • Verify you have weed_nutrition item

Strain names not generating?

  • Ensure NPK values are set on the seed metadata
  • Check getStrainName() function in cl_utils.lua

SQL errors?

  • Verify weed.sql was imported correctly

๐Ÿ“ Changelog

v1.0 (2026-04-26)

  • โœ… Fixed fertilizer growth restriction (now 100% instead of 80%)
  • โœ… Added planting distance limit (2.5m from player)
  • โœ… Added DrawText UI for planting controls
  • โœ… Fixed NPK input min/max validation
  • โœ… Improved SQL schema (utf8mb4, proper primary keys)
  • โœ… Fixed getRepstring() function
  • โœ… Added Backspace as cancel key

๐Ÿ“„ License

This project is licensed under the GNU GPLv3 License - see the LICENSE file for details.

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ’ฌ Support


Made with โค๏ธ for the FiveM community

About

A modern, feature-rich weed cultivation system for FiveM (QBCore/QBXCore).

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages