Config

You can check out default config

cfg.Prefix             = QBCore
cfg.TriggerPrefix      = "QBCore"
cfg.ExportPrefix       = "qb-core"

cfg.Language           = 'en'               -- Language to load from locales

cfg.Courier_Cooldown   = {min = 2, max = 5}
cfg.Keys_Limit	       = 5
cfg.Temperature_Unit   = "Celsius"          -- "Celsius" or "Fahrenheit"
cfg.sale_ped_model     = "S_M_Y_DevinSec_01"
cfg.sell_lab_tax       = 25

cfg.Time               = {					-- Actually configured for "GMT +1"
    ["Zone"]           = "plus", 			-- "plus" or "minus"
    ["Zone_Count"]     = 1,
    ["Format"]         = 24 				-- 24 or 12 (PM/AM)
}

cfg.Bill 	       = {
	pricePerWattage = 5,
	daysToPay = 7
}

cfg.Air_Conditioning   = "prop_aircon_s_03a" 

cfg.Delivery_Packages  = {
	"prop_mp_drug_package", "prop_mp_drug_pack_blue", "prop_mp_drug_pack_red"
}

cfg.Pot 	       = {
	"weed_pot_empty", "sf_prop_sf_weed_01_small_01a", "sf_prop_sf_weed_med_01a", "sf_prop_sf_weed_lrg_01a"
}

cfg.Seed 	       = {
	temperature_tolerance = {["Celsius"] = 1.5, ["Fahrenheit"] = 10.0},
	temperature_multiplier = 0.5,
	max_growth_multiplier = 1.25,

	["weed_white_widow_seed"] = {
		label = "White Widow",
		drug = "weed_white_widow",
		price = 2000,
		rep = 0,
		increase_rep = 1,
		description = "White Widow is a balanced hybrid strain of Cannabis indica and Cannabis sativa. White Widow is a cross between a Brazilian sativa strain and a resin-heavy South Indian indica.",
		temperature = {["Celsius"] = 18, ["Fahrenheit"] = 64.4},
		increase_progress = 0.0005,  -- ~55 hours (0-100%)
		decrease_hydration = 0.0015, -- ~19 hours (100-0%)
		cut_weed = {
			[1] = nil,
			[2] = {min = 50, max = 75},
			[3] = {min = 100, max = 150},
			[4] = {min = 200, max = 400}
		}
	},
	["weed_og_kush_seed"] = {
		label = "OG Kush",
		drug = "weed_og_kush",
		price = 4000,
		rep = 50,
		increase_rep = 1,
		description = "OG Kush is a hybrid marijuana strain with a distinctive earthy, pine, woody aroma. It is well-known for its relaxing and euphoric effects.",
		temperature = {["Celsius"] = 20, ["Fahrenheit"] = 68},
		increase_progress = 0.0005,  -- ~55 hours (0-100%)
		decrease_hydration = 0.0015, -- ~19 hours (100-0%)
		cut_weed = {
			[1] = nil,
			[2] = {min = 50, max = 75},
			[3] = {min = 100, max = 150},
			[4] = {min = 200, max = 400}
		}
	},
	["weed_purple_haze_seed"] = {
		label = "Purple Haze",
		drug = "weed_purple_haze",
		price = 6000,
		rep = 100,
		increase_rep = 1,
		description = "Purple Haze is a sativa dominant hybrid (85% sativa/15% indica) strain that is a potent cross between the rare yet popular Purple Thai X Haze strains.",
		temperature = {["Celsius"] = 22, ["Fahrenheit"] = 71.6},
		increase_progress = 0.0005,  -- ~55 hours (0-100%)
		decrease_hydration = 0.0015, -- ~19 hours (100-0%)
		cut_weed = {
			[1] = nil,
			[2] = {min = 50, max = 75},
			[3] = {min = 100, max = 150},
			[4] = {min = 200, max = 400}
		}
	},
	["weed_gorilla_glue_seed"] = {
		label = "Gorilla Glue",
		drug = "weed_gorilla_glue",
		price = 10000,
		rep = 150,
		increase_rep = 1,
		description = "Gorilla Glue is a potent hybrid strain that delivers heavy-handed euphoria and relaxation, leaving you feeling “glued” to the couch",
		temperature = {["Celsius"] = 24, ["Fahrenheit"] = 75.2},
		increase_progress = 0.0005,  -- ~55 hours (0-100%)
		decrease_hydration = 0.0015, -- ~19 hours (100-0%)
		cut_weed = {
			[1] = nil,
			[2] = {min = 50, max = 75},
			[3] = {min = 100, max = 150},
			[4] = {min = 200, max = 400}
		}
	}
}

