Page cover image

๐Ÿ“ฆmad-drugruns

Chemistry meets Crime in the ultimate drug production and trafficking system for FiveM.

Buy mad-drugruns on Tebex

Introduction

๐Ÿงช Players dive into a custom laboratory UI where they experiment with different ingredient ratios to discover what makes the perfect product. With formulas either randomly generated at server startup or custom-defined by administrators, each experience is unique - criminals must test and refine their process to maximize profits.

But manufacturing is only half the game. Once they've created their product, the real thrill begins: locating the transport vehicle and embarking on heart-pounding delivery missions where police tracking systems create intense cat-and-mouse chases across the map.

๐Ÿš“ Only by successfully evading law enforcement until the tracker deactivates can they complete their delivery for substantial rewards. The higher the purity, the bigger the payoff.

With a configuration system where almost nothing is hard-coded, server owners can customize virtually every aspect of the experience: drug types and their ingredients, ideal formulas, random spawn locations, vehicle options with full performance tuning, tracking systems, rewards, police integration and countless other parameters. mad-drugruns creates the most immersive and ๐Ÿ”ฅ adrenaline-fueled criminal underworld experience available for any FiveM framework.


๐ŸŽž๏ธ Showcase

Watch the demonstration video to see mad-drugruns in action.


Why Choose mad-drugruns?

  • ๐Ÿ” Engaging Gameplay Loop: Players stay invested as they experiment with formulas and master evasion tactics

  • ๐Ÿ‘ฎ Immersive Police Integration: Creates organic roleplay opportunities between criminals and law enforcement

  • ๐Ÿ‘จโ€๐Ÿ’ป Highly Configurable: Define your own drug types, ingredients, formulas, locations, and much more.

  • โœ… Automatic Integration: Works seamlessly with supported frameworks and resources.


How it works

The resource features two main gameplay components that work together:

๐Ÿ“ฆ Drug Manufacturing: Players use a custom laboratory UI to process ingredients into valuable drug packages. By experimenting with different ingredient ratios, they discover formulas that yield higher-quality products. The formulas can be randomly generated at server startup or custom-defined by administrators, making each experience unique.

๐Ÿš— Drug Running: After creating drug packages, players engage in high-stakes deliveries. They locate NPC contacts who provide coordinates to transport vehicles. Once inside the vehicle, a police tracking system activates, alerting law enforcement and creating intense pursuits across the map. Only by successfully evading police until the tracker deactivates can players complete their delivery for rewards - with higher quality packages commanding better payouts.


Features

๐Ÿงช Drug Manufacturing System

  • Custom Laboratory UI: Immersive interface with sliders for precise ingredient control

  • Products Page: Visual indication of ingredient combinations and drug descriptions

  • Mixing System: Process your drug package ready for transport

  • Experimental Approach: Discover the ideal mix of ingredients for maximum purity

  • Multiple Drug Types: Four complete drug types ready to use:

    • Cocaine

    • Methamphetamine

    • Heroin

    • LSD

  • Expandable System: Easily add custom drug types through configuration

๐Ÿš— Dynamic Drug Running Missions

  • NPC Interactions: Find contacts to initiate trafficking missions

  • Strategic Navigation: Locate and secure transport vehicles

  • Police Pursuit System: Vehicle tracking activates when entering transport vehicles

  • Evasion Gameplay: Successfully evade law enforcement until trackers deactivate

  • Dynamic Rewards: Higher purity packages yield better rewards

  • Multiple Destinations: Delivery locations vary to keep gameplay fresh and unpredictable

๐Ÿ‘ฎ Enhanced Police Roleplay

  • Strategic Pursuit Gameplay: Real-time blips for officers allow coordinated pursuit efforts

  • Framework Integration: Works with existing police dispatch systems

  • Balanced Difficulty: Pursuit parameters can be fine-tuned to balance criminal success rate and police engagement

