From 70c3d9ae1524ee109562ebef27b9cfc003a96d8b Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:11:49 -0700 Subject: [PATCH] updated a lot --- client/animationsandfunctions.lua | 2 +- client/cocaine.lua | 2 +- client/cornerselling.lua | 2 +- client/functions.lua | 31 ++-- client/meth.lua | 13 +- client/shrooms.lua | 9 +- client/weed.lua | 10 +- client/wholesale.lua | 8 +- readme.md | 244 ++++++++++++++------------- server/cornerselling.lua | 5 +- server/functions.lua | 44 ++++- shared/config.lua | 34 ++-- shared/qbdrugsrewrite.lua | 271 +++++++++++++++--------------- 13 files changed, 358 insertions(+), 317 deletions(-) diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 1c677d7..acbda8b 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -510,7 +510,6 @@ function SetUpPeds() } for i = 1, #peds do local k = peds[i] - print(GetPedRelationshipGroupHash(i) ) i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true) SetPedRelationshipGroupHash(i, 'setups') GiveWeaponToPed(i, "weapon_pistol", 1, false, true) @@ -530,6 +529,7 @@ RegisterCommand('DrugRep', function() {icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin}, {icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd}, {icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep}, + {icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label } } }) lib.showContext('DrugRep') diff --git a/client/cocaine.lua b/client/cocaine.lua index a45c9f4..fd1d9b7 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -27,7 +27,7 @@ end) RegisterNetEvent("coke:init", function() for k, v in pairs (GlobalState.CocaPlant) do local hash = GetHashKey(v.model) - if not HasModelLoaded(hash) then LoadModel(hash) end + LoadModel(hash) if not v.taken then CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(CocaPlant[k], true, v.heading) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index f984d2c..1d6e8f2 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -44,7 +44,7 @@ function Cornersell() local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { - { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", + { label = string.format(Lang.targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", action = function() sellDrug(item, amount, price, targ) end, canInteract = function() if not targbusy then return true end end, diff --git a/client/functions.lua b/client/functions.lua index 49621ac..a7c6da1 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -64,7 +64,10 @@ function loadParticle(dict) end function LoadModel(hash) - lib.requestModel(hash, Config.RequestModelTime) + RequestModel(hash) + while not HasModelLoaded(hash) do + Wait(0) + end end function minigame() @@ -217,7 +220,7 @@ end function sorter(sorting, value) - table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end) + table.sort(sorting, function(a, b) return a[value] < b[value] end) end function makeMenu(name, rep) @@ -322,15 +325,7 @@ function PoliceCall(chance) flash = 0, unique_id = data.unique_id, sound = 1, - blip = { - sprite = 431, - scale = 1.2, - colour = 3, - flashes = false, - text = '420-69 Drug Sale', - time = 5, - radius = 0, - } + blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = '420-69 Drug Sale', time = 5, radius = 0,} }) elseif dispatch == 'core' then exports['core_dispatch']:addCall("420-69", "Drugs Are Being Sold", { @@ -441,7 +436,6 @@ function AddBoxZoneMulti(name, table, data) end function AddBoxZoneMultiOptions(name, loc, data) - if Config.Target == 'qb' then exports['qb-target']:AddBoxZone(name , loc, 1.5, 1.75, {name = name, minZ = loc.z-1.50,maxZ = loc.z +1.5}, { options = data, distance = 2.5}) @@ -462,18 +456,17 @@ function AddSingleModel(model, data, num) end function AddMultiModel(model, data, num) - local data = {} + local options = {} for k, v in pairs (data) do - table.insert(data,{ - { icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, - onSelect = v.action,data = num,canInteract = v.canInteract or nil, distance = 2.0 - } + table.insert(options,{ + icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, + onSelect = v.action,data = num,canInteract = v.canInteract or nil, distance = 2.0 }) end if Config.Target == 'qb' then - exports['qb-target']:AddTargetEntity(model, {options = data, distance = 2.5}) + exports['qb-target']:AddTargetEntity(model, {options = options, distance = 2.5}) elseif Config.Target == 'ox' then - exports.ox_target:addLocalEntity(model, data) + exports.ox_target:addLocalEntity(model, options) end end diff --git a/client/meth.lua b/client/meth.lua index 8e382f6..0e1a274 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -3,7 +3,6 @@ local amonia = nil local tray = nil local heated = nil local active = nil - local function startcook() if not ItemCheck('empty_weed_bag') then return end if not ItemCheck('acetone') then return end @@ -42,14 +41,14 @@ if tray then SmashMeth() Wait(100) AddSingleModel(bucket, - {name = 'bucket',icon = 'fa-solid fa-car',label = Lang.targets.meth.bag, + {name = 'bucket',icon = 'fa-solid fa-car',label = Lang.targets.meth.bag, canInteract = function() if active == nil then return false end end, action = function() + active = nil DeleteObject(bucket) - amonia = nil - heated = nil - tray = nil - active = nil - BagMeth() + amonia = nil + heated = nil + tray = nil + BagMeth() TriggerServerEvent('md-drugs:server:getmeth') end,}, bucket) end diff --git a/client/shrooms.lua b/client/shrooms.lua index 5aff339..49054ca 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -6,6 +6,13 @@ local function pick(loc) TriggerServerEvent("shrooms:pickupCane", loc) end +function LoadModel(hash) + RequestModel(hash) + while not HasModelLoaded(hash) do + Wait(0) + end +end + RegisterNetEvent('shrooms:respawnCane', function(loc) local v = GlobalState.shrooms[loc] local hash = GetHashKey(v.model) @@ -35,7 +42,7 @@ end) RegisterNetEvent("shrooms:init", function() for k, v in pairs (GlobalState.shrooms) do local hash = GetHashKey(v.model) - if not HasModelLoaded(hash) then LoadModel(hash) end + lib.requestModel(v.model, Config.RequestModelTime) if not v.taken then shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(shrooms[k], true, v.heading) diff --git a/client/weed.lua b/client/weed.lua index 25f63d9..84de243 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -1,13 +1,11 @@ local QBCore = exports['qb-core']:GetCoreObject() local WeedPlant = {} -local exploded = nil -local drying = false - +local exploded, drying = false, false local function hasJob() if Config.Joblock then if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then - return true else return false end + return true else return false end else return true end end @@ -116,14 +114,14 @@ AddBoxZoneSingle('makeoil',Config.MakeOil, { exploded = true Notify(Lang.Weed.stovehot, "error") Wait(1000 * 30) - exploded = nil + exploded = false end return end if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makeoil") end, canInteract = function() - if hasJob() and exploded == nil then return true end + if hasJob() and exploded == false then return true end end, } ) end) diff --git a/client/wholesale.lua b/client/wholesale.lua index f4f42eb..5a6bc2c 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -24,15 +24,13 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) icon = "fas fa-eye", action = function() local luck = math.random(1,100) - if luck >=101 then + if luck >= Config.SuccessfulChance then TriggerEvent("md-drugs:client:SuccessSale", drug) - Wait(4000) - DeleteEntity(drugdealer) else TriggerEvent("md-drugs:client:SetUp") - Wait(3000) - DeleteEntity(drugdealer) end + Wait(3000) + DeleteEntity(drugdealer) miss = false end, },nil ) diff --git a/readme.md b/readme.md index 40b1b2f..4f82244 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -

md-drugs

+# MD-Drugs
@@ -7,7 +7,7 @@ Mustache Scripts Discord
-

Credits

+# Credits - I used [Samuel's development](https://fivem.samueldev.shop/) Christmas script global states and prop spawning (with permission obtained prior to release) in the development process. @@ -26,131 +26,148 @@ - [jixeltay](https://jixeltay.tebex.io/category/scripts) for putting out banger after banger. These people help the community learn so much more - Our partner [1of1 Servers]( https://1of1servers.com/) and their [discord](https://discord.gg/1of1servers) for their amazing server hosting! absolutely top notch. - -

Special Thanks To Kamaryn For The Preview

+- Special Thanks To Kamaryn For The Preview - Thanks to Kamaryn for this [install guide video](https://youtu.be/zvuYnUfrqaA?si=FGJuBO5krZMC14Nd) - join their [discord](https://discord.gg/KPRmZqFS) for other videos updates. -

Dependencies

-- [Ox Lib](https://github.com/overextended/ox_lib/releases/tag/v3.12.0) +# Dependencies -- [qb-target](https://github.com/qbcore-framework/qb-target) **or** ox_target +- [ox_lib](https://github.com/overextended/ox_lib/releases/tag/v3.12.0) + +- [qb-target](https://github.com/qbcore-framework/qb-target) **or** [ox_target](https://github.com/overextended/ox_target) -- emote script that uses the animations event (rpemotes, dpemotes, scully emotes all work) +- emote script that uses the animations event + - for example one of these + - [dpemotes](https://github.com/andristum/dpemotes) -- should use RP instead + - [rpemotes](https://github.com/alberttheprince/rpemotes-reborn) + - [scully_emotemenu](https://github.com/Scullyy/scully_emotemenu) + +- [read](https://letters.hookedonphonics.com/us/read-guaranteed-G14.html?vc=HPG1&pc=SHPGBR&tracking_id=102917836048989658da259e8c83e6&url_id=5586&oid=707&vid=1855&cid=4194&hid=14509&utm_source=1855&aff_id2={aff_id2}&utm_campaign=PracticePackHOS&utm_medium=S&utm_content=BrandDollarPacks&gc_id=184380999&h_ad_id=374941048206&src=O&qid=3&msvid=v2) - GAME BUILD 2944 OR LATER +# Preview -

Preview

+### [Preview link](https://www.youtube.com/watch?v=I_x7_oz_SAU) -- [Preview link](https://www.youtube.com/watch?v=I_x7_oz_SAU) -- **Preview** +# How to install like a fuckin boss -![](https://cdn.discordapp.com/attachments/1164709522691076120/1185729686135910582/image.png?ex=6590abd2&is=657e36d2&hm=35c3b2d4f55473d65dd9197a69052b7ec7ac7b28528811f3f59d5f306b7237eb&) +### STEP 1 -

How to install like a fuckin boss

+- qb-inventory users go to md-drugs/items_install/qb-inventory and add the Items to `qb-core/shared/items.lua` and - Add items from md-drugs/items_install/images to qb-inventory/html/images +- ox_inventory users go to md-drugs/items_install/ox_inventory and add the Items to `ox_inventory/data/items.lua` and - Add items from md-drugs/items_install/images to ox_inventory/web/images -- **STEP 1** - - qb-inventory users go to md-drugs/items_install/qb-inventory and add the Items to `qb-core/shared/items.lua` and - Add items from md-drugs/items_install/images to qb-inventory/html/images - - ox_inventory users go to md-drugs/items_install/ox_inventory and add the Items to `ox_inventory/data/items.lua` and - Add items from md-drugs/items_install/images to ox_inventory/web/images +### STEP 2 +- delete `qb-drugs` -- **STEP 2** +### STEP 3 +- Inside the config file change **all** the locations for everything. + - **ps: All locations have been changed to make a preview video easier and with how big of a script this is, Im not going to config it for every city. THESE LOCATION DO NOT DO WELL FOR A LIVE SERVER SO CHANGE THEM** - - delete `qb-drugs` - -- **STEP 3** - - - Inside the config file change **all** the locations for everything. - - **ps: All locations have been changed to make a preview video easier and with how big of a script this is, Im not going to config it for every city. THESE LOCATION DO NOT DO WELL FOR A LIVE SERVER SO CHANGE THEM** - - -- **STEP 4** +### STEP 4 - Head to your emote script search for **uncuff** if it's missing add it - - if rp or dpemotes then do this - -```lua - ["uncuff"] = {"mp_arresting","a_uncuff","Uncuff", AnimationOptions = { EmoteLoop = true, EmoteMoving = true } }, - ["edible"] = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "edible", AnimationOptions = { EmoteLoop = false, EmoteMoving = true }}, - ["shootup"] = { "rcmpaparazzo1ig_4", "miranda_shooting_up", "Shoot Up", AnimationOptions = {EmoteLoop = true,EmoteMoving = true,Prop = 'prop_syringe_01', PansexualPropBone = 18905,PropPlacement = {0.11, 0.03, 0.0, -124.0, 0.0, 0.0},}}, -``` - -- if scully emotes do this in emotes.lua -``` - { - Label = 'Uncuff', - Command = 'uncuff', - Animation = 'a_uncuff', - Dictionary = 'mp_arresting', - Options = { - Flags = { - Loop = true, - Move = true, - }, - } - }, - { - Label = 'Edibles', - Command = 'edible', - Animation = 'mp_player_int_eat_burger', - Dictionary = 'mp_player_inteat@burger', - Options = { - Flags = { - Loop = true, - Move = true, - }, - } - }, -``` -then in prop emotes do -``` -{ - Label = 'Shoot Up', - Command = 'shootup', - Animation = "miranda_shooting_up", - Dictionary = "rcmpaparazzo1ig_4", - Options = { - Flags = { - Loop = true, - }, - Props = { - { - Bone = 18905, - Name = 'prop_syringe_01', - Placement = { - vector3(0.11, 0.03, 0.0), - vector3( -124.0, 0.0, 0.0), + - if rpemotes do this + - go to client/animationListCustom.lua + - add these to the CustomDP.Emotes = {} + ```lua + ["uncuff"] = {"mp_arresting","a_uncuff","Uncuff", AnimationOptions = { EmoteLoop = true, EmoteMoving = true } }, + ["edible"] = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "edible", AnimationOptions = { EmoteLoop = false, EmoteMoving = true }}, + ``` + - Add This to CustomDP.PropEmotes = {} + ```lua + ["shootup"] = { "rcmpaparazzo1ig_4", "miranda_shooting_up", "Shoot Up", AnimationOptions = {EmoteLoop = true,EmoteMoving = true,Prop = 'prop_syringe_01', PansexualPropBone = 18905,PropPlacement = {0.11, 0.03, 0.0, -124.0, 0.0, 0.0},}} + ``` + - elseif dpemotes add this to client/AnimationList.lua + - add these to DP.Emotes = {} + ```lua + ["uncuff"] = {"mp_arresting","a_uncuff","Uncuff", AnimationOptions = { EmoteLoop = true, EmoteMoving = true } }, + ["edible"] = { "mp_player_inteat@burger", "mp_player_int_eat_burger", "edible", AnimationOptions = { EmoteLoop = false, EmoteMoving = true }}, + ``` + - add these to DP.PropEmotes = {} + ```lua + ["shootup"] = { "rcmpaparazzo1ig_4", "miranda_shooting_up", "Shoot Up", AnimationOptions = {EmoteLoop = true,EmoteMoving = true,Prop = 'prop_syringe_01', PansexualPropBone = 18905,PropPlacement = {0.11, 0.03, 0.0, -124.0, 0.0, 0.0},}} + ``` + - elseif scullyemotes then + - add this to emotes.lua + ```lua + { + Label = 'Uncuff', + Command = 'uncuff', + Animation = 'a_uncuff', + Dictionary = 'mp_arresting', + Options = { + Flags = { + Loop = true, + Move = true, + }, + } + }, + { + Label = 'Edibles', + Command = 'edible', + Animation = 'mp_player_int_eat_burger', + Dictionary = 'mp_player_inteat@burger', + Options = { + Flags = { + Loop = true, + Move = true, + }, + } + }, + ``` + - then in prop emotes do + ```lua + { + Label = 'Shoot Up', + Command = 'shootup', + Animation = "miranda_shooting_up", + Dictionary = "rcmpaparazzo1ig_4", + Options = { + Flags = { + Loop = true, + }, + Props = { + { + Bone = 18905, + Name = 'prop_syringe_01', + Placement = { + vector3(0.11, 0.03, 0.0), + vector3( -124.0, 0.0, 0.0), + }, + }, + }, }, }, - }, - }, - }, -``` + ``` -- **STEP 5** - - check `qb-smallresources/config.lua` and if this exists, delete it -``` -[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 6** -Run SQL - --- **OPTIONAL STEPS** -

Fivemerr

+# STEP 5 +- 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' + } + } + ``` + +# STEP 6 +- Run SQL + + +# OPTIONAL STEPS + +## Fivemerr This is NOT a requirement but something I personally use and believe in. @@ -166,23 +183,20 @@ As well as a place to offload images and videos from fivem that doesnt rely on d - [Fivemerr Discord](https://discord.com/invite/fivemerr) - [Fivemerr Docs](https://docs.fivemerr.com/) --

Radial Menu

- - head to `qb-radial/config.lua` and search for the following event +# Radial Menu +- head to `qb-radial/config.lua` and search for the following event ```lua event = 'qb-drugs:client:cornerselling', ``` -![](https://cdn.discordapp.com/attachments/1164709522691076120/1185724912648867940/image.png?ex=6590a760&is=657e3260&hm=51534201d8d3e71f79a5c1678879ed8423f381a4a31c62f1bce6caf73782abe0&) - +- and change it to this ```lua event = 'md-drugs:client:cornerselling', ``` -![](https://cdn.discordapp.com/attachments/1164709522691076120/1185725132975644753/image.png?ex=6590a795&is=657e3295&hm=97d7f60ec6c4508af92f758c00669b1d52fe673c6481434b586f81cf29c1f292&) -or just use the command /cornersell -

For Qb-shops users

+# For Qb-shops users - - Head to `qb-shops/config.lua` **Config.Products** and add the folowing items to OR anywhere else you want them. The Only way in this script to get them is to find the travelling merchant +- Head to `qb-shops/config.lua` **Config.Products** and add the folowing items to OR anywhere else you want them. The Only way in this script to get them is to find the travelling merchant ```lua {name = 'bakingsoda', price = 100, amount = 5000, info = {}, type = 'item'}, @@ -190,7 +204,7 @@ or just use the command /cornersell {name = 'needle', price = 100, amount = 5000, info = {}, type = 'item'}, ``` --

Tier System

-Turn On Config.TierSystem after you run the sql file +# Tier System +- Turn On Config.TierSystem after you run the sql file [mlo i use](https://www.gta5-mods.com/maps/mlo-4x-drug-lab-interiors-sp-fivem) heres an option. use it or dont. diff --git a/server/cornerselling.lua b/server/cornerselling.lua index fbedc37..4109297 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -2,6 +2,7 @@ local QBCore = exports['qb-core']:GetCoreObject() lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, cb) local Player = QBCore.Functions.GetPlayer(source) + local rep = getRep(source, 'cornerselling') if not Player then return nil end local type = 0 for k, v in pairs(QBConfig.DrugsPrice) do @@ -12,7 +13,8 @@ lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', functio local amount = math.random(1,item.amount) if amount >= 15 then amount = 15 end local price = math.random(QBConfig.DrugsPrice[k]['min'], QBConfig.DrugsPrice[k]['max']) * amount - return item.name, amount, price + local result = math.floor(price * rep.price) + return item.name, amount, result end end if type == 0 then @@ -25,6 +27,7 @@ RegisterNetEvent('md-drugs:server:sellCornerDrugs', function(item, amount, price local src = source local Player = QBCore.Functions.GetPlayer(src) if RemoveItem(src, item, amount) then + AddRep(src, 'cornerselling', QBConfig.DrugsPrice[item].rep * amount) Log(GetName(src) .. ' Sold ' .. amount .. ' Of ' .. item .. ' For A Price Of ' .. price .. '!' , 'cornerselling') if QBConfig.MarkedBills then if price >= QBConfig.DrugsPrice[item]['min'] * amount and price <= QBConfig.DrugsPrice[item]['max'] * amount then diff --git a/server/functions.lua b/server/functions.lua index 794fdac..23b7fe2 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -204,11 +204,18 @@ function getRep(source, type) lsd = Player.PlayerData.metadata.lsd or 0, heroin = Player.PlayerData.metadata.heroin or 0, dealerrep = Player.PlayerData.metadata.dealerrep or 0, + cornerselling = { + price = QBConfig.SellLevel[1].price, + rep = 0, + label = QBConfig.SellLevel[1].label, + level = 1 + } }) MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)}) - return 0 + Wait(1000) + return json.decode(table) else - local rep = json.decode(sql[1].drugrep) + local rep = json.decode(sql[1].drugrep) if type == 'coke' then return rep.coke elseif type == 'heroin' then @@ -217,6 +224,8 @@ function getRep(source, type) return rep.lsd elseif type == 'dealerrep' then return rep.dealerrep + elseif type == 'cornerselling' then + return rep.cornerselling else print('^1 Error: No Valid Drug Rep Option Chosen') end @@ -233,29 +242,46 @@ function GetAllRep(source) lsd = Player.PlayerData.metadata.lsd or 0, heroin = Player.PlayerData.metadata.heroin or 0, dealerrep = Player.PlayerData.metadata.dealerrep or 0, + cornerselling = { + price = QBConfig.SellLevel[1].price, + rep = 0, + label = QBConfig.SellLevel[1].label, + level = 1 + } }) MySQL.insert('INSERT INTO drugrep SET cid = ?, drugrep = ?, name = ?', {Player.PlayerData.citizenid, table, GetName(source)}) Wait(1000) - return 0 + return json.decode(table) else local rep = json.decode(sql[1].drugrep) return rep end end -function AddRep(source, type) +function AddRep(source, type, amount) + if not amount then amount = 1 end local Player = QBCore.Functions.GetPlayer(source) local sql = MySQL.query.await('SELECT * FROM drugrep WHERE cid = ?', {Player.PlayerData.citizenid}) local rep = json.decode(sql[1].drugrep) local update - if type == 'coke' then - update = json.encode({coke = rep.coke + 1, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep}) + if type == 'cornerselling' then + for k, v in pairs (QBConfig.SellLevel) do + if rep.cornerselling.level == k then + if rep.cornerselling.rep + amount >= v.maxrep then + update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k + 1}}) + else + update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = {label = v.label, price = v.price, rep = rep.cornerselling.rep + amount, level = k}}) + end + end + end + elseif type == 'coke' then + update = json.encode({coke = rep.coke + amount, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling}) elseif type == 'heroin' then - update = json.encode({coke = rep.coke, heroin = rep.heroin + 1, lsd = rep.lsd, dealerrep = rep.dealerrep}) + update = json.encode({coke = rep.coke, heroin = rep.heroin + amount, lsd = rep.lsd, dealerrep = rep.dealerrep, cornerselling = rep.cornerselling}) elseif type == 'lsd' then - update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +1 , dealerrep = rep.dealerrep}) + update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd +amount , dealerrep = rep.dealerrep, cornerselling = rep.cornerselling}) elseif type == 'dealerrep' then - update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + 1}) + update = json.encode({coke = rep.coke, heroin = rep.heroin, lsd = rep.lsd, dealerrep = rep.dealerrep + amount, cornerselling = rep.cornerselling}) end if update == '' then return false end MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid}) diff --git a/shared/config.lua b/shared/config.lua index 18c02d7..3502e00 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -18,20 +18,20 @@ Config.Phone = 'qb' -- either 'qb' or 'yflip' or 'qs' Config.Dispatch = 'ps' -- either 'ps', 'cd', 'core', 'aty' Config.Minigames = { - ps_circle = { amount = 2, speed = 8,}, - ps_maze = { timelimit = 15}, - ps_scrambler = { type = 'numeric', time = 15, mirrored = 0}, - ps_var = { numBlocks = 5, time = 10}, - ps_thermite = { time = 10, gridsize = 5, incorrect = 3}, - ox = { 'easy', 'easy'}, --easy medium or hard each one corresponds to how many skillchecks and the difficulty - blcirprog = { amount = 2, speed = 50}, -- speed = 1-100 - blprog = { amount = 1, speed = 50}, -- speed = 1-100 - blkeyspam = { amount = 1, difficulty = 50}, -- difficulty = 1-100 - blkeycircle = { amount = 1, difficulty = 50, keynumbers = 3}, - blnumberslide = { amount = 1, difficulty = 50, keynumbers = 3}, - blrapidlines = { amount = 1, difficulty = 50, numberofline = 3}, - blcircleshake = { amount = 1, difficulty = 50, stages = 3}, - glpath = { gridSize = 19, lives = 3, timelimit = 10000}, + ps_circle = {amount = 2, speed = 8,}, + ps_maze = {timelimit = 15}, + ps_scrambler = {type = 'numeric', time = 15, mirrored = 0}, + ps_var = {numBlocks = 5, time = 10}, + ps_thermite = {time = 10, gridsize = 5, incorrect = 3}, + ox = {'easy', 'easy'}, --easy medium or hard each one corresponds to how many skillchecks and the difficulty + blcirprog = {amount = 2, speed = 50}, -- speed = 1-100 + blprog = {amount = 1, speed = 50}, -- speed = 1-100 + blkeyspam = {amount = 1, difficulty = 50}, -- difficulty = 1-100 + blkeycircle = {amount = 1, difficulty = 50, keynumbers = 3}, + blnumberslide = {amount = 1, difficulty = 50, keynumbers = 3}, + blrapidlines = {amount = 1, difficulty = 50, numberofline = 3}, + blcircleshake = {amount = 1, difficulty = 50, stages = 3}, + glpath = {gridSize = 19, lives = 3, timelimit = 10000}, glspot = {gridSize = 6, timeLimit = 999999, charSet = "alphabet", required = 10}, glmath = {timeLimit = 300000}, @@ -165,9 +165,9 @@ Config.AlertPoliceWholesale = 90 -- 1-100 of how often it will alert police Config.WholesaleTimeout = 600 -- time in seconds to get to the location Config.PoliceCount = 0 -- Amount of police required Config.Wcoke = { min = 20, max = 60} -- pricings per item -Config.Wcrack = { min = 20, max = 60} -Config.Wlsd = { min = 20, max = 60} -Config.WXTC = { min = 20, max = 60} +Config.Wcrack = { min = 20, max = 60} -- pricings per item +Config.Wlsd = { min = 20, max = 60} -- pricings per item +Config.WXTC = { min = 20, max = 60} -- pricings per item --- travelling merchant diff --git a/shared/qbdrugsrewrite.lua b/shared/qbdrugsrewrite.lua index f3b2b6d..3710fab 100644 --- a/shared/qbdrugsrewrite.lua +++ b/shared/qbdrugsrewrite.lua @@ -10,145 +10,138 @@ QBConfig.CustomDirtyMoneyitem = '' QBConfig.DrugsPrice = { -- base qb - ["weed_white-widow"] = {min = 15, max = 24 }, - ["weed_og-kush"] = {min = 15, max = 28}, - ["weed_skunk"] = {min = 15, max = 31 }, - ["weed_amnesia"] = {min = 18, max = 34}, - ["weed_purple-haze"] = {min = 18, max = 37}, - ["weed_ak47"] = {min = 18, max = 40}, - ["crack_baggy"] = {min = 18, max = 34}, - ["cokebaggy"] = {min = 18, max = 37}, - -- coke - ["cokebaggystagetwo"] = {min = 18, max = 40}, - ["cokebaggystagethree"] = {min = 18, max = 40}, - -- heroin - ["heroin_ready"] = {min = 18, max = 40}, - ["heroin_readystagetwo"] = {min = 18, max = 40}, - ["heroin_readystagethree"] = {min = 18, max = 40}, - -- crack - ["baggedcracked"] = {min = 18, max = 40}, - ["baggedcrackedstagetwo"] = {min = 18, max = 40}, - ["baggedcrackedstagethree"] = {min = 18, max = 40}, - -- xtc - ["white_playboys"] = {min = 18, max = 40}, - ["white_playboys2"] = {min = 18, max = 40}, - ["white_playboys3"] = {min = 18, max = 40}, - ["white_playboys4"] = {min = 18, max = 40}, - ["blue_playboys"] = {min = 18, max = 40}, - ["blue_playboys2"] = {min = 18, max = 40}, - ["blue_playboys3"] = {min = 18, max = 40}, - ["blue_playboys4"] = {min = 18, max = 40}, - ["red_playboys"] = {min = 18, max = 40}, - ["red_playboys2"] = {min = 18, max = 40}, - ["red_playboys3"] = {min = 18, max = 40}, - ["red_playboys4"] = {min = 18, max = 40}, - ["orange_playboys"] = {min = 18, max = 40}, - ["orange_playboys2"] = {min = 18, max = 40}, - ["orange_playboys3"] = {min = 18, max = 40}, - ["orange_playboys4"] = {min = 18, max = 40}, - ["white_aliens"] = {min = 18, max = 40}, - ["white_aliens2"] = {min = 18, max = 40}, - ["white_aliens3"] = {min = 18, max = 40}, - ["white_aliens4"] = {min = 18, max = 40}, - ["blue_aliens"] = {min = 18, max = 40}, - ["blue_aliens2"] = {min = 18, max = 40}, - ["blue_aliens3"] = {min = 18, max = 40}, - ["blue_aliens4"] = {min = 18, max = 40}, - ["red_aliens"] = {min = 18, max = 40}, - ["red_aliens2"] = {min = 18, max = 40}, - ["red_aliens3"] = {min = 18, max = 40}, - ["red_aliens4"] = {min = 18, max = 40}, - ["orange_aliens"] = {min = 18, max = 40}, - ["orange_aliens2"] = {min = 18, max = 40}, - ["orange_aliens3"] = {min = 18, max = 40}, - ["orange_aliens4"] = {min = 18, max = 40}, - ["white_pl"] = {min = 18, max = 40}, - ["white_pl2"] = {min = 18, max = 40}, - ["white_pl3"] = {min = 18, max = 40}, - ["white_pl4"] = {min = 18, max = 40}, - ["blue_pl"] = {min = 18, max = 40}, - ["blue_pl2"] = {min = 18, max = 40}, - ["blue_pl3"] = {min = 18, max = 40}, - ["blue_pl4"] = {min = 18, max = 40}, - ["red_pl"] = {min = 18, max = 40}, - ["red_pl2"] = {min = 18, max = 40}, - ["red_pl3"] = {min = 18, max = 40}, - ["red_pl4"] = {min = 18, max = 40}, - ["orange_pl"] = {min = 18, max = 40}, - ["orange_pl2"] = {min = 18, max = 40}, - ["orange_pl3"] = {min = 18, max = 40}, - ["orange_pl4"] = {min = 18, max = 40}, - ["white_trolls"] = {min = 18, max = 40}, - ["white_trolls2"] = {min = 18, max = 40}, - ["white_trolls3"] = {min = 18, max = 40}, - ["white_trolls4"] = {min = 18, max = 40}, - ["blue_trolls"] = {min = 18, max = 40}, - ["blue_trolls2"] = {min = 18, max = 40}, - ["blue_trolls3"] = {min = 18, max = 40}, - ["blue_trolls4"] = {min = 18, max = 40}, - ["red_trolls"] = {min = 18, max = 40}, - ["red_trolls2"] = {min = 18, max = 40}, - ["red_trolls3"] = {min = 18, max = 40}, - ["red_trolls4"] = {min = 18, max = 40}, - ["orange_trolls"] = {min = 18, max = 40}, - ["orange_trolls2"] = {min = 18, max = 40}, - ["orange_trolls3"] = {min = 18, max = 40}, - ["orange_trolls4"] = {min = 18, max = 40}, - ["white_cats"] = {min = 18, max = 40}, - ["white_cats2"] = {min = 18, max = 40}, - ["white_cats3"] = {min = 18, max = 40}, - ["white_cats4"] = {min = 18, max = 40}, - ["blue_cats"] = {min = 18, max = 40}, - ["blue_cats2"] = {min = 18, max = 40}, - ["blue_cats3"] = {min = 18, max = 40}, - ["blue_cats4"] = {min = 18, max = 40}, - ["red_cats"] = {min = 18, max = 40}, - ["red_cats2"] = {min = 18, max = 40}, - ["red_cats3"] = {min = 18, max = 40}, - ["red_cats4"] = {min = 18, max = 40}, - ["orange_cats"] = {min = 18, max = 40}, - ["orange_cats2"] = {min = 18, max = 40}, - ["orange_cats3"] = {min = 18, max = 40}, - ["orange_cats4"] = {min = 18, max = 40}, - -- weed stuff - ["blunts"] = {min = 18, max = 40}, - ["leanblunts"] = {min = 18, max = 40}, - ["dextroblunts"] = {min = 18, max = 40}, - ["chewyblunt"] = {min = 18, max = 40}, - ["blunt"] = {min = 18, max = 40}, - ["specialchocolate"] = {min = 18, max = 40}, - ["specialbrownie"] = {min = 18, max = 40}, - ["specialcookie"] = {min = 18, max = 40}, - ["specialmuffin"] = {min = 18, max = 40}, - ["shatter"] = {min = 18, max = 40}, - ["ciggie"] = {min = 18, max = 40}, - -- meth - ["methbags"] = {min = 18, max = 40}, - -- mescaline - ["driedmescaline"] = {min = 18, max = 40}, - -- shrooms - ["shrooms"] = {min = 18, max = 40}, - -- LSD - ["gratefuldead_tabs"] = {min = 18, max = 40}, - ["bart_tabs"] = {min = 18, max = 40}, - ["pineapple_tabs"] = {min = 18, max = 40}, - ["yinyang_tabs"] = {min = 18, max = 40}, - ["wildcherry_tabs"] = {min = 18, max = 40}, - ["smiley_tabs"] = {min = 18, max = 40}, + ["weed_white-widow"] = {rep = 1,min = 15, max = 24 }, + ["weed_og-kush"] = {rep = 1,min = 15, max = 28 }, + ["weed_skunk"] = {rep = 1,min = 15, max = 31 }, + ["weed_amnesia"] = {rep = 1,min = 18, max = 34 }, + ["weed_purple-haze"] = {rep = 1,min = 18, max = 37}, + ["weed_ak47"] = {rep = 1,min = 18, max = 40}, + ["crack_baggy"] = {rep = 1,min = 18, max = 34}, + ["cokebaggy"] = {rep = 1,min = 18, max = 37}, + -- cokerep = 1, + ["cokebaggystagetwo"] = {rep = 1,min = 18, max = 40}, + ["cokebaggystagethree"] = {rep = 1,min = 18, max = 40}, + -- heroin rep = 1, + ["heroin_ready"] = {rep = 1,min = 18, max = 40}, + ["heroin_readystagetwo"] = {rep = 1,min = 18, max = 40}, + ["heroin_readystagethree"] = {rep = 1,min = 18, max = 40}, + -- crackrep = 1, + ["baggedcracked"] = {rep = 1,min = 18, max = 40}, + ["baggedcrackedstagetwo"] = {rep = 1,min = 18, max = 40}, + ["baggedcrackedstagethree"] = {rep = 1,min = 18, max = 40}, + -- xtc rep = 1, + ["white_playboys"] = {rep = 1,min = 18, max = 40}, + ["white_playboys2"] = {rep = 1,min = 18, max = 40}, + ["white_playboys3"] = {rep = 1,min = 18, max = 40}, + ["white_playboys4"] = {rep = 1,min = 18, max = 40}, + ["blue_playboys"] = {rep = 1,min = 18, max = 40}, + ["blue_playboys2"] = {rep = 1,min = 18, max = 40}, + ["blue_playboys3"] = {rep = 1,min = 18, max = 40}, + ["blue_playboys4"] = {rep = 1,min = 18, max = 40}, + ["red_playboys"] = {rep = 1,min = 18, max = 40}, + ["red_playboys2"] = {rep = 1,min = 18, max = 40}, + ["red_playboys3"] = {rep = 1,min = 18, max = 40}, + ["red_playboys4"] = {rep = 1,min = 18, max = 40}, + ["orange_playboys"] = {rep = 1,min = 18, max = 40}, + ["orange_playboys2"] = {rep = 1,min = 18, max = 40}, + ["orange_playboys3"] = {rep = 1,min = 18, max = 40}, + ["orange_playboys4"] = {rep = 1,min = 18, max = 40}, + ["white_aliens"] = {rep = 1,min = 18, max = 40}, + ["white_aliens2"] = {rep = 1,min = 18, max = 40}, + ["white_aliens3"] = {rep = 1,min = 18, max = 40}, + ["white_aliens4"] = {rep = 1,min = 18, max = 40}, + ["blue_aliens"] = {rep = 1,min = 18, max = 40}, + ["blue_aliens2"] = {rep = 1,min = 18, max = 40}, + ["blue_aliens3"] = {rep = 1,min = 18, max = 40}, + ["blue_aliens4"] = {rep = 1,min = 18, max = 40}, + ["red_aliens"] = {rep = 1,min = 18, max = 40}, + ["red_aliens2"] = {rep = 1,min = 18, max = 40}, + ["red_aliens3"] = {rep = 1,min = 18, max = 40}, + ["red_aliens4"] = {rep = 1,min = 18, max = 40}, + ["orange_aliens"] = {rep = 1,min = 18, max = 40}, + ["orange_aliens2"] = {rep = 1,min = 18, max = 40}, + ["orange_aliens3"] = {rep = 1,min = 18, max = 40}, + ["orange_aliens4"] = {rep = 1,min = 18, max = 40}, + ["white_pl"] = {rep = 1,min = 18, max = 40}, + ["white_pl2"] = {rep = 1,min = 18, max = 40}, + ["white_pl3"] = {rep = 1,min = 18, max = 40}, + ["white_pl4"] = {rep = 1,min = 18, max = 40}, + ["blue_pl"] = {rep = 1,min = 18, max = 40}, + ["blue_pl2"] = {rep = 1,min = 18, max = 40}, + ["blue_pl3"] = {rep = 1,min = 18, max = 40}, + ["blue_pl4"] = {rep = 1,min = 18, max = 40}, + ["red_pl"] = {rep = 1,min = 18, max = 40}, + ["red_pl2"] = {rep = 1,min = 18, max = 40}, + ["red_pl3"] = {rep = 1,min = 18, max = 40}, + ["red_pl4"] = {rep = 1,min = 18, max = 40}, + ["orange_pl"] = {rep = 1,min = 18, max = 40}, + ["orange_pl2"] = {rep = 1,min = 18, max = 40}, + ["orange_pl3"] = {rep = 1,min = 18, max = 40}, + ["orange_pl4"] = {rep = 1,min = 18, max = 40}, + ["white_trolls"] = {rep = 1,min = 18, max = 40}, + ["white_trolls2"] = {rep = 1,min = 18, max = 40}, + ["white_trolls3"] = {rep = 1,min = 18, max = 40}, + ["white_trolls4"] = {rep = 1,min = 18, max = 40}, + ["blue_trolls"] = {rep = 1,min = 18, max = 40}, + ["blue_trolls2"] = {rep = 1,min = 18, max = 40}, + ["blue_trolls3"] = {rep = 1,min = 18, max = 40}, + ["blue_trolls4"] = {rep = 1,min = 18, max = 40}, + ["red_trolls"] = {rep = 1,min = 18, max = 40}, + ["red_trolls2"] = {rep = 1,min = 18, max = 40}, + ["red_trolls3"] = {rep = 1,min = 18, max = 40}, + ["red_trolls4"] = {rep = 1,min = 18, max = 40}, + ["orange_trolls"] = {rep = 1,min = 18, max = 40}, + ["orange_trolls2"] = {rep = 1,min = 18, max = 40}, + ["orange_trolls3"] = {rep = 1,min = 18, max = 40}, + ["orange_trolls4"] = {rep = 1,min = 18, max = 40}, + ["white_cats"] = {rep = 1,min = 18, max = 40}, + ["white_cats2"] = {rep = 1,min = 18, max = 40}, + ["white_cats3"] = {rep = 1,min = 18, max = 40}, + ["white_cats4"] = {rep = 1,min = 18, max = 40}, + ["blue_cats"] = {rep = 1,min = 18, max = 40}, + ["blue_cats2"] = {rep = 1,min = 18, max = 40}, + ["blue_cats3"] = {rep = 1,min = 18, max = 40}, + ["blue_cats4"] = {rep = 1,min = 18, max = 40}, + ["red_cats"] = {rep = 1,min = 18, max = 40}, + ["red_cats2"] = {rep = 1,min = 18, max = 40}, + ["red_cats3"] = {rep = 1,min = 18, max = 40}, + ["red_cats4"] = {rep = 1,min = 18, max = 40}, + ["orange_cats"] = {rep = 1,min = 18, max = 40}, + ["orange_cats2"] = {rep = 1,min = 18, max = 40}, + ["orange_cats3"] = {rep = 1,min = 18, max = 40}, + ["orange_cats4"] = {rep = 1,min = 18, max = 40}, + -- weed stuffrep = 1, + ["blunts"] = {rep = 1,min = 18, max = 40}, + ["leanblunts"] = {rep = 1,min = 18, max = 40}, + ["dextroblunts"] = {rep = 1,min = 18, max = 40}, + ["chewyblunt"] = {rep = 1,min = 18, max = 40}, + ["blunt"] = {rep = 1,min = 18, max = 40}, + ["specialchocolate"] = {rep = 1,min = 18, max = 40}, + ["specialbrownie"] = {rep = 1,min = 18, max = 40}, + ["specialcookie"] = {rep = 1,min = 18, max = 40}, + ["specialmuffin"] = {rep = 1,min = 18, max = 40}, + ["shatter"] = {rep = 1,min = 18, max = 40}, + ["ciggie"] = {rep = 1,min = 18, max = 40}, + -- methrep = 1, + ["methbags"] = {rep = 1,min = 18, max = 40}, + -- mescalinerep = 1, + ["driedmescaline"] = {rep = 1,min = 18, max = 40}, + -- shroomsrep = 1, + ["shrooms"] = {rep = 1,min = 18, max = 40}, + -- LSDrep = 1, + ["gratefuldead_tabs"] = {rep = 1,min = 18, max = 40}, + ["bart_tabs"] = {rep = 1,min = 18, max = 40}, + ["pineapple_tabs"] = {rep = 1,min = 18, max = 40}, + ["yinyang_tabs"] = {rep = 1,min = 18, max = 40}, + ["wildcherry_tabs"] = {rep = 1,min = 18, max = 40}, + ["smiley_tabs"] = {rep = 1,min = 18, max = 40}, -- lean - ["cupoflean"] = {min = 18, max = 40}, - ["cupofdextro"] = {min = 18, max = 40}, + ["cupoflean"] = {rep = 1,min = 18, max = 40}, + ["cupofdextro"] = {rep = 1,min = 18, max = 40}, } QBConfig.Dealers = {} -QBConfig.UseMarkedBills = false -- true for marked bills, false for cash -QBConfig.DeliveryRepGain = 1 -- amount of rep gained per delivery -QBConfig.DeliveryRepLoss = 1 -- amount of rep lost if delivery wrong or late -QBConfig.PoliceDeliveryModifier = 2 -- amount to multiply active cop count by -QBConfig.WrongAmountFee = 2 -- divide the payout by this value for wrong delivery amount -QBConfig.OverdueDeliveryFee = 4 -- divide the payout by this value for overdue delivery - QBConfig.DeliveryItems = { { item = "weed_brick", minrep = 0, payout = {min = 10, max = 50}}, { item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, @@ -236,3 +229,13 @@ QBConfig.DeliveryLocations = { [79] = { ["label"] = "Bahama Mamas", ["coords"] = vector3(-1383.1, -639.99, 28.67),}, } + +QBConfig.SellLevel = { + {price = 0.5, minrep = 0, maxrep = 240, label = 'Rookie'}, + {price = 1.0, minrep = 240, maxrep = 600, label = 'Corner Boy'}, + {price = 1.1, minrep = 600, maxrep = 1200, label = 'Corner Man'}, + {price = 1.2, minrep = 1200, maxrep = 1800, label = 'Dope Peddler'}, + {price = 1.3, minrep = 1800, maxrep = 2400, label = 'Drug Supplier'}, + {price = 1.5, minrep = 2400, maxrep = 4800, label = 'Drug Pusher'}, + {price = 1.75, minrep = 4800, maxrep = 99999999999999, label = 'Drug Lord'}, +} \ No newline at end of file