cfg.Parts 	      = {
	["ventilation"] = {usageTime = 24, increase_progress = 0.000025, mode = {["Economy"] = {Power = 20, RPM = 800}, ["Balanced"] = {Power = 40, RPM = 1000}, ["Performance"] = {Power = 60, RPM = 1200}}},
	["ventilation_plus"] = {usageTime = 36, increase_progress = 0.00005, mode = {["Economy"] = {Power = 10, RPM = 1200}, ["Balanced"] = {Power = 20, RPM = 1400}, ["Performance"] = {Power = 30, RPM = 1600}}},

	["heater"] = {usageTime = 36, increase_progress = 0.000025, mode = {["Off"] = {Power = 0, Temperature = {["Celsius"] = 5, ["Fahrenheit"] = 41.0}}, ["Economy"] = {Power = 50, Temperature = {["Celsius"] = 20, ["Fahrenheit"] = 68.0}}, ["Balanced"] = {Power = 70, Temperature = {["Celsius"] = 22, ["Fahrenheit"] = 71.6}}, ["Performance"] = {Power = 100, Temperature = {["Celsius"] = 24, ["Fahrenheit"] = 75.2}}}},
	["heater_plus"] = {usageTime = 48, increase_progress = 0.00005, mode = {["Off"] = {Power = 0, Temperature = {["Celsius"] = 5, ["Fahrenheit"] = 41.0}}, ["Economy"] = {Power = 25, Temperature = {["Celsius"] = 20, ["Fahrenheit"] = 68.0}}, ["Balanced"] = {Power = 35, Temperature = {["Celsius"] = 22, ["Fahrenheit"] = 71.6}}, ["Performance"] = {Power = 50, Temperature = {["Celsius"] = 24, ["Fahrenheit"] = 75.2}}}},

	["pot"] = {usage = 2},
	["pot_plus"] = {usage = 5},

	["water_tank"] = {capacity = 200.0},

	["water_bottle_big"] = {capacity = 10.0},

	["watering_can"] = {capacity = 3.0}
}

cfg.Laptop = {
	apps = {
		["parts-shop"] = {
			{
				category = {name = "House", img = "apps/parts-shop/house.png"},
				items = {
					{name = "ventilation", label = "Ventilation Kit", price = 1999, img = "apps/parts-shop/ventilation_item.png", usageTime = cfg.Parts["ventilation"].usageTime},
					{name = "ventilation_plus", label = "Ventilation Kit Plus", price = 3999, img = "apps/parts-shop/ventilation_plus_item.png", usageTime = cfg.Parts["ventilation_plus"].usageTime},
					{name = "heater", label = "Heater", price = 2999, img = "apps/parts-shop/heater_item.png", usageTime = cfg.Parts["heater"].usageTime},
					{name = "heater_plus", label = "Heater Plus", price = 5999, img = "apps/parts-shop/heater_plus_item.png", usageTime = cfg.Parts["heater_plus"].usageTime},
				}
			},
			{ 
				category = {name = "Garden", img = "apps/parts-shop/garden.png"},
				items = {
					{name = "pot", label = "Pot", price = 89, img = "apps/parts-shop/pot_item.png", usage = cfg.Parts["pot"].usage},
					{name = "pot_plus", label = "Pot Plus", price = 199, img = "apps/parts-shop/pot_plus_item.png", usage = cfg.Parts["pot_plus"].usage},
					{name = "watering_can", label = "Watering Can", price = 299, img = "apps/parts-shop/watering_can_item.png" , capacity = cfg.Parts["watering_can"].capacity},
					{name = "water_bottle_big", label = "Water Bottle Big", price = 99, img = "apps/parts-shop/water_bottle_big_item.png", capacity = cfg.Parts["water_bottle_big"].capacity}
				}
			}
		}
	}
}