๐Ÿ’ฐ Configurable Drug Economy

  • Complete Control: Server owners can customize all drug types and ingredients

  • Formula Generation: Define ideal ingredient mixes or let the server generate them randomly

  • Progressive System: Players experiment to find optimal formulas for maximum profit

  • Quality-Based Rewards: Better products command higher prices and special rewards

  • Economic Balancing: Fine-tune pricing to perfectly balance your server's economy

๐Ÿ”’ Secure & Optimized

  • Server-side Validation: Comprehensive checks throughout manufacturing and delivery

  • Stable Implementation: Clean code architecture with proper error handling

  • Optimised Performance: Function localization, efficient event handling, and smart resource use for minimal server impact

  • Tamper-proof Logic:

    • Drug processing requires specific ingredients that can't be substituted

    • Drug quality tracking tied to server-verified production processes

    • Vehicle validation ensures mission integrity throughout the delivery process

    • Various checks during all stages to ensure players are playing fairly

    • And more..


Supported Frameworks, Resources & Languages

The following are automatically detected and integrated into the resource. No manual setup is required. If you need any custom logic, you can easily set that up in the "custom" section in the bridge, for each supported type.

  • ๐Ÿ’ป Frameworks: qb-core, es_extended, qbx_core, ox_core, custom

  • ๐ŸŽ’ Inventory: ox_inventory, custom

  • ๐Ÿšจ Dispatch: ps-dispatch, cd_dispatch, rcore_dispatch, qs_dispatch, custom

  • ๐Ÿ‘๏ธโ€๐Ÿ—จ๏ธ Target: ox_target, qb-target

  • ๐ŸŽฏ Skills: sd_skills, flight-skills, pickle_xp, cw-rep, custom

  • ๐Ÿ’ฌ Notifications: ox_lib, qb-core, custom

  • ๐Ÿ“ถ Progressbar: ox_lib, qb-progressbar

  • ๐Ÿ—ฃ๏ธ Languages: English, Spanish, French, German, Italian, Russian, Chinese, Korean, Dutch, Japanese, Portuguese (Brazil), Polish, Turkish, Arabic, Swedish, Thai, Vietnamese, Hungarian, Czech, Greek


Installation

STEP 1: Dependencies

Ensure you have all the required dependencies:

  • A supported framework: qb-core, es_extended, qbx_core, ox_core, or custom to setup your own logic

  • ox_inventory, or a custom inventory to setup your own logic

  • (Optional, but recommended) A supported dispatch system: ps-dispatch, cd_dispatch, qs_dispatch, rcore_dispatch or custom to setup your own logic


STEP 2: Drag & Drop

  • Download the resource and place it in your FiveM server's resources folder.

  • Add start mad-drugruns to your server.cfg file.


STEP 3: Items

  • Add the required items to your inventory system. ox_inventory item definitions are provided below, and item images can be found in the INSTALL folder. The resource is designed for ox_inventory but includes a bridge for implementing custom inventory support.

