Container Farming

2024-12-18 16-30-03_5

Tebex
Youtube
Discord

Containers

  • Acquisition:
    • Containers can be purchased from the Container Farming Shop.
    • A flatbed carrying the container will spawn, and players must find a suitable location to place it.
  • Configuration:
    • Buying permissions can be restricted to specific job, preventing unauthorized players from buying containers.
    • Ownership can be reassigned via the control panel after the container is placed.
  • Placement Requirements:
    • Players can view allowed positions by opening the map at the Container Farming Shop. When placing waypoints, the map will reveal whether the selected position is allowed.
    • Containers can only be placed on flat surfaces where all corners are level.
    • Placement is restricted to locations with unobstructed sides to ensure proper watering functionality.

XP & Levels

  • Earning XP:
    • Containers gain XP with each harvested plant.
  • Level Benefits:
    • Unlock upgrades such as increased growing space, additional water crates, and fertilizer barrels.
    • Gain boosts like faster growth rates, reduced water usage, higher yields, and lower fertilizer consumption.

Consumable Parts

  • Essential Components:
    • Fuse: Without it, plant growth slows significantly.
    • Water Filter: Required for maintaining optimal growth rates.
    • Fertilizer Mixer: Enables the application of fertilizer boosts.

Watering

  • Watering System:
    • Players must purchase a Watercrate item, which can be loaded onto pickup trucks.
    • A Waterpipe is needed to connect the watercrate to the farming container.
  • Water Collection:
    • Water is pumped from natural bodies of water and transported to farming containers to refill their watercrates.

Plants

  • Available plant types include:
    • Tomato
    • Onion
    • Carrot
    • Mushroom
    • Weed

Shop

  • All required items can be purchased from the Container Farming Shop.

Configurations

  • Boosts & Unlocks:

    • Customize unlockable upgrades and boosts for XP and levels.
  • Consumable Parts:

    • Adjust component behavior and durability.
  • Container Lifespan:

    • Define the number of days a container can remain unused before it is destroyed.
  • Allowed Installation Locations:

    • GTA Zones:
      • Enable or disable specific zones for container placement.
      • A debug visualizer shows the zone borders.
    • Custom Zones:
      • Create custom blocked or allowed zones.
      • A debug visualizer displays these custom zone boundaries.
    • Highways and Roads:
      • Specify the minimum distance from the road at which the container can be placed.
  • Plant Settings:

    • Adjust growth time, seed-to-batch ratios, harvest yields, and more.

Optimization

  • The system is well-optimized. Two loops run only when the player is driving a flatbed with a container or using the map to check suitable placement locations.
  • On the server side, plant growth is simulated using timestamps.

Compatibility

This scrip is compatible with the following frameworks and libraries:

  • qbox
  • esx
  • qb-core

  • ox_lib
  • ox_target
  • ox_inventory

  • qb-target
  • qb-inventory
  • PolyZone

  • tgiann-inventory

Images