function progressBar(data)
	-- data / title, duration, icon, cannotMove, cancelable
	-- return true or false

	-- inside-ui
	-- return exports["inside-ui"]:ProgressBar(data.title, data.duration, data.icon, data.cannotMove, data.cancelable)

	local result
	cfg.Prefix.Functions.Progressbar("inside-weed", data.title, data.duration, false, data.cancelable, {
		disableMovement = data.cannotMove,
		disableCombat = data.cannotMove,
	}, {}, {}, {}, function() -- Done
		result = true
	end, function() -- Cancel
		result = false
	end)

	return result
end

function clientNotify(txt, duration, style)
	-- inside-ui
	-- exports["inside-ui"]:Notify(false, txt, duration, type)

	if style == "info" then style = "primary" end

	TriggerEvent('QBCore:Notify', txt, style, duration)
end

function serverNotify(id, txt, duration, style)
	-- inside-ui
	-- TriggerClientEvent("inside-ui:Notify", id, false, txt, duration, type)

	if style == "info" then style = "primary" end

	TriggerClientEvent('QBCore:Notify', id, txt, style, duration)
end

Server Configuration

cfg.Prefix.Commands.Add('weed-create', translate("server", "command_creator_info"), {}, false, function(source)
    TriggerClientEvent("Weed:CreatorNUI", source)
end, 'admin')