ox_inventory: (Click to expand)
    -- mad-drugruns
	['mad_drug_package'] = {
	    label = 'Drug Package',
	    weight = 0, -- weight established by drug quality
	    stack = false,
	    degrade = 4320, -- 3 days
	    decay = true,
	    description = 'A sealed package.',
	    client = {
	        image = 'mad_drug_package.png',
	    },
	},

	-- Cocaine ingredients
	['coca_leaves'] = {
	    label = 'Coca Leaves',
	    weight = 100,
	    stack = true,
	    degrade = 2880, -- 2 days
	    decay = true,
	    description = 'Raw coca leaves used in the production of cocaine.',
	    client = {
	        image = 'coca_leaves.png',
	    }
	},

	['sodium_carbonate'] = {
	    label = 'Sodium Carbonate',
	    weight = 150,
	    stack = true,
	    degrade = 14400, -- 10 days
	    decay = true,
	    description = 'A chemical compound used in drug production.',
	    client = {
	        image = 'sodium_carbonate.png',
	    }
	},

	['gasoline'] = {
	    label = 'Gasoline',
	    weight = 400,
	    stack = true,
	    degrade = 10080, -- 7 days
	    decay = true,
	    description = 'Flammable liquid used as a solvent in drug production.',
	    client = {
	        image = 'gasoline.png',
	    }
	},

	-- Methamphetamine ingredients
	['pseudoephedrine'] = {
	    label = 'Pseudoephedrine',
	    weight = 120,
	    stack = true,
	    degrade = 7200, -- 5 days
	    decay = true,
	    description = 'A precursor chemical used in methamphetamine production.',
	    client = {
	        image = 'pseudoephedrine.png',
	    }
	},

	['red_phosphorus'] = {
	    label = 'Red Phosphorus',
	    weight = 120,
	    stack = true,
	    degrade = 8640, -- 6 days
	    decay = true,
	    description = 'A chemical used in the synthesis of methamphetamine.',
	    client = {
	        image = 'red_phosphorus.png',
	    }
	},

	['iodine'] = {
	    label = 'Iodine',
	    weight = 100,
	    stack = true,
	    degrade = 10080, -- 7 days
	    decay = true,
	    description = 'A crystalline chemical element used in drug production.',
	    client = {
	        image = 'iodine.png',
	    }
	},

	-- Heroin ingredients
	['opium'] = {
	    label = 'Opium',
	    weight = 150,
	    stack = true,
	    degrade = 4320, -- 3 days
	    decay = true,
	    description = 'Raw opium extract used for heroin production.',
	    client = {
	        image = 'opium.png',
	    }
	},

	['acetic_anhydride'] = {
	    label = 'Acetic Anhydride',
	    weight = 200,
	    stack = true,
	    degrade = 5760, -- 4 days
	    decay = true,
	    description = 'A chemical reagent used in heroin production.',
	    client = {
	        image = 'acetic_anhydride.png',
	    }
	},

	['lime'] = {
	    label = 'Lime',
	    weight = 150,
	    stack = true,
	    degrade = 14400, -- 10 days
	    decay = true,
	    description = 'A white powder used in various drug manufacturing processes.',
	    client = {
	        image = 'lime.png',
	    }
	},

	-- LSD ingredients
	['ergotamine'] = {
	    label = 'Ergotamine',
	    weight = 100,
	    stack = true,
	    degrade = 2880, -- 2 days
	    decay = true,
	    description = 'A precursor used in LSD synthesis.',
	    client = {
	        image = 'ergotamine.png',
	    }
	},

	['chloroform'] = {
	    label = 'Chloroform',
	    weight = 250,
	    stack = true,
	    degrade = 4320, -- 3 days
	    decay = true,
	    description = 'A volatile liquid used in drug production.',
	    client = {
	        image = 'chloroform.png',
	    }
	},

	['diethylamine'] = {
	    label = 'Diethylamine',
	    weight = 200,
	    stack = true,
	    degrade = 5760, -- 4 days
	    decay = true,
	    description = 'A chemical compound essential for LSD synthesis.',
	    client = {
	        image = 'diethylamine.png',
	    }
	},

STEP 4: Configuration

Configure the resource to your liking in server/config.lua. This resource is highly configurable. A few things I suggest you begin with are:

  • Create your own custom drugs with unique ingredients. Provide an ideal mix or let the server generate it randomly for you on start

  • Set up the processing location, mission start NPC random locations, and random drop-off locations

  • Adjust the transport vehicles that can spawn, and their performance and mods settings

  • Set the cooldown time between players being able to start a new drug run, or if you like only allow one drug run to be active at once server-wide, if you don't want overwhelm your police force.

  • Set the tracker duration to your liking, which (depending on the driving & tactical skills of your police) essentially defines the duration the police chases will be

  • Customize rewards based on drug quality

  • Optionally, enable skills integration and configure skill level requirements/XP rewards for each drug type

  • And much more, dive into the config and adjust everything your heart desires to fit your server's theme.


STEP 5: Integration

Add a way for players to obtain the initial ingredients (through farming, shops, or other means).


