[outdated/end-of-support] VX-Farming

vx-farming

This resource is using edited WarMenu by Warxander

Obfuscated version (12€ + taxes)

(uses FiveM Escrow service)

Code is accessible Partial
Subscription-based No
Lines (approximately) Approx 1500
Requirements WarMenu (bundeled)
Support Yes

Non-Obfuscated version (30€ + taxes)

Code is accessible Yes
Subscription-based No
Lines (approximately) Approx 1500
Requirements WarMenu (bundeled)
Support Yes

FUTURE UPDATED VERSION WILL BE SUPPORTED ONLY BY QBCORE!

About

Hello fellas! :wave:

I want to present you farming script that enhances roleplay for your server!

  • This resource allows you to grow any plant imaginable.
  • Useable for your drug system, farmers, vineyard.
  • Let your players grow potatoes, salads, pumpkins, vine, cannabis, cocaine, shrooms.
  • This resource is nicely optimized, players get plant data only when they are nearby (serverside checking).
  • No database is needed - plant data are persistent and saved to local json file.
  • ESX and QBCore compatible - with little fiddle with code (examples are prepared in cl_edit_me and sv_edit_me files)

Check my other work

VX-Prop-utils (0.5€)

Features

  • Optimized
    • Low ms even on extreme plant count (tested on 1k plants) - 0.02 ms idle, 0.06 ms near plants
    • Plant is destroyed when player forgets about plant (health of plant decreases based on water and fertilizer values)
    • Maximum count of plants per player (configurable)
    • Only plants that are near player are loaded and rendered (configurable distance)
    • Cannot plant more plants that are too close to each other (configurable distance)
    • OneSync infinity compatible
  • User Friendly
    • Custom streamed font
    • Two type of 3d text (default 3d text, floating text help)
    • Edited warmenu - Each plant can have different prop
    • Plants are growing in real time, you can see how sapling grows up from ground
    • You can localize any text player can see
    • Customizable notifications
    • Custom animation for watering plant (thanks to Bzzz)
  • Standalone - QB Core and ESX friendly
    • Script is ready for frameworks like ESX and QB Core
    • You have to do little work to setup script
    • Simply uncomment prepared code, insert items into your inventory script and you are ready to go
  • Configure anything
    • From potatoes to cocaine, simply you can create any type of plant
    • Add custom prop to each plant
    • For enhancing roleplay
    • Players cannot plant on asphalt, on roofs, etc…
    • Different soils means better growing rate
    • Configurable item check for planting, watering and fertilizing
    • Item reward based on plant health and grow stage

Config example

Config = Config or {}
Config.CustomFont = true --DO NOT TOUCH! Currently keep this on if you are streaming font Fira Sans (in stream folder)
Config.ButtonInspectPlant = 'E' --DO NOT TOUCH! Currently used only for 3d text label

--Allows debug prints to F8 console
Config.Debug = true

--FloatingHelp/3DText
Config.Display3DTextType = 'FloatingHelp'

--Distance to start drawing 3d text
Config.PlayerToPlantCloseDist = 3.0

--Distance to interact with closest plant (must be lower than PlayerToPlantCloseDist)
Config.PlayerToPlantInteractionDist = 1.4

--Language and localisations
Config.Language = 'en_GB'

--Set FontID that is shown when you start script with debug set to true
Config.TextFont = 13

--How much water is added to the plant when watering plant
Config.WaterIncrease = 1.0

--How much of fertilizer is added to the plant when fertilizing plant
Config.FertilizerIncrease = 0.8

--How much water is removed each tick
Config.WaterConsumption = 0.05

--How much of fertilizer ir removed each tick
Config.FertilizerConsumption = 0.03

--Server side tick of plant (how fast are plants growing) in minutes. Plant is fully grown in 20 ticks.
Config.UpdateTickTime = 20

--Client side distance to pool plants
Config.ChunkDist = 30.0