function CreateUsableItems()
    for k, v in pairs(cfg.Seed) do
        cfg.Prefix.Functions.CreateUseableItem(k, function(source, item)
            if onlinePlayers["id:"..source].isBuilding then serverNotify(source, translate("server", "notify_config_error_1"), 3000, "error") return end
            if onlinePlayers["id:"..source].hasWateringCan then serverNotify(source, translate("server", "notify_config_error_2"), 3000, "error") return end
            local freePots = 0
            local inLab = onlinePlayers["id:"..source].inInterior
            local gotKeys = false

            if inLab then
                if Lab[inLab].data.cleaning then serverNotify(source, translate("server", "notify_config_info_1"), 3000, "info") return end
                for _, labName in pairs(onlinePlayers["id:"..source].keys) do
                    if labName == inLab then
                        gotKeys = true
                        break
                    end
                end

                if not gotKeys then serverNotify(source, translate("server", "notify_config_error_3"), 3000, "error") return end

                for k, v in pairs(Lab[inLab].data.pots) do
                    if v.item and not v.seed then
                        freePots = freePots + 1
                    end
                end

                if freePots == 0 then serverNotify(source, translate("server", "notify_config_error_4"), 3000, "error") return end

                TriggerClientEvent("Weed:Get_Nearest_Pot", source, inLab, k)
            else
                serverNotify(source, translate("server", "notify_config_info_2"), 3000, "info")
            end
        end)
    end

    for k, v in pairs(cfg.Parts) do
        cfg.Prefix.Functions.CreateUseableItem(k, function(source, item)
            if onlinePlayers["id:"..source].isBuilding then serverNotify(source, translate("server", "notify_config_error_1"), 3000, "error") return end
            if onlinePlayers["id:"..source].hasWateringCan then serverNotify(source, translate("server", "notify_config_error_2"), 3000, "error") return end
            local inLab = onlinePlayers["id:"..source].inInterior
            local gotKeys = false

            if inLab then
                if Lab[inLab].data.cleaning then serverNotify(source, translate("server", "notify_config_info_1"), 3000, "info") return end
                for _, labName in pairs(onlinePlayers["id:"..source].keys) do
                    if labName == inLab then
                        gotKeys = true
                        break
                    end
                end

                if not gotKeys then serverNotify(source, translate("server", "notify_config_error_3"), 3000, "error") return end

                if k == "ventilation" or k == "ventilation_plus" then
                    local canMontage = Lab[inLab].data.ventilation.item == nil

                    if canMontage then
                        serverNotify(source, translate("server", "notify_config_info_3"), 3000, "info")
                        onlinePlayers["id:"..source].isBuilding = k
                        TriggerClientEvent("Weed:Montage_Ventilation", source, inLab)
                    else
                        serverNotify(source, translate("server", "notify_config_error_5"), 3000, "error")
                    end
                elseif k == "heater" or k == "heater_plus" then
                    local canMontage = Lab[inLab].data.heater.item == nil

                    if canMontage then
                        serverNotify(source, translate("server", "notify_config_info_4"), 3000, "info")
                        onlinePlayers["id:"..source].isBuilding = k
                        TriggerClientEvent("Weed:Montage_Heater", source, inLab)
                    else
                        serverNotify(source, translate("server", "notify_config_error_6"), 3000, "error")
                    end
                elseif k == "pot" or k == "pot_plus" then
                    local freePlaces = 0

                    for k, v in pairs(Lab[inLab].data.pots) do
                        if not v.item then
                            freePlaces = freePlaces + 1
                        end
                    end

                    if freePlaces == 0 then serverNotify(source, translate("server", "notify_config_error_7"), 3000, "error") return end

                    serverNotify(source, translate("server", "notify_config_info_5"), 3000, "info")
                    onlinePlayers["id:"..source].isBuilding = k
                    TriggerClientEvent("Weed:Montage_Pot", source, inLab)
                elseif k == "watering_can" then
                    local canMontage = Lab[inLab].data.watering_can.capacity == nil

                    if canMontage then
                        serverNotify(source, translate("server", "notify_config_info_6"), 3000, "info")
                        onlinePlayers["id:"..source].isBuilding = k
                        TriggerClientEvent("Weed:Montage_Watering_Can", source, inLab)
                    else
                        serverNotify(source, translate("server", "notify_config_error_8"), 3000, "error")
                    end
                elseif k == "water_bottle_big" then
                    local canFill = Lab[inLab].data.water_tank.capacity < cfg.Parts["water_tank"].capacity

                    if canFill and not Lab[inLab].fillingTank then
                        TriggerClientEvent("Weed:Fill_Water_Tank", source, inLab, k)
                    elseif not canFill then
                        serverNotify(source, translate("server", "notify_config_error_9"), 3000, "error")
                    elseif Lab[inLab].fillingTank then
                        serverNotify(source, translate("server", "notify_config_info_7"), 3000, "info")
                    end
                end
            else
                serverNotify(source, translate("server", "notify_config_info_2"), 3000, "info")
            end
        end)
    end
end

function Check_Item(id, itemName)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        local item = xPlayer.Functions.GetItemByName(itemName)

        if item ~= nil then
            return {name = itemName, amount = item.amount, label = item.label}
        else
            return nil
        end
    end
end

function Get_Name(id)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        return xPlayer.PlayerData.charinfo.firstname.." "..xPlayer.PlayerData.charinfo.lastname
    end
end

function Get_Citizen(id)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        return xPlayer.PlayerData.citizenid
    end
end

function Check_Cash(id)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        return xPlayer.PlayerData.money.cash
    end
end

function Check_Bank_Cash(id)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        return xPlayer.PlayerData.money.bank
    end
end

function Add_Cash(id, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        xPlayer.Functions.AddMoney('cash', amount)
    end
end

function Remove_Cash(id, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        xPlayer.Functions.RemoveMoney('cash', amount)
    end
end

function Add_Bank_Cash(id, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        xPlayer.Functions.AddMoney('bank', amount)
    end
end

function Remove_Bank_Cash(id, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)

    if xPlayer then
        xPlayer.Functions.RemoveMoney('bank', amount)
    end
end

function Add_Item(id, itemName, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)
    
    if xPlayer then
        xPlayer.Functions.AddItem(itemName, amount)
    end
end

function Remove_Item(id, itemName, amount)
    local xPlayer = cfg.Prefix.Functions.GetPlayer(id)
    
    if xPlayer then
        xPlayer.Functions.RemoveItem(itemName, amount)
    end
end

Last updated