STEP 6: Language Support

Set your language in your server.cfg, example: setr ox:locale en, where "en" is replaced with your chosen language based on the locale file you wish to use.


STEP 7: Economy Balancing

The script includes a powerful debugging tool called drugrewardtest that helps server administrators balance their economy and understand the potential financial impact of drug running on their server.

Command Usage

/drugrewardtest [quality] [drugName] [count]

  • quality: A number from 0-100 representing the drug quality (defaults to 50)

  • drugName: The type of drug to test (cocaine, meth, heroin, lsd, etc.) (defaults to cocaine)

  • count: Number of packages to sell at once (defaults to 1)

Example Usage

  • /drugrewardtest 95 cocaine 1 - Test reward for a premium quality cocaine package

  • /drugrewardtest 25 meth 3 - Test reward for three low-quality meth packages

  • /drugrewardtest 50 - Test reward for average quality cocaine package (using defaults)

Output Information

When running this command, detailed information will be displayed in your F8 console:

  1. Drug Details: Type of drug, quality percentage, and quality tier

  2. Calculation Breakdown: Shows the base reward range and exact calculation steps

  3. Modifiers Applied: Displays drug-specific price modifiers and package count multipliers

  4. Total Reward: Shows the final amount the player would receive

  5. Comparison Table: Shows reward amounts at all purity levels for easy comparison

Why This Matters for Admins

This command helps you:

  • Fine-tune your economy: Make sure drug rewards are balanced compared to other money-making activities

  • Adjust risk/reward ratios: Ensure higher-risk activities provide appropriately higher rewards

  • Test configuration changes: Quickly see how changes to config values affect payouts

  • Plan server economy: Understand the minimum and maximum possible payouts in your economy

  • Balance different drug types: Compare rewards between different drug types to ensure variety

Configuring Your Economy

To adjust rewards based on your testing, modify these config values:

  • CashRewardMin and CashRewardMax: Control the minimum/maximum possible payouts

  • DrugPriceModifiers: Adjust rewards for specific drug types

  • QualityModifiers: Tune reward scaling based on quality tiers

Example Reward Scale (Default Settings)

Drug Type
Quality Range (%)
Quality Tier
Single Package
Multiple Packages (3)

Cocaine

95-100

Premium

$95,000-$100,000

$285,000-$300,000

Cocaine

85-94

High

$85,000-$94,000

$255,000-$282,000

Cocaine

75-84

Pure

$75,000-$84,000

$225,000-$252,000

Cocaine

65-74

Refined

$65,000-$74,000

$195,000-$222,000

Cocaine

55-64

Standard

$55,000-$64,000

$165,000-$192,000

Cocaine

45-54

Basic

$45,000-$54,000

$135,000-$162,000

Cocaine

35-44

Crude

$35,000-$44,000

$105,000-$132,000

Cocaine

25-34

Cut

$25,000-$34,000

$75,000-$102,000

Cocaine

0-24

Contaminated

$1,000-$24,000

$3,000-$72,000

Note: Values shown with default config settings and assuming CashRewardMin=$1,000 and CashRewardMax=$100,000. Your actual values may vary based on your configuration and drug-specific price modifiers.

Testing different combinations with drugrewardtest will help you find the perfect balance for your server's unique economy.


Exports

The resource provides the following exports that can be used by other resources:

openDrugMenu

Opens the drug lab UI directly without proximity checks.

Basic Export

Opens the drug menu with all available drugs.

-- Open the drug manufacturing UI
exports['mad-drugruns']:openDrugMenu()

Filtered Export

Opens the drug menu with a specific drug or drugs.

-- Open the drug manufacturing UI for a specific drug
exports['mad-drugruns']:openDrugMenu('cocaine')

-- Open the drug manufacturing UI for a set of specific drugs
exports['mad-drugruns']:openDrugMenu({'cocaine', 'lsd', 'meth'})

Usage Example