--Client side distance to render (spawn) plant objects
Config.PlantRenderDist = 20.0

--Minimum distance between each plant
Config.MinimumDistanceBetweenPlants = 3.0

--Maximum count of plants per each player
Config.MaxPlantedPlantsPerPlayer = 20

--Different soil changes water consumption and plant growth rate of the plant (http://www.kronzky.info/fivemwiki/index.php/Materials)
Config.Soil = {
    [2128369009] = 0.6,
    [-1286696947] = 0.75,
    [-461750719] = 0.8,
    [1333033863] = 0.8,
    [3008270349] = 1.0,
    [3594309083] = 1.0,
    [2461440131] = 1.0,
    [1144315879] = 1.1,
    [2409420175] = 1.2,
    [3833216577] = 1.2,
    [4170197704] = 1.2,
    [223086562] = 1.3,
    [581794674] = 1.3,
    [2352068586] = 1.4,
    [1109728704] = 1.5,
}

Config.Plants = {
    {
        type = 'weed', --Used for script calls
        minZ = -1.1, --Lower plant default location by Z
        maxZ = 0.1, --Currently not in use
        name = 'Marihuana: Weak outdoor', --UI text label
        model = 'prop_weed_02', --Prop model of the plant
        saplingModel = 'prop_weed_02', --Currently not in use
        rewardItem = 'weed', --Which item player gets when plant is harvested
        seedItem = 'weed_seed', --Which item is needed to plant
        maxRewardCount = 5 --Maximum product yield from plant (based on health and growth)
    },
    {
        type = 'weed2', --Used for script calls
        minZ = -4.0, --Lower plant default location by Z
        maxZ = 0.1, --Currently not in use
        name = 'Marihuana: OG Cush', --UI text label
        model = 'bkr_prop_weed_med_01b', --Prop model of the plant
        saplingModel = 'bkr_prop_weed_med_01b', --Currently not in use
        rewardItem = 'weed', --Which item player gets when plant is harvested
        seedItem = 'weed_seed2', --Which item is needed to plant
        maxRewardCount = 10 --Maximum product yield from plant (based on health and growth)
    },
    {
        type = 'weed3', --Used for script calls
        minZ = -4.3, --Lower plant default location by Z
        maxZ = 0.1, --Currently not in use
        name = 'Marihuana: Gorilla', --UI text label
        model = 'bkr_prop_weed_lrg_01b', --Prop model of the plant
        saplingModel = 'bkr_prop_weed_lrg_01b', --Currently not in use
        rewardItem = 'weed', --Which item player gets when plant is harvested
        seedItem = 'weed_seed3', --Which item is needed to plant
        maxRewardCount = 15 --Maximum product yield from plant (based on health and growth)
    },
    {
        type = 'coca', --Used for script calls
        minZ = -1.1, --Lower plant default location by Z
        maxZ = 0.1, --Currently not in use
        name = 'Cocaine', --UI text label
        model = 'prop_plant_cane_01a', --Prop model of the plant
        saplingModel = 'prop_weed_02', --Currently not in use
        rewardItem = 'coke', --Which item player gets when plant is harvested
        seedItem = 'coca_seed', --Which item is needed to plant
        maxRewardCount = 10 --Maximum product yield from plant (based on health and growth)
    },
    {
        type = 'tobacco', --Used for script calls
        minZ = -1.1, --Lower plant default location by Z
        maxZ = 0.1, --Currently not in use
        name = 'Tobacco', --UI text label
        model = 'prop_plant_fern_02a', --Prop model of the plant
        saplingModel = 'prop_plant_fern_02a', --Currently not in use
        rewardItem = 'tobacco', --Which item player gets when plant is harvested
        seedItem = 'tobacco_seed', --Which item is needed to plant
        maxRewardCount = 20 --Maximum product yield from plant (based on health and growth)
    },
}

--Localization
Lang = {
    ['en_GB'] = {
        Debug = {
            playerCloseToPlant = 'Player is close to plant.',
            playerFarFromPlant = 'Player is too far away from plant. (%s meters away).',
        },
        UI = {
            examinePlant = 'Press ~y~[%s]~w~ to examine the plant.',
            closeToPlant = 'There is some kind of plant',
            itLooksLike = 'It looks like %s',
            waterPlant = 'Water plant',
            fertilizePlant = 'Fertilize plant',
            harvest = 'Harvest plant',
            confirm = 'Confirm',
            harvestTooltip = 'Plant is %s %s grown.\nYou will get fewer products if the plant is not fully grown.',
            confirmNo = '~g~~h~No, let the plant grow!',
            confirmYes = '~r~~h~Yes, harvest plant anyway!',
            wateringLabel = 'Watering',
            wateringDesc = 'Plant needs water to stay healty. If water level is too low plant health level will decrease.',
            fertilizingLabel = 'Fertilizing',
            fertilizingDesc = 'Fertilizing plant increases its quality and yields more product when harvested.',
            health = 'Plant health',
            healthDesc = 'If plant health is too low it is destroyed.',
            soilQuality = 'Soil quality',
            soilQualityDesc = 'Soil quality increases growth rate and plant water consumption.',
            menuHeader = 'Plant Info'
        },
        Notification = {
            tooCloseToOtherPlant = 'You cannot plant this seed because it is too close to other plant.',
            notSuitableSoil = 'You cannot plant this seed on this soil. It won`t grow here.',
            tooSteepTerrain = 'Terrain is too steep for planting.',
            plantingObstructed = 'Planting location is obstructed.',
            planting_too_far = 'Planting location is too far away from you.',
            planting_in_vehicle = 'You cannot plant seed from vehicle.',
            maximumPlantCountReached = 'You have reached maximum count of planted plants.',
            noLicenseFound = 'Could not find your rockstar identifier.'
        }
    },
    ['cs_CZ'] = {
        Debug = {
            playerCloseToPlant = 'Hráč je blízko rostliny.',
            playerFarFromPlant = 'Hráč je příliš daleko od rosliny. (%s metrů daleko).',
        },
        UI = {
            examinePlant = 'Stiskni ~y~[%s]~w~ pro prohlédnutí rostliny.',
            closeToPlant = 'Tady něco roste',
            itLooksLike = 'Vypadá to, jako %s',
            waterPlant = 'Pokropit',
            fertilizePlant = 'Zahnojit',
            harvest = 'Sklidit',
            confirm = 'Opravdu?',
            harvestTooltip = 'Rostlina je v %s %s růstu.\nZískáš menší počet produktů, pokud ji sklidíš.',
            confirmNo = '~g~~h~Ne, nech rostlinu růst!',
            confirmYes = '~r~~h~Ano, sklidit rostlinu!',
            wateringLabel = 'Kropení',
            wateringDesc = 'Rostlina potřebuje vodu pro růst. Pokud je hranice vody nízká, bude klesat zdraví rostliny.',
            fertilizingLabel = 'Hnojení',
            fertilizingDesc = 'Hnojení rostliny zvyšuje její kvalitu a tím více produktu ze sklizení.',
            health = 'Zdraví rostliny',
            healthDesc = 'Pokud je zdraví příliš nízké, rostlina bude zníčena.',
            soilQuality = 'Kvalita půdy',
            soilQualityDesc = 'Kvalita půdy ovlivňuje rychlost růstu rostliny a její spotřebu vody.',
            menuHeader = 'Rostlina'
        },
        Notification = {
            tooCloseToOtherPlant = 'Sazenici nelze zde zasadit - je příliš blízko jiné rostliny.',
            notSuitableSoil = 'Na této půdě nepůjde sazenici zasadit. Tady nic neporoste.',
            tooSteepTerrain = 'Terén je příliš strmý.',
            plantingObstructed = 'Něco brání rostlině v růstu. Tady to neporoste.',
            planting_too_far = 'Místo pro zasazení rostliny je příliš daleko od tebe.',
            planting_in_vehicle = 'Z vozidla nelze zasazovat sazenice.',
            maximumPlantCountReached = 'Více rostlin už zasadit nemůžeš.',
            noLicenseFound = 'Nelze najít tvůj rockstar identifier',
        }
    }
}






Planned features

  • Job restriction for each plant type
  • Allow plant anywhere (in bucket) without checking soil quality
  • Different items on each plant (with chance pool)
  • Add Polyzones for performance

Changelog

v1.0.3

  • Initial release

v1.0.4 (Day One patch)

  • Added new variable to config Config.Onesync to resolve issue with non-onesync servers
  • Added mew variable to config Config.ServerSyncTime to set update time to refresh plant info (time to sync data from server to client)
  • File sv_edit_me.lua file is now default implemented for ESX (for QBCore see into commented code)
  • Added check if player is already watering / fertilizing plant, to prevent spamming event
  • Added German translation (thanks to RainbowKush77)

v1.0.5

  • Removed non-necessary prints

v1.0.6

  • Fixed typo in sv_edit_me.lua
  • Prepared sv_edit_me.lua for QBCore framework
6 Likes

Yes, basicaly you can implement your own framework.
ESX and QBCore are prepared and commented (sv_edit_me.lua and cl_edit_me.lua).

You only need to handle item requirements, item reward, etc…

I’ll DM you example of sv_edit_me.lua

so for ESX users, just create an item for use instead of command would be needed?

Yes you simply do something like this:

ESX.RegisterUsableItem('weed_seed', function(source)
local src = source
	TriggerEvent('vx_farming:plantNewSeed', src, 'weed')
end)

Examples are commented inside editable server and client sides
Command can be removed

can other players harvest/destroy crops?

Of course! So players have to guard their top secret locations.

1 Like

is there any customization you can do to plants? i.e. color ? and basically any plant prop will do?

You can use any prop as plant. Go to plebmaster to find your prop!

1 Like

thanks for quick replies. and offering an open source. I have another script like this, that allows you to change the props color. gonnaa see if I can mesh that in, will likely buy soon. glws

1 Like

will this work with linden_inventory

There is no dependency on anything, so it will work with everything.
(You can implement your own functions to obtain and use items)

hello where is the configurable items for planting, watering and fertilizing in config please ?

Hello, it is not in config, it is in sv_edit_me.lua

1 Like

okay it’s possible to modify with the Obfuscated version ?

Of course!

In obfuscated edition you can:

  • Change font
  • Change method of rendering 3d text
  • Edit notification (implement your own notification system)
  • Edit event needed to spawn new plant (use item seed, etc)
  • Edit event needed to water plant (use item water)
  • Edit event needed to fertilize plant (use item fertilizer)
  • Edit reward item function from harvesting plant
  • Edit identifier from player (so you can limit how many plants each player can plant, default is Rockstar ID)
  • +Edit everything in config

Update 1.0.4 (Day One patch)

  • Added new variable to config Config.Onesync to resolve issue with non-onesync servers
  • Added mew variable to config Config.ServerSyncTime to set update time to refresh plant info (how much water, health, fertilizer it has)
  • File sv_edit_me.lua file is now default implemented for ESX (for QBCore see into commented code)
  • Added check if player is already watering / fertilizing plant, to prevent spamming event
  • Added German translation (thanks to RainbowKush77)

awesome guy, absolutely amazing support… thanks so much for helping out with my esx issue! script works flawlessly unlike some others i have spent $ on.

1 Like

Very nice script it’s amazing !! and the fast support !! Thanks men

2 Likes

You could easliy drop some MS with Polyzones. not that the ms has to do anything with optimization, but if you wanted a better detection system then the old comparatives.

Thanks for idea! Ill definitly make Polyzones as available option in config in future.