Accessible code
Shared = {
Locale = 'en',
commands = {
deletePlant = {
name = 'deleteplant',
help = 'Command that allows you to delete closest plant to you',
restricted = 'group.admin'
},
tpplant = {
name = 'tpplant',
help = 'Command that allows you to teleport to desired plant',
restricted = 'group.admin'
},
plantShow = {
name = 'plantshow',
help = 'Command that allows you to turn on/off blips of weed\'s on minimap',
restricted = 'group.admin'
},
plantInfo = {
name = 'plantinfo',
help = 'Command that allows you to get closest plant info',
restricted = 'group.admin'
},
plantid = {
name = 'plantid',
help = 'Command that allows you to get cloest plant ID',
restricted = 'group.admin'
},
placeplant = {
name = 'placeplant',
help = 'Command that allows you to place plant on desired location'
},
cornersell = {
enabled = true, -- if you dont want to use this cornersell, put this to false
name = 'cornersell',
help = 'Command that turns on/off corner selling',
reward = 'black_money' -- item that you will get upon selling weed
}
},
math = {
updateInterval = 35000, -- how often plants are updated in msec, would recomment not to go under 30000 msec (30 sec)
/*
in every updateInterval hydratation
and feed will decrease by reduceHydration
aka:
every 35 sec hydratation and feed will decrease by
3% and growth will increase by 2%
*/
reduceHydration = 3.0,
reduceFeed = 3.0,
giveGrowth = 2.0,
giveWater = 10.0, -- how much % plant will get upon watering
giveFood = 10.0, -- how much % plant will get upon feeding
/*
in every updateInterval if plants
hydratation is above QualityLvl
then it will give giveQuality else it will
reduceQuality
aka:
in every 35 sec if hydratation and
feed >= 65% then quality of plant will
increase by 5% else it will decrease
by 5%
*/
QualityLvl = 65.0,
giveQuality = 5.0,
reduceQuality = 5.0,
/*
on what growth % it will change to next stage
aka if plants growth is 55% then it will go to stage II,
same for stage III
*/
stageII = 55.0,
stageIII = 85.0,
/*
after plant reaches 100%, on harvest
next math will be applied:
quality / 2
max 100 / 2 = 50
min 10 / 2 = 10
if you took well care of plant
and it has 100% quality you will
get 50 rewardItem
*/
harvestMath = 2, -- plant quality / harvestMath will give final item, 100 quality / 2 = 50 cannabis, 10 quality / 2 = 5 cannabis
},
Gloves = {
male = {
['32'] = true,
},
female = {
}
},
fingerPrint = { -- when planting plant, if you don't have glowes that are down there at table you will leave fingerprints at plant which police can find, needs ox_inventory for storing metadata, fingerprints are leaved when you plant/feed/water plant
enable = true,
allowedJobs = { -- jobs that will be able to search for fingerprints
['police'] = true,
},
removeYourOwnPrints = true, -- possibility to remove your own fingerprints on plants, future plant to add item required to remove
},
durations = {
watering = 6000, -- 6 sec sec
feedingPlant = 6000, -- 6 sec sec
removingPrints = 7500, -- 7.5 sec
searchingForPrints = 10000, -- 10 sec
fingerPrintScann = 10000, -- 10 sec
},
fingerPrintScanner = {
coords = vec3(461.642, -989.308, 24.915),
TextUI = {
position = "right-center",
icon = 'fa-solid fa-fingerprint',
style = {
borderRadius = 5,
backgroundColor = '',
color = ''
}
},
blip = {
enable = true, -- if you want for fingerPrint.allowedJobs to see blip
color = 30, -- https://docs.fivem.net/docs/game-references/blips/#blip-colors
type = 211, -- https://docs.fivem.net/docs/game-references/blips/
size = 0.6,
text = 'Finger Print Scanner'
}
},
useTarget = false, -- possibility to use third eye scipt
targetType = 'qtarget', -- can be qb-target/qtarget/ox_target
TextUI = { -- if useTarget is disabled then you get text ui, currently looks like this: https://prnt.sc/lKUZnckZkEIg
position = "right-center",
icon = 'fa-solid fa-cannabis',
style = {
borderRadius = 5,
backgroundColor = '#48BB78',
color = 'white'
}
},
notifyPosition = 'bottom', -- 'top' or 'top-right' or 'top-left' or 'bottom' or 'bottom-right' or 'bottom-left' or 'center-right' or 'center-left'
WeedStages = { -- plants per stage, if you have custom prop for this just can put it here
[1] = `bkr_prop_weed_01_small_01c`,
[2] = `bkr_prop_weed_med_01a`,
[3] = `bkr_prop_weed_lrg_01a`,
},
jobs = { -- jobs that will be able to destroy plants
['police'] = true,
},
items = {
pot = 'weedpot',
fertilizer = 'fertilizer', -- item used to increase growth of weed
water = 'water', -- item used to to reduce thirst of plant,
rewardItem = 'cannabis' -- when strain type is unknown it will give this item, when migratin from old version
},
-- if you are migrating from version before where no strains types existed, this price will be used when selling, when harvesting it will give item that you used before in items.rewardItem
priceForUnknown = math.random(50, 90),
strains = {
['p_haze'] = { -- item name (you need to add this item to your inventory or framework)
seed = 'p_haze_seed', -- seed item name (you need to add this item to your inventory or framework)
label = 'Purple Haze', -- label that will be displayed in menu
back = { 0, 2, 30 }, -- { minimum, maximum, give chance, min 0, max 2, chance 30% }, upon harvesting how much you should get seed
--price = 150, -- price per item, you can also use math.radnom() to get random price upon every script start, also supported price per day
price = {
['Mon'] = math.random(50, 100),
['Tue'] = 110,
['Wed'] = 120,
['Thu'] = 130,
['Fri'] = 140,
['Sat'] = 150,
['Sun'] = 170,
},
sellChance = 50 -- % to sell item to npc
}
-- you can add more types here
},
maxPlants = 6, -- max plants per player, if you put false then this feature is disabled
forbiddenPlantZones = { -- zone where people will not be able to plant weed, radius is around 500 units from center of this coords
{coords = vec3(426.544, -979.332, 30.706)},
},
}
Discord = {
url = '', -- url here
title = 'Server Name',
/*
https://www.spycolor.com/
['default'] = 14423100,
['blue'] = 255,
['red'] = 16711680,
['green'] = 65280,
['white'] = 16777215,
['black'] = 0,
['orange'] = 16744192,
['yellow'] = 16776960,
['pink'] = 16761035,
['lightgreen'] = 65309,
*/
color = 65309, -- green
imageUrl = 'https://cdn.discordapp.com/attachments/1126197898439295066/1129791542379434004/discord_banner_uniq.png', -- optional, if you dont want it put ''
}
---@return boolean
function ExtraCheck()
return true
end
---@param coords vector3|vector3[]
function PoliceNotify(coords)
end
local oxinv = GetResourceState("ox_inventory")
local qbinv = GetResourceState("qb-inventory")
local psinv = GetResourceState("ps-inventory")
local qsinv = GetResourceState("qs-inventory")
local core = GetResourceState("core_inventory")
function ImagePath()
if oxinv then
return 'nui://ox_inventory/web/images/%s.png'
elseif qbinv then
return'nui://qb-inventory/html/images/%s.png'
elseif psinv then
return 'nui://ps-inventory/html/images/%s.png'
elseif qsinv then
return 'nui://qs-inventory/html/images/%s.png'
elseif core then
return 'nui://core_inventory/html/img/%s.png'
end
return ''
end
function Notify(msg, type)
lib.notify({
description = msg,
type = type,
position = Shared.notifyPosition,
duration = 4500
})
end
RegisterNetEvent('uniq-weedplant:Notify', Notify)
RegisterNetEvent('uniq-weedplant:afterHarvest', function ()
if source == '' then return end
-- here you can put code for xp or something if you want after you harvest your plant
end)
function AddItem(source, item, amount)
if IsESX() then
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addInventoryItem(item, amount)
elseif IsQBCore() then
local Player = QBCore.Functions.GetPlayer(source)
Player.Functions.AddItem(item, amount)
end
end
function RemoveItem(source, item, amount)
if IsESX() then
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.removeInventoryItem(item, amount)
elseif IsQBCore() then
local Player = QBCore.Functions.GetPlayer(source)
Player.Functions.RemoveItem(item, amount)
end
end
function GetItemAmount(source, name)
if IsESX() then
local xPlayer = ESX.GetPlayerFromId(source)
local item = xPlayer.getInventoryItem(name)
if item then
for k,v in pairs(item) do
if k == 'amount' then
return v
end
if k == 'count' then
return v
end
end
end
return 0
elseif IsQBCore() then
local Player = QBCore.Functions.GetPlayer(source)
local item = Player.Functions.GetItemByName(name)
if item then
for k,v in pairs(item) do
if k == 'amount' then
return v
end
if k == 'count' then
return v
end
end
end
return 0
end
end
-- if you dont want this, delete then
RegisterCommand('testscript', function (source, args, raw)
if IsESX() then
local xPlayer = ESX.GetPlayerFromId(source)
xPlayer.addInventoryItem('p_haze_seed', 2)
xPlayer.addInventoryItem(Shared.items.pot, 2)
xPlayer.addInventoryItem(Shared.items.water, 2)
xPlayer.addInventoryItem(Shared.items.fertilizer, 2)
elseif IsQBCore() then
local Player = QBCore.Functions.GetPlayer(source)
Player.Functions.AddItem('p_haze_seed', 2)
Player.Functions.AddItem(Shared.items.pot, 2)
Player.Functions.AddItem(Shared.items.water, 2)
Player.Functions.AddItem(Shared.items.fertilizer, 2)
end
end, true)
if IsESX() then
for k,v in pairs(Shared.strains) do
ESX.RegisterUsableItem(v.seed, function(source)
local src = source
local canPlant = lib.callback.await('uniq-weedplant:plantNewSeed', src)
if canPlant then
PlantSeed(src, k)
end
end)
end
elseif IsQBCore() then
for k,v in pairs(Shared.strains) do
QBCore.Functions.CreateUseableItem(v.seed, function(source)
local src = source
local canPlant = lib.callback.await('uniq-weedplant:plantNewSeed', src)
if canPlant then
PlantSeed(src, k)
end
end)
end
end
Last updated