-- Example: Creating a custom zone that opens the drug lab UI
exports.ox_target:addBoxZone({
    coords = vec3(711.17, -962.91, 30.40),
    size = vec3(2.0, 1.0, 0.5),
    rotation = 0,
    options = {
        {
            icon = "fa-solid fa-flask",
            label = "Access Drug Lab",
            onSelect = function()
                exports['mad-drugruns']:openDrugMenu()
            end
        },
    },
})

Note: This export bypasses the normal distance check to the mixing location, allowing the UI to be opened from anywhere. This is useful for creating custom lab locations or alternative triggers beyond the default mixing station.


Skills Integration

The resource includes automatic integration with popular skill systems.

-- In server/config.lua
EnableSkills = true,  -- Enable/disable skills integration

How It Works

When skills are enabled, each drug can define its own skill and level requirement to craft a drug, XP granted per craft, and quality scaling based on the quality of the drug produced.

  • Skill Requirements: Set a minimum skill level to craft certain drugs

  • XP Rewards: Successful drug crafting awards experience points in the relevant skill

  • Progression: Players advance their skills by repeatedly crafting drugs

  • Specialization: Different drugs can use different skills (chemistry, pharmacology, biochemistry, etc.)

DrugDefinitions = {
    {
        id = 'cocaine',
        name = 'Cocaine',
        -- ...other properties
        skills = {
        	skillName = 'chemistry', -- Skill required for this drug
        	levelRequired = 3, -- Minimum skill level needed
        	XpPerCraft = 25, -- XP gained per successful craft
        	enableQualityScaling = true, -- Enable quality-based XP scaling
        	qualityMultiplier = 1.5, -- Quality scaling factor
        	minQualityPercent = 0.2, -- Minimum XP percentage for 0% quality
        }
    },
    {
        id = 'lsd',
        name = 'LSD', 
        -- ...other properties
        skills = {
        	skillName = 'pharmacology', -- Skill required for this drug
        	levelRequired = 5, -- Minimum skill level needed
        	XpPerCraft = 40, -- XP gained per successful craft
        	enableQualityScaling = true, -- Enable quality-based XP scaling
        	qualityMultiplier = 1.8, -- Quality scaling factor
        	minQualityPercent = 0.5, -- Minimum XP percentage for 0% quality
        }
    }
}

Quality-Based XP Scaling

When quality-based XP scaling is enabled for a drug, the XP reward is calculated based on the quality of the produced drug package using this formula:

finalXP = baseXP ร— (minQualityPercent + (qualityMultiplier ร— qualityPercent))

Configuration Parameters

  • enableQualityScaling: Enable/disable quality-based XP scaling for this drug

  • qualityMultiplier: Scaling factor for quality bonus (1.5 = 150% max bonus)

  • minQualityPercent: Minimum XP percentage for 0% quality (0.2 = 20% of base XP)

Example Outcomes

For Cocaine (baseXP: 25, qualityMultiplier: 1.5, minQualityPercent: 0.2):

  • 0% Quality: 5 XP (20% of base)

  • 50% Quality: 31.25 XP (125% of base)

  • 100% Quality: 42.5 XP (170% of base)

This system encourages players to master drug formulas for better skill progression while still providing XP for failed attempts.

Note The skills system is completely optional and can be disabled without affecting any other functionality.


Config File

Debug prints utilise ox_lib prints, to enable, type: set ox:printlevel "debug" in your console.

mad-drugruns config

Support

Join our Discord community for support, regular updates and to request new features.


Escrow Protection

This resource is protected by FiveM's escrow system to safeguard against unauthorised distribution. The core functionality is secured while maintaining full customisability through the extensive configuration system and bridge architecture.

Despite the security measures:

  • All configuration options remain fully editable in server/config.lua.

  • The comprehensive bridge system allows integration with custom frameworks and resources.

  • Server owners retain complete control over all gameplay settings.

  • No functionality is limited by the protection system.

This approach ensures you receive a premium, leak-protected resource while maintaining the freedom to customise it for your server's unique needs.

Last updated