From 5b6fef2d490dfa7294cb5e777f6af48b0e749666 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Sun, 24 Nov 2024 01:25:09 -0800 Subject: [PATCH] refractored a lot removed travellingmerchant file, now in pedspawns.lua --- client/animationsandfunctions.lua | 40 +++++--------------- client/deliveries.lua | 1 + client/functions.lua | 32 ++++++++++------ client/heroin.lua | 1 - client/lean.lua | 4 +- client/lsd.lua | 1 - client/meth.lua | 5 +-- client/oxyruns.lua | 34 +++++++---------- client/pedspawns.lua | 5 ++- client/shrooms.lua | 1 - client/travellingmerchant.lua | 14 ------- client/weed.lua | 45 ++++++++-------------- client/wholesale.lua | 63 +++++++++++++------------------ server/cocaine.lua | 17 +++++---- server/crack.lua | 6 ++- server/functions.lua | 11 +----- server/weed.lua | 4 +- 17 files changed, 112 insertions(+), 172 deletions(-) delete mode 100644 client/travellingmerchant.lua diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 3365d58..971b8ec 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -11,8 +11,6 @@ local started = nil SetPtfxAssetNextCall(dict) end - - function MethCooking() local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" lib.requestAnimDict(animDict, 500) @@ -162,8 +160,6 @@ function Tray() AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01,-0.2, -0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) end - - function CutCoke() local animDict, animName = "anim@amb@business@coc@coc_unpack_cut_left@", "coke_cut_v5_coccutter" lib.requestAnimDict(animDict, 500) @@ -382,9 +378,9 @@ function SpawnCarPedChase() lib.requestModel(`pounder`, Config.RequestModelTime) lib.requestModel("ig_priest", Config.RequestModelTime) lib.requestModel(`cargobob3`, Config.RequestModelTime) - local leancar = CreateVehicle(`pounder`, start.x+3, start.y-2, start.z-1, 52.0, true, true) - local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, true, false) - local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, true, false) + local leancar = CreateVehicle(`pounder`, start.x+3, start.y-2, start.z-1, 52.0, false, false) + local driver = CreatePed(26, "ig_priest", start.x, start.y, start.z, 268.9422, false, false) + local pilot2 = CreatePed(26, "ig_priest", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) FreezeEntityPosition(pilot2, true) SetEntityInvincible(pilot2, true) SetEntityAsMissionEntity(leancar) @@ -416,7 +412,7 @@ function SpawnCarPedChase() Wait(1000) until #(GetEntityCoords(driver) - GetEntityCoords(pilot2)) < 25.0 Wait( 3 * 1000) - local heli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, true,true) + local heli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) Wait(1000) if DoesEntityExist(heli) then SetEntityInvincible(pilot2, false) @@ -426,7 +422,7 @@ function SpawnCarPedChase() SetPedIntoVehicle(pilot2, heli, -1) TaskHeliMission(pilot2, heli, 0, 0, -3362.05, 589.45, -13.04, 4, 150.0, 20.0, -1.0, 10, 10, 5.0, 0) else - heli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, true,true) + heli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) end end end @@ -446,9 +442,9 @@ else lib.requestModel(`journey`, Config.RequestModelTime) lib.requestModel("a_m_m_hillbilly_02", Config.RequestModelTime) lib.requestModel(`cargobob3`, Config.RequestModelTime) - local methcar = CreateVehicle(`journey`, start.x+3, start.y-2, start.z-1, 52.0, true, true) - local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, true, false) - local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, true, false) + local methcar = CreateVehicle(`journey`, start.x+3, start.y-2, start.z-1, 52.0, false, false) + local methdriver = CreatePed(26, "a_m_m_hillbilly_02", start.x, start.y, start.z, 268.9422, false, false) + local methpilot = CreatePed(26, "a_m_m_hillbilly_02", stoploc.x-3, stoploc.y-3, stoploc.z-1, 268.9422, false, false) FreezeEntityPosition(methpilot, true) SetEntityInvincible(methpilot, true) SetEntityAsMissionEntity(methcar) @@ -481,7 +477,7 @@ else Wait(1000) until #(GetEntityCoords(methdriver) - GetEntityCoords(methpilot)) < 25.0 Wait( 3 * 1000) - local methheli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, true,true) + local methheli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) Wait(1000) if DoesEntityExist(methheli) then SetEntityInvincible(methpilot, false) @@ -492,7 +488,7 @@ else SetPedIntoVehicle(methpilot, methheli, -1) TaskHeliMission(methpilot, methheli, 0, 0, -3362.05, 589.45, -13.04, 4, 150.0, 20.0, -1.0, 10, 10, 5.0, 0) else - methheli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, true,true) + methheli = CreateVehicle(`cargobob3`, stoploc.x-20, stoploc.y-20, stoploc.z-1, 80, false,false) end end end @@ -520,19 +516,3 @@ function SetUpPeds() end end -RegisterCommand('DrugRep', function() - if not Config.TierSystem then return end - local rep = lib.callback.await('md-drugs:server:GetRep', false) - lib.registerContext({ - id = 'DrugRep', - title = 'Drug Reputation', - options = { - {icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke}, - {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') -end, false) \ No newline at end of file diff --git a/client/deliveries.lua b/client/deliveries.lua index 4ac5717..5c03cc2 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -1,6 +1,7 @@ local QBCore = exports['qb-core']:GetCoreObject() local isActive = false local dealer = {} + RegisterNetEvent('md-drugs:client:opendealermenu', function() local rep = GetRep() makeMenu('dealermenu', rep) diff --git a/client/functions.lua b/client/functions.lua index 252b5a1..9c2f25f 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -624,15 +624,6 @@ AddEventHandler('onResourceStart', function(resource) LoadModel('prop_plant_01b') LoadModel('prop_plant_01a') LoadModel('prop_cactus_03') LoadModel('bkr_prop_weed_lrg_01b') end end) -local active = false -RegisterNetEvent('md-drugs:client:minusTier', function(data) - if active then return end - if not data then return end - active = true - if not progressbar('Cutting This ' ..GetLabel(data.item) .. ' More', 4000, 'uncuff') then return end - TriggerServerEvent('md-drugs:server:AddMas', data) - active = false -end) CreateThread(function() TriggerEvent('heroin:init') @@ -642,7 +633,24 @@ CreateThread(function() TriggerEvent('weed:init') end) -lib.callback.register('md-drugs:client:uncuff', function() - if not progressbar('Uncuffing', 4000, 'uncuff') then return end +lib.callback.register('md-drugs:client:uncuff', function(data) + if not progressbar(data, 4000, 'uncuff') then return end return true -end) \ No newline at end of file +end) + +RegisterCommand('DrugRep', function() + if not Config.TierSystem then return end + local rep = lib.callback.await('md-drugs:server:GetRep', false) + lib.registerContext({ + id = 'DrugRep', + title = 'Drug Reputation', + options = { + {icon = "fa-solid fa-face-flushed", title = 'Cocaine: '..rep.coke}, + {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') +end, false) \ No newline at end of file diff --git a/client/heroin.lua b/client/heroin.lua index d474188..250f075 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -104,7 +104,6 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) TriggerServerEvent("md-drugs:server:heatliquidheroin") end) - RegisterNetEvent("md-drugs:client:cleanheroinlabkit", function(data) if not ItemCheck('cleaningkit') then return end if not progressbar(Lang.Heroin.clean, 4000, 'clean') then return end diff --git a/client/lean.lua b/client/lean.lua index edb337c..9444a9a 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -1,8 +1,8 @@ local QBCore = exports['qb-core']:GetCoreObject() RegisterNetEvent("md-drugs:client:getsyruplocationtobuy", function() -Notify(Lang.Lean.marked, "success") -SpawnCarPedChase() + Notify(Lang.Lean.marked, "success") + SpawnCarPedChase() end) RegisterNetEvent('md-drugs:client:leancraft', function() diff --git a/client/lsd.lua b/client/lsd.lua index 03fef3c..ae074fc 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -1,7 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local tableout = false - local function createLabKit(coord, head) local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) SetEntityHeading(labkit, head) diff --git a/client/meth.lua b/client/meth.lua index e6eae09..a250fa0 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -3,6 +3,7 @@ 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 @@ -123,6 +124,4 @@ end) RegisterNetEvent("md-drugs:client:stealace", function(data) if not progressbar('Stealing Acetone', 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:getace", data.data) -end) - - +end) \ No newline at end of file diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 9714781..0e93c63 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -5,8 +5,9 @@ RegisterNetEvent("md-drugs:client:GetOxyCar", function() lib.requestModel("burrito3", Config.RequestModelTime) local paid = lib.callback.await('md-drugs:server:payfortruck', false) if not paid then return end - local loc = lib.callback.await('md-drugs:server:getLocs', false) - local oxycar = CreateVehicle("burrito3",loc.singleSpot.truckspawn.x, loc.singleSpot.truckspawn.y,loc.singleSpot.truckspawn.z, loc.singleSpot.truckspawn.w, true, false) + local loca = lib.callback.await('md-drugs:server:getLocs', false) + local loc = loca.singleSpot.truckspawn + local oxycar = CreateVehicle("burrito3",loc.x, loc.y,loc.z, loc.w, true, false) exports[Config.Fuel]:SetFuel(oxycar, 100.0) TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(oxycar)) Notify(Lang.oxy.truck, 'success') @@ -14,21 +15,18 @@ RegisterNetEvent("md-drugs:client:GetOxyCar", function() AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fas fa-box-circle-check", label = Lang.targets.oxy.pack}, nil ) end) - - RegisterNetEvent("md-drugs:client:getoxylocationroute", function() local config = lib.callback.await('md-drugs:server:getLocs', false) - local CurrentLocation = config.oxylocations[math.random(#config.oxylocations)] - if CurrentLocation ~= nil then - SetNewWaypoint(CurrentLocation.x, CurrentLocation.y) + local loc = config.oxylocations[math.random(#config.oxylocations)] + if loc ~= nil then + SetNewWaypoint(loc.x, loc.y) local current = "g_m_y_famdnf_01" lib.requestModel(current, Config.RequestModelTime) - local oxybuyer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) - Freeze(oxybuyer, true, CurrentLocation.w) + local oxybuyer = CreatePed(0, current,loc.x,loc.y,loc.z-1, loc.w, false, false) + Freeze(oxybuyer, true, loc.w) repeat Wait(1000) - until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0 - + until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x,loc.y,loc.z)) < 5.0 PoliceCall(Config.PoliceAlertOxy) AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fas fa-eye", action = function() @@ -50,21 +48,15 @@ end) RegisterNetEvent("md-drugs:client:getfromtrunk", function() if carryPackage then Notify(Lang.oxy.cantcarry, "error") - else + else local pos = GetEntityCoords(PlayerPedId(), true) - RequestAnimDict('anim@heists@box_carry@') - while (not HasAnimDictLoaded('anim@heists@box_carry@')) do - Wait(7) - end + lib.requestAnimDict('anim@heists@box_carry@') TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) - RequestModel("hei_prop_drug_statue_box_big") - while not HasModelLoaded("hei_prop_drug_statue_box_big") do - Wait(0) - end + lib.RequestModel("hei_prop_drug_statue_box_big") local object = CreateObject("hei_prop_drug_statue_box_big", pos.x, pos.y, pos.z, true, true, true) AttachEntityToEntity(object, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 57005), 0.05, 0.1, -0.3, 300.0, 250.0, 20.0, true, true, false, true, 1, true) carryPackage = object - end + end end) diff --git a/client/pedspawns.lua b/client/pedspawns.lua index b1a40b8..a8f781c 100644 --- a/client/pedspawns.lua +++ b/client/pedspawns.lua @@ -1,6 +1,7 @@ local QBCore = exports['qb-core']:GetCoreObject() CreateThread(function() local config = lib.callback.await('md-drugs:server:getLocs', false) + local num = lib.callback.await('md-drugs:server:GetMerchant', false) local model = {"g_m_y_famdnf_01", 's_m_m_doctor_01', 'u_m_m_jesus_01', "prop_cooker_03"} for k, v in pairs (model) do lib.requestModel(v, Config.RequestModelTime) @@ -10,15 +11,17 @@ CreateThread(function() local SyrupLocation = CreatePed(0, 's_m_m_doctor_01', config.singleSpot.SyrupVendor.x,config.singleSpot.SyrupVendor.y,config.singleSpot.SyrupVendor.z-1, config.singleSpot.SyrupVendor.w, false, false) local WeedGuy = CreatePed(0,'u_m_m_jesus_01',config.singleSpot.WeedSaleman.x,config.singleSpot.WeedSaleman.y,config.singleSpot.WeedSaleman.z-1, config.singleSpot.WeedSaleman.w, false, false) local methdealer = CreatePed(0, "g_m_y_famdnf_01", config.singleSpot.MethHeistStart.x, config.singleSpot.MethHeistStart.y, config.singleSpot.MethHeistStart.z - 1, false, false) + local travellingmerchant = CreatePed(0, "g_m_y_famdnf_01",num.x,num.y,num.z-1, num.w, false, false) Freeze(tabdealer, true,config.singleSpot.buylsdlabkit.w) Freeze(SyrupLocation, true, config.singleSpot.SyrupVendor.w) Freeze(heroinkitdealer, true, config.singleSpot.buyheroinlabkit.w) Freeze(WeedGuy, true, config.singleSpot.WeedSaleman.w) Freeze(methdealer, true, 220.0) + Freeze(travellingmerchant, true, num.w) AddSingleModel(tabdealer,{ type = "client", label = Lang.targets.lsd.buy, icon = "fa-solid fa-money-bill", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer ) AddSingleModel(heroinkitdealer, { label = Lang.targets.heroin.kit, icon = "fa-solid fa-money-bill", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) AddSingleModel(SyrupLocation, { type = "client", label = Lang.targets.lean.git, icon = "fa-solid fa-circle-info", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil ) AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil) AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fas fa-eye", action = function() Notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil ) - + AddSingleModel(travellingmerchant, {label = Lang.targets.travel.travel, icon = "fas fa-eye", action = function() makeMenu('travellingMerchant') lib.showContext('travellingMerchant') end}, nil) end) \ No newline at end of file diff --git a/client/shrooms.lua b/client/shrooms.lua index 9c21a44..5f9ba24 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -9,7 +9,6 @@ local function LoadModels(hash) Wait(10) end if HasModelLoaded(hash) then return true end - end local function pick(loc) diff --git a/client/travellingmerchant.lua b/client/travellingmerchant.lua deleted file mode 100644 index 45f698f..0000000 --- a/client/travellingmerchant.lua +++ /dev/null @@ -1,14 +0,0 @@ -local QBCore = exports['qb-core']:GetCoreObject() - -CreateThread(function() - local current = "g_m_y_famdnf_01" - lib.requestModel(current, Config.RequestModelTime) - local num = lib.callback.await('md-drugs:server:GetMerchant', false) - local travellingmerchant = CreatePed(0, current,num.x,num.y,num.z-1, num.w, false, false) - Freeze(travellingmerchant, true, num.w) - AddSingleModel(travellingmerchant, { label = Lang.targets.travel.travel, icon = "fas fa-eye", - action = function() - makeMenu('travellingMerchant') - lib.showContext('travellingMerchant') - end}, nil) -end) diff --git a/client/weed.lua b/client/weed.lua index eb5a0a8..28732a4 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -10,6 +10,11 @@ local function hasJob() return true end end + local function pick(loc) + if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end + TriggerServerEvent("weed:pickupCane", loc) + end + RegisterNetEvent('weed:respawnCane', function(loc) local v = GlobalState.WeedPlant[loc] local hash = GetHashKey(v.model) @@ -17,10 +22,7 @@ RegisterNetEvent('weed:respawnCane', function(loc) if not WeedPlant[loc] then WeedPlant[loc] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true) Freeze(WeedPlant[loc],true, v.heading) - AddSingleModel(WeedPlant[loc], - {icon = "fas fa-hand",label = Lang.targets.weed.pick, - action = function()if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", loc) end}, - loc) + AddSingleModel(WeedPlant[loc], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(loc) end}, loc) end end) @@ -36,10 +38,7 @@ RegisterNetEvent("weed:init", function() if not v.taken then WeedPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z-3.5, false, true, true) Freeze(WeedPlant[k],true, v.heading) - AddSingleModel(WeedPlant[k], - {icon = "fas fa-hand",label = Lang.targets.weed.pick, - action = function()if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", k) end}, - k) + AddSingleModel(WeedPlant[k], {icon = "fas fa-hand",label = Lang.targets.weed.pick, action = function() pick(k) end}, k) end end end) @@ -101,30 +100,27 @@ AddBoxZoneSingle('MakeButterCrafting', config.singleSpot.MakeButter, {label = La canInteract = function() if hasJob() then return true end end }) -AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, { + AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, { name = 'Oil', icon = "fas fa-sign-in-alt", label = Lang.targets.weed.oil, action = function() if not ItemCheckMulti({'butane', 'grindedweed'}) then return end if not minigame() then - local explosion = math.random(1,100) local loc = GetEntityCoords(PlayerPedId()) - if explosion <= 99 then - AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true) - exploded = true - Notify(Lang.Weed.stovehot, "error") - Wait(1000 * 30) - exploded = false - end + AddExplosion(loc.x, loc.y, loc.z, 49, 10, true, false, true, true) + exploded = true + Notify(Lang.Weed.stovehot, "error") + Wait(1000 * 30) + exploded = false return end if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:makeoil") + TriggerServerEvent("md-drugs:server:makeoil") end, canInteract = function() - if hasJob() and exploded == false then return true end + if hasJob() and exploded == false then return true end end, -} ) + }) local stove = CreateObject("prop_cooker_03",config.singleSpot.MakeButter.x, config.singleSpot.MakeButter.y, config.singleSpot.MakeButter.z-1, true, false) SetEntityHeading(stove, 270.00) FreezeEntityPosition(stove, true) @@ -145,15 +141,6 @@ CreateThread(function() RefreshInterior(BikerWeedFarm.interiorId) end) - -RegisterNetEvent("md-drugs:client:rollanim", function() -if not progressbar(Lang.Weed.roll, 4000, 'uncuff') then return end -end) - -RegisterNetEvent("md-drugs:client:grind", function() - if not progressbar("grinding", 4000, 'uncuff') then return end -end) - RegisterNetEvent("md-drugs:client:dodabs", function() if not progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end AlienEffect() diff --git a/client/wholesale.lua b/client/wholesale.lua index e338a79..2882206 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,58 +1,49 @@ local QBCore = exports['qb-core']:GetCoreObject() local miss = false - RegisterNetEvent("md-drugs:client:GetLocation", function(drug) - if not GetCops(Config.PoliceCount) then return end + if not GetCops(Config.PoliceCount) then return end if miss then Notify(Lang.Wholesale.al, 'error') else - local CurrentLocation = drug.location + local loc = drug.location local timer = 0 miss = true - SetNewWaypoint(CurrentLocation.x, CurrentLocation.y) + SetNewWaypoint(loc.x, loc.y) lib.requestModel("g_m_y_famdnf_01", Config.RequestModelTime) - local current = "g_m_y_famdnf_01" - local drugdealer = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, 90.0, false, false) - FreezeEntityPosition(drugdealer, true) - SetEntityInvincible(drugdealer, true) - AddMultiModel(drugdealer, {{ - label = Lang.targets.Wholesale.talk, - icon = "fas fa-eye", - action = function() - local luck = math.random(1,100) - if luck <= Config.SuccessfulChance then - TriggerEvent("md-drugs:client:SuccessSale", drug) - else - TriggerEvent("md-drugs:client:SetUp", drug) - end - Wait(3000) - DeleteEntity(drugdealer) - miss = false - end - }},drugdealer ) + local current = "g_m_y_famdnf_01" + local drugdealer = CreatePed(0, current,loc.x,loc.y,loc.z-1, 90.0, false, false) + FreezeEntityPosition(drugdealer, true) + SetEntityInvincible(drugdealer, true) + AddMultiModel(drugdealer, {{ + label = Lang.targets.Wholesale.talk, + icon = "fas fa-eye", + action = function() + local luck = math.random(1,100) + if luck <= Config.SuccessfulChance then + if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:SuccessSale", drug) + else + progressbar("YOU FUCKED NOW", 4000, 'uncuff') + SetUpPeds() + end + Wait(3000) + DeleteEntity(drugdealer) + miss = false + end + }},drugdealer ) repeat Wait(1000) timer = timer + 1 - until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1 + until #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1 PoliceCall(Config.AlertPoliceWholesale) - if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 then + if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(loc.x, loc.y, loc.z) ) < 4.0 then timer = 0 else - Notify('The Buyer Waited To Long') + Notify('The Buyer Waited To Long', 'error') DeleteEntity(drugdealer) end end end) -RegisterNetEvent("md-drugs:client:SuccessSale", function(drug) - if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:SuccessSale", drug) -end) - -RegisterNetEvent("md-drugs:client:SetUp", function(drug) - progressbar("YOU FUCKED NOW", 4000, 'uncuff') - TriggerServerEvent("md-drugs:server:SetUp", drug) - SetUpPeds() -end) diff --git a/server/cocaine.lua b/server/cocaine.lua index 8069aec..5e313fd 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -52,15 +52,12 @@ RegisterServerEvent('md-drugs:server:makepowder', function(num) local src = source if not checkLoc(src, 'MakePowder', num) then return end local tier = 'tier1' - local logMessage = ' Made Raw Coke' if Config.TierSystem then local coke = getRep(src, 'coke') if coke > Config.Tier1 and coke <= Config.Tier2 then tier = 'tier2' - logMessage = ' Made Raw Coke tier 2' elseif coke > Config.Tier2 then tier = 'tier3' - logMessage = ' Made Raw Coke tier 3' end end if not GetRecipe(src, 'cocaine', 'cokepowder', tier) then return end @@ -130,10 +127,14 @@ local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} for k, v in pairs (cokecut) do QBCore.Functions.CreateUseableItem(k, function(source, item) local src = source - local Player = getPlayer(src) - if Player.Functions.GetItemByName(item.name) then - if not Itemcheck(src, 'bakingsoda', 1) then return end - TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'coke', xt = 'bakingsoda', item = k, amount = v,recieve = 'loosecoke'}) - end + local Player = getPlayer(src) + if Player.Functions.GetItemByName(item.name) then + if not Itemcheck(src, 'bakingsoda', 1) then return end + local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further') + if not check then return end + if RemoveItem(src, k, 1) then + AddItem(src, 'loosecoke', v) + end + end end) end \ No newline at end of file diff --git a/server/crack.lua b/server/crack.lua index e33d313..111d176 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -52,7 +52,11 @@ for k, v in pairs (cokecut) do local Player = getPlayer(src) if Player.Functions.GetItemByName(item.name) then if not Itemcheck(src, 'bakingsoda', 1) then return end - TriggerClientEvent('md-drugs:client:minusTier', src, {type = 'crack', xt = 'bakingsoda', item = k, amount = v,recieve = 'crackrock'}) + local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further') + if not check then return end + if RemoveItem(src, k, 1) then + AddItem(src, 'crackrock', v) + end end end) end diff --git a/server/functions.lua b/server/functions.lua index aa1ca60..ec2609b 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -348,13 +348,4 @@ CreateThread(function() print('^2 Your Version:' .. version .. ' | Current Version:' .. text .. '' ) end end, "GET", "", "") -end) - -RegisterServerEvent('md-drugs:server:AddMas', function(data) - local src = source - if not data then return end - if not Itemcheck(src, data.xt, 1) then return end - if not RemoveItem(src, data.item, 1) then return end - RemoveItem(src, data.xt, 1) - AddItem(src, data.recieve, data.amount) -end) +end) \ No newline at end of file diff --git a/server/weed.lua b/server/weed.lua index 9327ff1..a8d93a4 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -122,7 +122,7 @@ end) QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item) local src = source - local check = lib.callback.await('md-drugs:client:uncuff', src) + local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed') if not check then return end if RemoveItem(src, "drycannabis",1 ) then AddItem(src, "grindedweed", 1) @@ -134,7 +134,7 @@ end) QBCore.Functions.CreateUseableItem("mdwoods", function(source, item) local src = source local Player = getPlayer(src) - local check = lib.callback.await('md-drugs:client:uncuff', src) + local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open') if not check then return end if RemoveItem(src, "mdwoods",1 ) then AddItem(src, "bluntwrap", 5)