diff --git a/client/TravellingMerchant.lua b/client/TravellingMerchant.lua index 964954b..a4822e1 100644 --- a/client/TravellingMerchant.lua +++ b/client/TravellingMerchant.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['TravellingMerchant'] then return end local function spawn() local data = Bridge.Callback.Trigger('md-drugs:server:GetMerchant') local model = 's_m_m_trucker_01' diff --git a/client/consumables.lua b/client/consumables.lua index 21f2e57..bef914b 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['consumables'] then return end Bridge.Callback.Register('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) Bridge.Anim.RequestDict(anim.dict) diff --git a/client/deliveries.lua b/client/deliveries.lua index 6eea0a3..f1d10c8 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['deliveries'] then return end local dealer = {} local buyer = nil diff --git a/client/functions.lua b/client/functions.lua index 8f1d013..4d0beee 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -304,9 +304,43 @@ else end end +if Config.Emotes == 'scully' then + function playEmote(emote) + exports.scully_emotemenu:playEmoteByCommand(emote, 0) + end + function stopEmote() + exports.scully_emotemenu:cancelEmote() + end +end + +if Config.Emotes == 'dpemotes' then + function playEmote(emote) + TriggerEvent('animations:client:EmoteCommandStart', {emote}) + end + function stopEmote() + TriggerEvent('animations:client:EmoteCommandStart', {"c"}) + end +end + +if Config.Emotes == 'rpemotes' then + function playEmote(emote) + exports["rpemotes"]:EmoteCommandStart(emote, 0) + end + function stopEmote() + exports["rpemotes"]:EmoteCancel() + end +end + +local animation = nil + function progressbar(text, time, emote, cancel) - if emote and emote.prop then - if not emote.prop.model then + local animData + if type(emote) == 'string' then + playEmote(emote) + animation = emote + elseif type(emote) == 'table' then + animData = emote + if emote.prop and not emote.prop.model then emote.prop = nil end end @@ -315,9 +349,13 @@ function progressbar(text, time, emote, cancel) label = text or 'LAZY AF DEVS', canCancel = true, disable = cancel or Config.ProgressBar.Disables, - anim = emote or Config.DefaultAnimation, - prop = emote and emote.prop or nil + anim = animData, + prop = animData and animData.prop or nil }) + if animation then + animation = nil + stopEmote() + end return success end diff --git a/client/heroin.lua b/client/heroin.lua index 26bc076..5e8648f 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['heroin'] then return end local herointable = false local dirty = false diff --git a/client/lean.lua b/client/lean.lua index 7e9165f..b31063d 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['lean'] then return end local started = false local leanCar = nil diff --git a/client/lsd.lua b/client/lsd.lua index 7c1098b..6642c53 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['lsd'] then return end local tableout = false local dirtylsd = false local locations = Config.LSD.Locations diff --git a/client/mescaline.lua b/client/mescaline.lua index 83e54b7..ccee0b4 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['mescaline'] then return end local badTrip = 100 local locations = Config.Mescaline.Locations local function AlienEffect() diff --git a/client/meth.lua b/client/meth.lua index 33cf82b..e9238e9 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['meth'] then return end local amonia, tray, heated, active, trays, startedmeth, methVan = false, false, false, false, nil, false, nil local locations = Config.Meth.Locations --- meth heist diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 4c42ee9..c4006dc 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['oxyruns'] then return end local carryPackage = nil local onMission = false local locations = Config.Oxy.Locations diff --git a/client/pharma.lua b/client/pharma.lua index bedf385..f939217 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,3 +1,5 @@ + +if not Config.Drugs['pharma'] then return end local locations = Config.Pharma.Locations Bridge.Callback.Register("md-drugs:client:prescriptionpad", function( data, op) diff --git a/client/shrooms.lua b/client/shrooms.lua index 760003f..29033ae 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,3 +1,5 @@ +if not Config.Drugs['shrooms'] then return end + local function EcstasyEffect() local startStamina = 50 SetFlash(0, 0, 500, 20000, 500) diff --git a/client/weed.lua b/client/weed.lua index 562665f..909b630 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['weed'] then return end local exploded, drying = false, false local locations, recipes = Config.Weed.Locations, Config.Weed.Recipes for k, v in pairs (locations.WeedDry) do diff --git a/client/whippit.lua b/client/whippit.lua index ce7256e..c29e5d5 100644 --- a/client/whippit.lua +++ b/client/whippit.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['whippit'] then return end local prop = nil local function animation(color) diff --git a/client/wholesale.lua b/client/wholesale.lua index f83b342..b36913a 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,4 +1,4 @@ -local active = false +if not Config.Drugs['wholesale'] then return end local active, ped, peds = false, nil, {} local function loop(wholesaleData) diff --git a/client/xtc.lua b/client/xtc.lua index b5baab7..9fbe3e2 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['xtc'] then return end local xtcpress = false local locations = Config.XTC.Locations diff --git a/clientRun.lua b/clientRun.lua deleted file mode 100644 index 32bb2be..0000000 --- a/clientRun.lua +++ /dev/null @@ -1,27 +0,0 @@ -function loadFile(filePath) - local resourceName = 'md-drugs' - local fullScript = LoadResourceFile(resourceName, filePath) - if not fullScript then - Bridge.Prints.Error("Error: Failed to load module '" .. filePath .. "' from resource '" .. resourceName .. "'.") - return false - end - local chunk, err = load(fullScript, filePath, "t") - if not chunk then - Bridge.Prints.Error("Error loading Lua chunk from '" .. filePath .. "': " .. tostring(err)) - return false - end - - local success, execErr = pcall(chunk) - if not success then - Bridge.Prints.Error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) - return false - end - - return true -end - -for scriptName, toggle in pairs(Config.Drugs) do - if not toggle then goto continue end - loadFile('client/' .. scriptName .. '.lua') - ::continue:: -end diff --git a/fxmanifest.lua b/fxmanifest.lua index e1bef97..b8552dc 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -6,16 +6,13 @@ game "gta5" version '4.0.8' client_scripts { 'client/functions.lua', - 'client/plantSpawns.lua', - 'clientRun.lua', + 'client/**.lua', } server_scripts { '@oxmysql/lib/MySQL.lua', 'server/functions.lua', - 'server/plantSpawns.lua', - 'serverRun.lua', - + 'server/**.lua', } shared_scripts { diff --git a/readme.md b/readme.md index 172272d..9793330 100644 --- a/readme.md +++ b/readme.md @@ -1,85 +1,113 @@ # 🌿 MD-Drugs – Advanced Drug System for FiveM -A fully customizable, immersive drug system for FiveM servers. +> ✨ A fully customizable, immersive, and performance-optimized drug system built for serious FiveM roleplay servers.
- - Mustache Scripts Logo - -
- Join Mustache Scripts Discord + + + + +**[Join Mustache Scripts Discord](https://discord.gg/sAMzrB4DDx)** +
+ +--- +## 📦 Dependencies + +> ⚠️ **Important:** Ensure all dependencies are installed, started **before** `md-drugs`, and kept up to date. + +| Dependency | Requirement | Link | +|-----------|-------------|------| +| `Community_bridge` | Required | [GitHub](https://github.com/TheOrderFivem/community_bridge) | +| `Read` | Required | [Documentation](https://letters.hookedonphonics.com/us/read-guaranteed-G14.html) | +| **Game Build** | **2944 or later** | - | + +--- +## 🙏 Credits + +A huge thank you to everyone who made this possible: + +| Contributor | Contribution | Link | +|------------|--------------|------| +| **Samuel's Development** | Christmas script global states & prop spawning | [Visit](https://fivem.samueldev.shop/) | +| **STACHY225** | Meth network animations | [Visit](https://babiczind.tebex.io/category/2103836) | +| **Bostra** | Free scripts, sanity checks & mushrooms | [Discord](https://discord.gg/5ncbwMNq) | +| **Feisty** | Stunning visuals & effects | - | +| **Athena** | Balloon props | [Discord](https://discord.gg/mam8Nmg49d) | +| **Kamaryn** | Installation guide video | [Watch](https://youtu.be/zvuYnUfrqaA?si=FGJuBO5krZMC14Nd) | +| **1of1 Servers** | Hosting & support | [Website](https://1of1servers.com/) \| [Discord](https://discord.gg/1of1servers) | +| **Beta Testers** | Invaluable feedback & testing | - | + +--- + +## 🎬 Preview + +
+ +[![Watch Full Preview](https://img.youtube.com/vi/I_x7_oz_SAU/maxresdefault.jpg)](https://www.youtube.com/watch?v=I_x7_oz_SAU) + +**[📺 Watch Full Preview Video](https://www.youtube.com/watch?v=I_x7_oz_SAU)** +
--- -- **[Samuel's Development](https://fivem.samueldev.shop/ ):** Used their Christmas script global states and prop spawning (with permission). -- **[STACHY225](https://babiczind.tebex.io/category/2103836 ):** Meth network animations. -- **[Bostra](https://discord.gg/5ncbwMNq ):** Free scripts, sanity checks, and those cute mushrooms! -- **[Feisty]():** Stunning visuals that make everything look amazing. -- **Beta Testers:** Your invaluable feedback made this possible. -- **[1of1 Servers](https://1of1servers.com/ ):** Top-notch hosting and support. Join their [Discord](https://discord.gg/1of1servers ). -- **[Kamaryn](https://discord.gg/KPRmZqFS ):** For the [installation guide video](https://youtu.be/zvuYnUfrqaA?si=FGJuBO5krZMC14Nd). -- **[Athena](https://discord.gg/mam8Nmg49d):** For the Balloon props :) -## 🎬 Preview - -🎥 **[Watch Full Preview Video](https://www.youtube.com/watch?v=I_x7_oz_SAU)** - - ---- - -## 📦 Dependencies - -| Dependency | Link | -|----------|------| -| `Community_bridge` | [GitHub - Community Bridge Repo](https://github.com/TheOrderFivem/community_bridge) | -| `Read` | [Read Docs](https://letters.hookedonphonics.com/us/read-guaranteed-G14.html) | -| Game Build | **2944 or later** required | - -> ⚠️ Ensure all dependencies are installed, started before md-drugs and up to date. ## 🛠️ Installation ### Step 1: Inventory Integration -#### For QBCore (`qb-inventory`) -1. Copy items from `md-drugs/items_install/qb-inventory` into `qb-core/shared/items.lua`. -2. Add item images from `md-drugs/items_install/images` to `qb-inventory/html/images`. +#### 📦 For QBCore (`qb-inventory`) -#### For OX_Inventory -1. Copy items from `md-drugs/items_install/ox_inventory` into `ox_inventory/data/items.lua`. -2. Add item images to `ox_inventory/web/images`. +1. **Copy Items:** + - Copy items from `md-drugs/items_install/qb-inventory` into `qb-core/shared/items.lua` +2. **Add Images:** + - Add item images from `md-drugs/items_install/images` to `qb-inventory/html/images` + +#### 📦 For OX_Inventory + +1. **Copy Items:** + - Copy items from `md-drugs/items_install/ox_inventory` into `ox_inventory/data/items.lua` + +2. **Add Images:** + - Add item images to `ox_inventory/web/images` + +--- ### Step 2: Configure Drug Locations & Recipes -- All **processing locations and recipes** are located in their respective drug type files: - - `cocaine.lua`, - - `meth.lua`, - - `weed.lua`, - - etc. -- **Plant spawns** are managed in `server/plantSpawns.lua`. +All drug data is now organized in: `shared/DrugData/{drugname}.lua` -> ✏️ Modify these files to customize spawn points, yields, and processing times. +> ✏️ **Tip:** Modify these files to customize: +> - Spawn points +> - Yields +> - Processing times +> - And more! -### STEP 3 (IF QBCore) -- check `qb-smallresources/config.lua` and if this exists, delete it - - look for this code - ```lua - [2] = { --Coke Processing Enter/Exit - [1] = { - poly = { coords = vector3(909.49, -1589.22, 30.51), heading = 92.24, length = 2, width = 2 }, - allowVeh = false, - label = '[E] Enter Coke Processing' - }, - [2] = { - poly = { coords = vector3(1088.81, -3187.57, -38.99), heading = 181.7, length = 2, width = 2 }, - allowVeh = false, - label = '[E] Leave' - } - } - ``` - +*Note: Some data is also located in the server files.* + +--- + +### Step 3: QBCore Users Only! ⚠️ + +If you're using QBCore, check `qb-smallresources/config.lua`: + +1. Look for this code block: +```lua +[2] = { --Coke Processing Enter/Exit + [1] = { + poly = { coords = vector3(909.49, -1589.22, 30.51), heading = 92.24, length = 2, width = 2 }, + allowVeh = false, + label = '[E] Enter Coke Processing' + }, + [2] = { + poly = { coords = vector3(1088.81, -3187.57, -38.99), heading = 181.7, length = 2, width = 2 }, + allowVeh = false, + label = '[E] Leave' + } +} +``` ### STEP 4 - Run SQL - if you dont know how, click this image below diff --git a/server/TravellingMerchant.lua b/server/TravellingMerchant.lua index 012202c..a634817 100644 --- a/server/TravellingMerchant.lua +++ b/server/TravellingMerchant.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['TravellingMerchant'] then return end local loc = Config.Merchant.Locations.Travellingmerchant[math.random(1, #Config.Merchant.Locations.Travellingmerchant)] Bridge.Callback.Register('md-drugs:server:GetMerchant', function(source) diff --git a/server/cocaine.lua b/server/cocaine.lua index 1eecdd6..07595f0 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['cocaine'] then return end local Locations = Config.Cocaine.Locations local Recipes = Config.Cocaine.Recipes diff --git a/server/consumables.lua b/server/consumables.lua index 602dc9e..e229045 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['consumables'] then return end for k, v in pairs(Config.Consumables.Consume) do Bridge.Framework.RegisterUsableItem(k, function(source, item) if not Bridge.Inventory.HasItem(source, k, 1) then return end diff --git a/server/crack.lua b/server/crack.lua index 47a5e37..8b95ffd 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['crack'] then return end RegisterServerEvent('md-drugs:server:makecrackone', function(num) local src = source diff --git a/server/deliveries.lua b/server/deliveries.lua index 289dbb7..a487a79 100644 --- a/server/deliveries.lua +++ b/server/deliveries.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['deliveries'] then return end local drugDeliveryItem = { {item = 'coke_brick', amount = 1}, @@ -12,11 +12,18 @@ CreateThread(function() for i = 1, #dealers do local coords = json.decode(dealers[i].coords) Dealers[#Dealers + 1] = { - coords = vector4(coords.x, coords.y, coords.z, coords.w), + coords = vector4(coords.x, coords.y, coords.z, coords.w or 180.0), model = dealers[i].model or 'a_m_m_skater_01', } end GlobalState.MDDrugDealers = Dealers + else + MySQL.insert('INSERT INTO dealers (model, coords, createdby) VALUES (?, ?, ?)', {'a_m_m_skater_01', json.encode(vector4(1915.68, 154.22, 155.41, 6.88)), 'default'}) + Dealers[#Dealers + 1] = { + coords = vector4(1915.68, 154.22, 155.41, 6.88), + model = 'a_m_m_skater_01', + } + GlobalState.MDDrugDealers = Dealers end end) diff --git a/server/heroin.lua b/server/heroin.lua index 42f910b..2e03089 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['heroin'] then return end local heroinLabKits = {} diff --git a/server/lean.lua b/server/lean.lua index 29f4a4f..e5f6e1b 100644 --- a/server/lean.lua +++ b/server/lean.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['lean'] then return end local onRun = {} local function setTimeout(identifier) diff --git a/server/lsd.lua b/server/lsd.lua index 8f0392a..8d8dce9 100644 --- a/server/lsd.lua +++ b/server/lsd.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['lsd'] then return end local lsdTables = {} RegisterServerEvent('md-drugs:server:getlysergic', function(num) diff --git a/server/mescaline.lua b/server/mescaline.lua index bfaf7c4..a3fa9fc 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['mescaline'] then return end RegisterNetEvent("md-drugs:server:drymescaline", function(num) local src = source diff --git a/server/meth.lua b/server/meth.lua index 25001b1..3510ec4 100644 --- a/server/meth.lua +++ b/server/meth.lua @@ -1,3 +1,4 @@ +if not Config.Drugs['meth'] then return end local onRun = {} local vehicles = {} diff --git a/server/oxyruns.lua b/server/oxyruns.lua index cee6492..7732382 100644 --- a/server/oxyruns.lua +++ b/server/oxyruns.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['oxyruns'] then return end local onRoute = {} local vehicles = {} diff --git a/server/pharma.lua b/server/pharma.lua index 928915c..8289918 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['deliveries'] then return end local function GetJob(source) local src = source diff --git a/server/shrooms.lua b/server/shrooms.lua index a03f895..369ab05 100644 --- a/server/shrooms.lua +++ b/server/shrooms.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['shrooms'] then return end Bridge.Framework.RegisterUsableItem('shrooms', function(source, item) local src = source if not Bridge.Callback.Trigger("md-drugs:client:shrooms", src) then diff --git a/server/weed.lua b/server/weed.lua index 5d9c5d6..1da4009 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['weed'] then return end RegisterNetEvent('md-drugs:server:buyWeedItem', function(loc, name, amount) local src = source if not checkDistance(src, Config.Weed.Locations.WeedSalesman[loc].loc, 3.5, 'md-drugs:server:buyWeedItem') then diff --git a/server/whippit.lua b/server/whippit.lua index 507203f..71fd873 100644 --- a/server/whippit.lua +++ b/server/whippit.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['whippit'] then return end RegisterServerEvent('md-drugs:server:buyWhippitItem', function(loc, item,amount) local src = source diff --git a/server/wholesale.lua b/server/wholesale.lua index 111fec4..1e8f982 100644 --- a/server/wholesale.lua +++ b/server/wholesale.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['wholesale'] then return end local burners = { cokeburner = { "cokebaggy", "cokebaggystagethree", "cokebaggystagetwo"}, crackburner = {"baggedcracked", "baggedcrackedstagetwo", "baggedcrackedstagethree"}, diff --git a/server/xtc.lua b/server/xtc.lua index 0e096a2..4097a41 100644 --- a/server/xtc.lua +++ b/server/xtc.lua @@ -1,4 +1,4 @@ - +if not Config.Drugs['xtc'] then return end local activePresses = {} RegisterServerEvent('md-drugs:server:stealisosafrole', function(num) diff --git a/serverRun.lua b/serverRun.lua deleted file mode 100644 index d6ee86d..0000000 --- a/serverRun.lua +++ /dev/null @@ -1,26 +0,0 @@ -function loadFile(filePath) - local resourceName = 'md-drugs' - local fullScript = LoadResourceFile(resourceName, filePath) - if not fullScript then - Bridge.Prints.Error("Error: Failed to load module '" .. filePath .. "' from resource '" .. resourceName .. "'.") - return false - end - local chunk, err = load(fullScript, filePath, "t") - if not chunk then - Bridge.Prints.Error("Error loading Lua chunk from '" .. filePath .. "': " .. tostring(err)) - return false - end - - local success, execErr = pcall(chunk) - if not success then - Bridge.Prints.Error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) - return false - end - return true -end - -for scriptName, toggle in pairs(Config.Drugs) do - if not toggle then goto continue end - loadFile('server/' .. scriptName .. '.lua') - ::continue:: -end \ No newline at end of file diff --git a/shared/DrugData/consumables.lua b/shared/DrugData/consumables.lua index 1b69018..d46adec 100644 --- a/shared/DrugData/consumables.lua +++ b/shared/DrugData/consumables.lua @@ -32,7 +32,7 @@ local emotes = { drink = { dict = "mp_player_intdrink", clip = "loop_bottle", - } + }, } Config.Consumables = { diff --git a/shared/config.lua b/shared/config.lua index 52b3124..640fbf8 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -26,8 +26,8 @@ Config.Minigames = { glspot = {gridSize = 6, timeLimit = 999999, charSet = "alphabet", required = 10}, glmath = {timeLimit = 300000}, } -Config.minigametype = 'ps_circle' -- look above for options or choose none if you dont want any minigames - +Config.minigametype = 'ox' -- look above for options or choose none if you dont want any minigames +Config.Emotes = 'rpemotes' -- this is if you want to use emotes, you can pass the string of the emote name instead of the animDict and animClip like below Config.DefaultAnimation = { dict = "mp_arresting", clip = "a_uncuff",