Installation
This guide will walk you through installing prp-farming on your FiveM server.
Installation steps
1
Download the resources
Download
prp-drugs, prp-drugs-assets, prp-scanner and prp-scanner-assets from the CFX portal and place them in your resources folder.2
Add to server.cfg
Add all resources to your
server.cfg after all dependencies, with the assets resource before the main script. ensure ox_lib
ensure prp-bridge
ensure prp-scanner-assets
ensure prp-scanner
ensure prp-drugs-assets
ensure prp-drugs3
Database
The cocaine, drug_pots, meth_* tables are created automatically on first run.
4
Add items
Add the required items to your inventory resource — see Items below.
5
Configure shared/config.lua
Open
shared/config.lua to configure the job, activities and farm health settings.6
Configure server/config.lua
Open
server/config.lua to configure the seeds shop and webhook logging.7
Optional: disable open world
Set
Config.OWState = false in shared/config_openworld.lua to disable open world farming.8
Optional: meth lab MLO
To use the meth lab MLO, add the doorlock to ox_doorlock — see SQL below.
9
Optional: inventory icons
Custom inventory icons are included in the
installation/inventory icons folder. Copy them to your inventory resource's image directory if you'd like to use them.sql
INSERT INTO `ox_doorlock` (`name`, `data`) VALUES ('meth_lab_1', '{"state":1,"heading":85,"coords":{"x":916.1180419921875,"y":-2116.240234375,"z":30.62567520141601},"model":-1836592517,"doors":false,"maxDistance":2,"autolock":300}');Items
Add all required items to your inventory resource using the format appropriate for your setup.
Add the items below to your ox_inventory into data/items.lua.
lua
-- Drug Farming
["drugs_pot_small"] = {
label = "Small Drug Pot",
stack = false,
weight = 1000
},
["drugs_pot_medium"] = {
label = "Medium Drug Pot",
stack = false,
weight = 2000
},
["drugs_pot_large"] = {
label = "Large Drug Pot",
stack = false,
weight = 3000
},
-- Drug Farming Tools
["farm_water_can"] = {
label = "Watering Can",
stack = false,
weight = 500
},
["farm_fertilizer"] = {
label = "Fertilizer",
stack = false,
weight = 1000,
},
-- Drug Farming Seeds
["seeds_weed_1a"] = {
label = "Regular Grape Ape Seed",
weight = 100
},
["seeds_weed_1b"] = {
label = "Cherry Kush Seed",
weight = 100
},
["seeds_weed_2a"] = {
label = "Martian Candy Seed",
weight = 100
},
["seeds_weed_2b"] = {
label = "Exodus Seed",
weight = 100
},
["seeds_weed_2c"] = {
label = "Headband Seed",
weight = 100
},
["seeds_cocaine"] = {
label = "Cocaine Seeds",
weight = 100
},
-- Drug Farming Crops
["weed_1a"] = {
label = "Crop of Regular Grape Ape",
weight = 100
},
["weed_1b"] = {
label = "Crop of Cherry Kush",
weight = 100
},
["weed_2a"] = {
label = "Crop of Martian Candy",
weight = 100
},
["weed_2b"] = {
label = "Crop of Exodus",
weight = 100
},
["weed_2c"] = {
label = "Crop of Headband",
weight = 100
},
["cocaine_leaf"] = {
label = "Coca Leaf",
weight = 100
},
-- Weed
["rolling_paper"] = {
label = "Rolling Paper",
weight = 0,
},
["joint_1a"] = {
label = "(Joint) Regular Grape Ape",
weight = 200
},
["joint_1b"] = {
label = "(Joint) Cherry Kush",
weight = 200
},
["joint_2a"] = {
label = "(Joint) Martian Candy",
weight = 200
},
["joint_2b"] = {
label = "(Joint) Exodus",
weight = 200
},
["joint_2c"] = {
label = "(Joint) Headband",
weight = 200
},
-- Cocaine
["plastic"] = {
label = "Plastic",
weight = 0
},
["cocaine_container"] = {
label = "Mixing Container",
weight = 500,
stack = false,
close = true,
buttons = {
{
label = "Shake",
action = function(slot)
TriggerServerEvent("prp-drugs:server:cocaine:shakeContainer", slot)
end
}
}
},
["cocaine_solvent"] = {
label = "Solvent",
weight = 1000,
},
["cocaine_leaf"] = {
label = "Coca Leaf",
weight = 100
},
["cocaine_drying_rack"] = {
label = "Drying Rack",
weight = 15000,
model = `pr_cokedry_01`,
stack = false
},
["cocaine_paste"] = {
label = "Coca Paste",
weight = 100,
model = `prp_cocaine_paste`
},
["cocaine_smelter"] = {
label = "Smelting Furnace",
weight = 25000,
model = `cocaine_smelting_01a`,
stack = false
},
["limestone_dust"] = {
label = "Limestone Dust",
weight = 100
},
["cocaine_powder"] = {
label = "Coca Powder",
weight = 100,
model = `prp_cocaine_powder`
},
["cocaine_brick"] = {
label = "Cocaine Brick",
weight = 1000,
model = `hei_prop_heist_weed_block_01`,
stack = false
},
["cocaine"] = {
label = "Cocaine",
weight = 100,
stack = false,
},
["wood_log"] = {
label = "Wood Log",
weight = 2300,
stack = false
},
["wood_plank"] = {
label = "Wood Plank",
weight = 1600,
stack = false
},
-- Meth
["meth_kit"] = {
label = "Lab Kit",
weight = 20000,
stack = false,
model = `prp_meth_kit`,
},
["meth_cooker_low"] = {
label = "Small Meth Cooker",
weight = 20000,
stack = false,
model = `pr_methcooker_01`,
},
["meth_cooker_mid"] = {
label = "Medium Meth Cooker",
weight = 20000,
stack = false,
model = `pr_methcooker_01`,
},
["meth_cooker_high"] = {
label = "Large Meth Cooker",
weight = 20000,
stack = false,
model = `pr_methcooker_01`,
},
["meth_cooler_low"] = {
label = "Small Meth Cooler",
weight = 5000,
stack = false
},
["meth_cooler_mid"] = {
label = "Medium Meth Cooler",
weight = 5000,
stack = false
},
["meth_cooler_high"] = {
label = "Large Meth Cooler",
weight = 5000,
stack = false
},
["meth_explosive"] = {
label = "Explosive",
weight = 2000,
stack = false,
},
["meth"] = {
label = "Meth",
weight = 100,
model = `prp_meth`,
},
["meth_slop"] = {
label = "Wet Slop",
weight = 0.05,
model = `prp_meth_slop`
},
["meth_hose"] = {
label = "Rubber Hose",
weight = 1000,
model = `prop_hose`,
},
["meth_pseudo"] = {
label = "Pseudoephedrine Extract",
weight = 5,
model = `prp_meth_pseudo`
},
["meth_redpowder"] = {
label = "Red Phosphorus Powder",
weight = 5,
model = `prp_meth_redpowder`
},
["meth_lithium"] = {
label = "Lithium Strips",
weight = 5,
model = `prp_meth_lithium`
},
["meth_ammonia_barrel"] = {
label = "Barrel of Ammonia",
weight = 50000,
model = `prop_barrel_01a`,
},
["meth_lab_card"] = {
label = "Laboratory Card",
weight = 1,
degrade = 2880, -- 2 days in minutes
stack = false,
description = "You can notice a logo saying \"THORNS\" on the card"
},Database
The resource creates the following tables automatically:
sql
CREATE TABLE IF NOT EXISTS `cocaine_world_objects` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`owner` varchar(255) NOT NULL,
`position` varchar(255) NOT NULL,
`type` enum('rack', 'smelter') NOT NULL,
`created_at` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `drug_pots` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`stateId` varchar(255) NOT NULL,
`potName` varchar(255) NOT NULL,
`pos` varchar(255) NOT NULL,
`locationId` int(11) NOT NULL,
`crops` longtext NOT NULL,
`lastWatered` int(11) NULL,
`lastFertilized` int(11) NULL,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `meth_formulas` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`stateId` varchar(255) NOT NULL,
`a` tinyint(4) NOT NULL DEFAULT 1,
`b` tinyint(4) NOT NULL DEFAULT 1,
`c` tinyint(4) NOT NULL DEFAULT 1,
`weight_a` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`weight_b` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`weight_c` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`version` tinyint(4) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `meth_ammonia` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`coords` varchar(256) NOT NULL,
`stateId` varchar(255) NOT NULL,
`ammoniaType` tinytext NOT NULL DEFAULT 'meth_ammonia_barrel',
`amountLeft` smallint(6) NOT NULL DEFAULT 0,
`createdAt` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `meth_cookers` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`coords` varchar(256) NOT NULL,
`stateId` varchar(255) NOT NULL,
`batchName` tinytext DEFAULT NULL,
`cookerType` tinytext NOT NULL DEFAULT 'meth_cooker_low',
`ammoniaBurnRate` int(10) unsigned NOT NULL DEFAULT 25,
`durability` float(5,2) unsigned NOT NULL DEFAULT 100.00,
`a` tinyint(3) unsigned NOT NULL DEFAULT 0,
`b` tinyint(3) NOT NULL DEFAULT 0,
`c` tinyint(3) unsigned NOT NULL DEFAULT 0,
`optimalA` tinyint(3) unsigned NOT NULL DEFAULT 0,
`optimalB` tinyint(3) unsigned NOT NULL DEFAULT 0,
`optimalC` tinyint(3) unsigned NOT NULL DEFAULT 0,
`weight_a` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`weight_b` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`weight_c` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`isExploded` tinyint(1) unsigned NOT NULL DEFAULT 0,
`isSabotaged` tinyint(1) unsigned NOT NULL DEFAULT 0,
`totalYield` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`cyclesCompleted` smallint(5) unsigned NOT NULL DEFAULT 0,
`cycleTimer` int(10) unsigned NOT NULL DEFAULT 600,
`extraYieldModifier` float(5,2) unsigned NOT NULL DEFAULT 0.00,
`createdAt` datetime NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `meth_hose_connections` (
`ammoniaId` int(10) unsigned NOT NULL,
`cookerId` int(10) unsigned NOT NULL,
UNIQUE KEY `ammoniaId` (`ammoniaId`,`cookerId`),
KEY `FK_meth_hose_connections_meth_cookers` (`cookerId`),
CONSTRAINT `FK_meth_hose_connections_meth_ammonia` FOREIGN KEY (`ammoniaId`) REFERENCES `meth_ammonia` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `FK_meth_hose_connections_meth_cookers` FOREIGN KEY (`cookerId`) REFERENCES `meth_cookers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
);
CREATE TABLE IF NOT EXISTS `meth_lab_cookers` (
`cooker_id` int unsigned NOT NULL,
`lab_id` varchar(50) NULL,
PRIMARY KEY (`cooker_id`),
constraint meth_lab_cookers_meth_cookers_id_fk foreign key (cooker_id) references meth_cookers (id) on delete cascade
);