Config
Config = {
	debug = {
		showGtaZones = false,
		showCustomZones = false,
		spawnCommand = false, -- REMEMBER to set this FALSE
	},


	moneySymbol = "€",
	money = "bank", -- "bank" or "cash"
	containerDecayTime = 7, --(days) if not used in time period then remove container when server starts
	spawnRadius = 200, -- Distance from we spawn container prop
	controlRadius = 35, -- Distance from we create targets
	maxOwnershipAmount = 1, -- How many containers can a player own at most?

	-- Check shared/server/functions.lua --
	policeCanEnterContainers = true,
	policeJobName = "police",

	growing = {
		-- How often the plant's status can be updated (in minutes).
		-- If the last check was 1 hour ago, we divide that time by the time interval
		-- and perform calculations in multiple steps to grow plants evenly.
		timeIntervall = 1, --10,

		-- negateBoost = 1.0 * 0.2 * 0.6 = 0.12
		-- Growth slows down to 12% of the maximum rate if both factors are missing.
		negateBoostNoFuse = 0.2, -- Growth penalty for missing a fuse.
		negateBoostNoWaterFilter = 0.6, -- Growth penalty for missing a water filter.

		-- If no fertilizer mixer is available, fertilizer will not affect the growth speed.
		-- If no WATER then plants simply won't grow. "Container always have enough water to keep plants alive"..
	},


	installation = {
		job = {
			name = "", -- Only this job can buy container from shop anyone can still install container
		},
		showBlockingTargets = true, -- Shows marker at position where something is blocking container placemenet
		minDistanceFromRoads = 30, -- Min distance from any road
		useCustomZones = true, --  allowedZones.lua
		useGtaZones = true, -- allowedGtaZones.lua 
		deleteVEhicleAfterInstallation = true,
		key = {
			index = 38 -- E
		}
	},


	shop = {
		position = vec4(558.275, 2675.650, 41.161, 5.579),
		pedModel = `a_m_m_hillbilly_01`,
		container = {
			price = 5000,
			spawnPosition = vec4(564.993, 2668.225, 42.085, 5.374),
		},
		items = {

			--- ConsumableParts --
			{ name = 'waterfilter1', price = 100}, 
            { name = 'waterfilter2', price = 1000},
            { name = 'waterfilter3', price = 5000},

            { name = 'fuse1', price = 100},
            { name = 'fuse2', price = 1000},
            { name = 'fuse3', price = 5000},

            { name = 'fertilizermixer1', price = 100},
            { name = 'fertilizermixer2', price = 1000},
            { name = 'fertilizermixer3', price = 5000},
            --------------------------------------------

            { name = 'sm_fertilizer', price = 5000 }, -- boosts growing speed
            { name = 'sm_watertank', price = 500}, -- needed to transport water to the container 
            { name = 'sm_waterpipe', price = 500}, -- needed to transport water to the container

            { name = 'weed_seed', price = 10},
            { name = 'tomato_seed', price = 10},
            { name = 'onion_seed', price = 10},
            { name = 'carrot_seed', price = 10},
            { name = 'mushroom_seed', price = 10},
		}
	},


	waterTank = {
		pumpSpeed = 2, -- l/s
		tankSize = 500, -- This is also size of container watertanks at same time
		vehicleOffsets = {
		    [`rebel`] = vec3(0.00, -1.45, 0.25),
		    [`rebel2`] = vec3(0.00, -1.45, 0.25),
		    [`sandking2`] = vec3(0.00, -1.87, 0.59),
		    [`sandking`] = vec3(0.0, -2.10, 0.3),
		    [`riata`] = vec3(0.0, -1.6, 0.3),
		    [`bison`] = vec3(0.0, -1.66, 0.23),
		},
		key = {
			index = 38 -- E
		}
	},

	fertilizerTank = {
		tankSize = 100,
		fertilizerItemSize = 25,
		fertilizerItemName = "sm_fertilizer"
	},

	leveling = {
		-- With these settings and the growing times defined in plants.lua,
		-- the estimated time to reach the maximum level is approximately 317 hours.
		xpPerHarvest = 5, -- XP gained per successful harvest.
		xpNeededForLevel = 50, -- XP required to advance to the next level.
		xpGrowEverySecondLevel = 100, -- XP increment every two levels.
		
		-- FILES/levelCalculations.xlsx.
	}
Code is accessible Partly
Subscription-based Yes & No
Lines (approximately) +5000
Requirements esx or qbox, ox_lib
Support Discord

Most of my scripts are escrowed. However, any code related to frameworks is always NON-ESCROWED. This ensures you can modify these scripts to work with other frameworks if needed.

Other products

4 Likes

just waiting for qbcore :heart_eyes:

1 Like

Just need to write menus and shop and it’s good to go with qbcore. I’ll let you know when it’s done.

Cool idea, very unique way to grow weed in a server.

1 Like

Nice script idea good work :slight_smile:

1 Like

Script updated to support qb-core, qb-target , qb-inventory and Polyzone. Also fixed minor bugs.

1 Like

Update

  • Added support for TGIANN Inventory.
  • Added five additional plant shelf unlocks.
  • Added Container Extension unlock.

Hi,

Is it possible to add more drugs to grow. Other than just
Tomato
Onion
Carrot
Mushroom
Weed
?

Yeah, you can add your own plants too, but you’ll need to create props for them. I have a template prop for the growing pot that I can send you—it helps with positioning the props correctly at the origin.