diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 40f4003..16b830a 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -366,7 +366,7 @@ end local hit = 0 function SpawnCarPedChase() local stoploc = vector3(-1157.63, -3056.71, 13.94) - local config = lib.callback.await('md-drugs:server:getLocs', false) + local config = ps.callback('md-drugs:server:getLocs', false) local start = config.StartLoc[math.random(1,#config.StartLoc)] if started then Notify(Lang.lean.act,'error') @@ -413,7 +413,7 @@ end function SpawnMethCarPedChase() local ped = GetEntityCoords(PlayerPedId()) local stoploc = vector3(-1157.63, -3056.71, 13.94) -local config = lib.callback.await('md-drugs:server:getLocs', false) +local config = ps.callback('md-drugs:server:getLocs', false) local start = config.StartLoc[math.random(1,#config.StartLoc)] local startedmeth = false diff --git a/client/cocaine.lua b/client/cocaine.lua index 65edee4..533dd88 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -1,7 +1,6 @@ local CocaPlant = {} local cuttingcoke = nil local baggingcoke = nil - local function pick(loc) if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end TriggerServerEvent("coke:pickupCane", loc) @@ -17,7 +16,7 @@ RegisterNetEvent('coke:respawnCane', function(loc) ps.entityTarget(CocaPlant[loc], { { icon = "fa-solid fa-seedling", - label = Lang.targets.coke.pick, + label = ps.lang('targets.coke.pick'), action = function() if not pick(loc) then return end end @@ -34,14 +33,14 @@ end) RegisterNetEvent("coke:init", function() for k, v in pairs (GlobalState.CocaPlant) do local hash = GetHashKey(v.model) - LoadModel(hash) + ps.requestModel(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) ps.entityTarget(CocaPlant[k], { { icon = "fa-solid fa-seedling", - label = Lang.targets.coke.pick, + label = ps.lang('targets.coke.pick'), action = function() if not pick(k) then return end end @@ -65,11 +64,11 @@ end) for k, v in pairs (GlobalState.MDDrugsLocs.MakePowder) do ps.boxTarget('cocaplant'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { { - label = Lang.targets.coke.pick, + label = ps.lang('.targets.coke.pick'), icon = 'fa-solid fa-seedling', action = function() if not ps.hasItem('coca_leaf') then return end - if not ps.progressbar(Lang.Coke.makepow, 4000, 'uncuff') then return end + if not ps.progressbar(ps.lang('Coke.makepow'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makepowder", k) end, canInteract = function() @@ -82,7 +81,7 @@ end for k, v in pairs (GlobalState.MDDrugsLocs.CuttingCoke) do ps.boxTarget('cutcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { { - label = 'cutCoke', + label = ps.lang('targets.coke.cut'), icon = 'fa-solid fa-mortar-pestle', action = function() CutCoke(v.loc, v.offset, v.rotation) @@ -98,7 +97,7 @@ end for k, v in pairs (GlobalState.MDDrugsLocs.BaggingCoke) do ps.boxTarget('bagcoke'..k, v.loc, {length = 1.0, width = 1.0, height = 1.0, rotation = 180.0}, { { - label = 'bagCoke', + label = ps.lang('targets.coke.bag'), icon = 'fa-solid fa-sack-xmark', action = function() BagCoke(v.loc, v.offset, v.rotation) diff --git a/client/consumables.lua b/client/consumables.lua index 62a16ee..ae93b3c 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,6 +1,6 @@ -lib.callback.register('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) +ps.registerCallback('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) if not progressbar(progresstext .. GetLabel(item).. "!", time, anim ) then return end for k, v in pairs (status) do if k == 'health' then diff --git a/client/cornerselling.lua b/client/cornerselling.lua index c9dc85b..20731a4 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -51,7 +51,7 @@ function Cornersell() local targ = lib.GetClosestPed(GetEntityCoords(PlayerPedId()), 8) if targ == nil then return end if IsPedInAnyVehicle(targ, false) or GetEntityHealth(targ) == 0 or not IsPedHuman(targ) then return end - local data = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false, targ) + local data = ps.callback('md-drugs:server:cornerselling:getAvailableDrugs', false, targ) if data.item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) active = false return false end TaskGoToCoordAnyMeans(targ, GetEntityCoords(PlayerPedId()), 1.0, 0, 0, 0, 0) active = true @@ -83,7 +83,7 @@ end RegisterNetEvent('md-drugs:client:cornerselling', function() if not GetCops(QBConfig.MinimumDrugSalePolice) then return end if inZone then Notify(Lang.Cornerselling.no, 'error') return end - local has = lib.callback.await('md-drugs:server:hasDrugs', false) + local has = ps.callback('md-drugs:server:hasDrugs', false) if has then if sell then TriggerServerEvent('md-drugs:server:cornerselling:stop') diff --git a/client/crack.lua b/client/crack.lua index 092f01e..df05518 100644 --- a/client/crack.lua +++ b/client/crack.lua @@ -1,12 +1,37 @@ -RegisterNetEvent("md-drugs:client:makecrackone", function(data) - if not ItemCheck('bakingsoda') then return end - if not minigame() then TriggerServerEvent("md-drugs:server:failcrackone", data.data) return end - if not progressbar(Lang.Crack.cookcrack, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:makecrackone", data.data) -end) -RegisterNetEvent("md-drugs:client:bagcrack", function(data) - if not ItemCheck('empty_weed_bag') then return end - if not progressbar(Lang.Crack.bagcrack, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:bagcrack", data.data) -end) \ No newline at end of file +for k, v in pairs (GlobalState.MDDrugsLocs.makecrack) do + ps.boxTarget('makeCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = ps.lang('targets.crack.makecrack'), + icon = 'fa-solid fa-temperature-high', + action = function() + if not ps.hasItem('bakingsoda') then return end + if not minigame() then TriggerServerEvent("md-drugs:server:failcrackone", k) return end + if not ps.progressbar(ps.lang('Crack.makecrack'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:makecrack", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end + +for k, v in pairs (GlobalState.MDDrugsLocs.bagcrack) do + ps.boxTarget('bagCrack'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = ps.lang('targets.crack.bagcrack'), + icon = 'fa-solid fa-weight-scale', + action = function() + if not ps.hasItem('empty_weed_bag') then return end + if not ps.progressbar(ps.lang('Crack.bagcrack'), 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:bagcrack", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end \ No newline at end of file diff --git a/client/deliveries.lua b/client/deliveries.lua index c9372ba..817c66c 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -8,7 +8,7 @@ RegisterNetEvent('md-drugs:client:opendealermenu', function() end) local function SpawnDealer() - local getDealers = lib.callback.await('md-drugs:server:getDealers', false) + local getDealers = ps.callback('md-drugs:server:getDealers') for k,v in pairs(getDealers) do local Ped = "g_m_y_famdnf_01" lib.requestModel(Ped, Config.RequestModelTime) @@ -18,7 +18,7 @@ local function SpawnDealer() AddMultiModel(dealer[k], { { icon = 'fas fa-user-secret', label = string.format(Lang.targets.Delivery.Deliver, v.name), action = function() - local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k) + local bool, item, amount, coords = ps.callback('md-drugs:server:GetDeliveryItem', false, k) if bool then Email(Lang.Delivery.emailn, Lang.Delivery.emailsub, string.format(Lang.Delivery.emailcon, amount, GetLabel(item))) TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) diff --git a/client/functions.lua b/client/functions.lua index 95e440d..fe569df 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -228,7 +228,7 @@ function GetLabel(label) end function GetRep() - local rep = lib.callback.await('md-drugs:server:GetRep', false) + local rep = ps.callback('md-drugs:server:GetRep') return rep end @@ -239,7 +239,7 @@ end function makeMenu(name, rep) local menu = {} - local data = lib.callback.await('md-drugs:server:menu', false, name) + local data = ps.callback('md-drugs:server:menu', name) for k, v in pairs (data.table) do local allow = false if rep == nil then @@ -374,7 +374,7 @@ end function GetCops(number) if number == 0 then return true end - local amount = lib.callback.await('md-drugs:server:GetCoppers', false) + local amount = ps.callback('md-drugs:server:GetCoppers') if amount >= number then return true else Notify('You Need '.. number - amount .. ' More Cops To Do This', 'error') end end @@ -396,160 +396,6 @@ function tele(coords) end -function AddBoxZoneSingle(name, loc, data) - if Config.Target == 'qb' then - exports['qb-target']:AddBoxZone(name, loc, 1.5, 1.75, {name = name, minZ = loc.z-1,maxZ = loc.z +1}, - { options = { - { - type = data.type or nil, - event = data.event or nil, - action = data.action or nil, - icon = data.icon or "fa-solid fa-eye", - label = data.label, - data = data.data, - canInteract = data.canInteract, - } - }, - distance = 2.0 - }) - elseif Config.Target == 'ox' then - exports.ox_target:addBoxZone({coords = loc, size = vec3(1,1,1), options = { - { - type = data.type or nil, - event = data.event or nil, - onSelect = data.action or nil, - distance = 2.5, - icon = data.icon or "fa-solid fa-eye", - label = data.label, - data = data.data, - canInteract = data.canInteract, - } - }, }) - elseif Config.Target == 'interact' then - exports.interact:AddInteraction({ - coords = vector3(loc.x, loc.y, loc.z), - distance = 2.5, - interactDst = 2, - id = name, - options = { - { - type = data.type or nil, - event = data.event or nil, - onSelect = data.action or nil, - distance = 2.5, - label = data.label, - data = data.data, - canInteract = data.canInteract, - }, - } - }) - end -end - -function AddBoxZoneMulti(name, table, data) - for k, v in pairs (table) do - if v.gang == nil or v.gang == '' or v.gang == "" then v.gang = 1 end - if Config.Target == 'qb' then - exports['qb-target']:AddBoxZone(name .. k, v.loc, 1.5, 1.75, {name = name..k, minZ = v.loc.z-1.50,maxZ = v.loc.z +1.5}, - { options = { - { - type = data.type or nil, - event = data.event or nil, - action = data.action or nil, - icon = data.icon or "fa-solid fa-eye", - label = data.label, - data = k, - canInteract = data.canInteract or function() - if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end - } - }, - distance = 2.5 - }) - elseif Config.Target == 'ox' then - exports.ox_target:addBoxZone({coords = v.loc, size = vec3(1,1,1), options = { - { - type = data.type or nil, - event = data.event or nil, - onSelect = data.action or nil, - icon = data.icon or "fa-solid fa-eye", - label = data.label, - data = k, - distance = 2.5, - canInteract = data.canInteract or function() - if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end - } - }, }) - elseif Config.Target == 'interact' then - exports.interact:AddInteraction({ - coords = vector3(v.loc.x, v.loc.y, v.loc.z), - distance = 2.5, - interactDst = 2, - id = name, - options = { - { - type = data.type or nil, - event = data.event or nil, - action = data.action or nil, - distance = 2.5, - label = data.label or "fa-solid fa-eye", - data = k, - canInteract = data.canInteract or function() - if QBCore.Functions.GetPlayerData().gang.name == v.gang or v.gang == 1 then return true end end - }, - } - }) - end - end -end - -function AddBoxZoneMultiOptions(name, loc, data) - local options = {} - for k, v in pairs (data) do - table.insert(options, { - icon = v.icon or "fa-solid fa-eye", label = v.label, event = v.event or nil, action = v.action or nil, - onSelect = v.action,data = v.data,canInteract = v.canInteract or nil, distance = 2.0, - }) - end - 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 = options, distance = 2.5}) - elseif Config.Target == 'ox' then - exports.ox_target:addBoxZone({coords = loc, size = vec3(1,1,1), options = options }) - elseif Config.Target == 'interact' then - exports.interact:AddInteraction({coords = vector3(loc.x, loc.y, loc.z),distance = 2.5,interactDst = 2,id = name,options = options}) - end -end - - -function AddSingleModel(model, data, num) - if Config.Target == 'qb' then - exports['qb-target']:AddTargetEntity(model, {options = { - {icon = data.icon or "fa-solid fa-eye", label = data.label, event = data.event or nil, action = data.action or nil, data = num } - }, distance = 2.5}) - elseif Config.Target == 'ox' then - exports.ox_target:addLocalEntity(model, {icon = data.icon, label = data.label, event = data.event or nil, onSelect = data.action or nil, data = num, distance = 2.5 }) - elseif Config.Target == 'interact' then - exports.interact:AddLocalEntityInteraction({entity = model,offset = vec3(0.0, 0.0, 1.0),id = 'mddrugs'..model,distance = 2.5,interactDst = 2.5, options = {label = data.label, event = data.event or nil, action = data.action or nil, data = num, distance = 2.5 }}) - end -end - -function AddMultiModel(model, data, num) - local options = {} - for k, v in pairs (data) do - table.insert(options, { - icon = v.icon or "fa-solid fa-eye", label = v.label, event = v.event or nil, action = v.action or nil, - onSelect = v.action,data = v.data,canInteract = v.canInteract or nil, distance = 2.0, - }) - end - if Config.Target == 'qb' then - exports['qb-target']:AddTargetEntity(model, {options = options, distance = 2.5}) - elseif Config.Target == 'ox' then - exports.ox_target:addLocalEntity(model, options) - elseif Config.Target == 'interact' then - local loc = GetEntityCoords(model) - exports.interact:AddLocalEntityInteraction({entity = model,offset = vec3(0.0, 0.0, 1.0),id = 'mddrugss'..model,distance = 2.5,interactDst = 2.5, options = data}) - end -end local created = false local heading = 180.0 @@ -654,14 +500,14 @@ CreateThread(function() TriggerEvent('weed:init') end) -lib.callback.register('md-drugs:client:uncuff', function(data) +ps.registerCallback('md-drugs:client:uncuff', function(data) if not progressbar(data, 4000, 'uncuff') then return end return true end) RegisterCommand('DrugRep', function() if not Config.TierSystem then return end - local rep = lib.callback.await('md-drugs:server:GetRep', false) + local rep = ps.callback('md-drugs:server:GetRep', false) lib.registerContext({ id = 'DrugRep', title = 'Drug Reputation', diff --git a/client/heroin.lua b/client/heroin.lua index 1922e59..716f175 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -71,7 +71,7 @@ RegisterNetEvent("md-drugs:client:buyheroinlabkit", function() TriggerServerEvent("md-drugs:server:getheroinlabkit") end) -lib.callback.register("md-drugs:client:setheroinlabkit", function() +ps.registerCallback("md-drugs:client:setheroinlabkit", function() if herointable then Notify(Lang.Heroin.tableout, 'error') return false @@ -103,7 +103,7 @@ 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 - local done = lib.callback.await('removeCleaningkit', false) + local done = ps.callback('removeCleaningkit', false) if done then dirty = false end end) diff --git a/client/lean.lua b/client/lean.lua index 9b9f903..cb1d07d 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -6,7 +6,7 @@ end) RegisterNetEvent('md-drugs:client:leancraft', function() local store = {} local label = {} -local items = lib.callback.await('md-drugs:server:GetRecipe', false,'lean', 'cups') +local items = ps.callback('md-drugs:server:GetRecipe', false,'lean', 'cups') for k, v in pairs (items) do label = {} local item = '' diff --git a/client/lsd.lua b/client/lsd.lua index 04c22da..01bf9af 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -4,41 +4,169 @@ local function createLabKit(coord, head) local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) SetEntityHeading(labkit, head) PlaceObjectOnGroundProperly(labkit) + FreezeEntityPosition(labkit, true) + tableout = true local options = { - { event = "md-drugs:client:heatliquid", icon = "fa-solid fa-temperature-high", label = Lang.targets.lsd.heat, data = labkit, canInteract = function() if not dirtylsd then return true end end }, - { event = "md-drugs:client:refinequalityacid", icon = "fa-solid fa-temperature-high", label = Lang.targets.lsd.refine, data = labkit,canInteract = function() if not dirtylsd then return true end end }, - { event = "md-drugs:client:maketabpaper", icon = "fa-regular fa-note-sticky", label = Lang.targets.lsd.dab, data = labkit, canInteract = function() if not dirtylsd then return true end end }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if not dirtylsd then return true end end }, - {icon = "fa-solid fa-hand-sparkles", label = Lang.targets.lsd.clean, data = labkit, + { + icon = "fa-solid fa-temperature-high", + label = Lang.targets.lsd.heat, action = function() - if not ItemCheck('cleaningkit') then return end - if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end - local check = lib.callback.await('md-drugs:server:removecleaningkit') - if check then + local dict = "scr_ie_svm_technical2" + if not ps.hasItems({ + {name = 'lysergic_acid', amount = 1}, + {name = 'diethylamide', amount = 1} + }) then + Notify(Lang.lsd.need, 'error') + return + end + if not minigame() then + dirtylsd = true + loadParticle(dict) + local exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", labkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) + SetParticleFxLoopedAlpha(exitPtfx, 3.0) + return + end + if not progressbar(Lang.lsd.heat, 7000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:heatliquid") + end, + canInteract = function() + if not dirtylsd then return true end + end + }, + { + icon = "fa-solid fa-temperature-high", + label = Lang.targets.lsd.refine, + action = function() + if not ps.hasItem('lsd_one_vial') then return end + if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end + if not ps.progressbar(Lang.lsd.refine, 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:refinequalityacid") + end, + canInteract = function() + if not dirtylsd then return true end + end + }, + { + icon = "fa-regular fa-note-sticky", + label = Lang.targets.lsd.dab, + action = function() + if not ps.hasItem('tab_paper') then return end + if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end + if not ps.progressbar(Lang.lsd.dip, 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:maketabpaper") + end, + canInteract = function() + if not dirtylsd then return true end + end + }, + { + event = "md-drugs:client:getlabkitback", + icon = "fas fa-box-circle-check", + label = Lang.targets.lsd.back, + action = function() + if not progressbar(Lang.lsd.tablepack, 4000, 'uncuff') then return end + DeleteObject(labkit) + TriggerServerEvent('md-drugs:server:getlabkitback') + tableout = false + end, + canInteract = function() + if not dirtylsd then return true end + end + }, + { + icon = "fa-solid fa-hand-sparkles", + label = Lang.targets.lsd.clean, + action = function() + if not ps.hasItem('cleaningkit') then + Notify(Lang.lsd.needclean, 'error') + return + end + if not ps.progressbar(Lang.lsd.clean, 4000, 'clean') then return end + local check = ps.callback('md-drugs:server:removecleaningkit') + if check then dirtylsd = false end end, canInteract = function() if dirtylsd then return true end end } } - AddMultiModel(labkit, options, labkit) + ps.targetEntity(labkit, options) end -RegisterNetEvent("md-drugs:client:getlysergic", function(data) - if not minigame() then return end - if not progressbar(Lang.lsd.steallys, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:getlysergic",data.data) -end) +for k, v in pairs (GlobalState.MDDrugsLocs.lysergicacid) do + ps.boxTarget('lysergicacid'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = Lang.targets.lsd.lys, + icon = 'fa-solid fa-temperature-high', + action = function() + if not ps.hasItem('empty_weed_bag') then return end + if not minigame() then TriggerServerEvent("md-drugs:server:faillysergic") return end + if not ps.progressbar(Lang.lsd.steallys, 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:getlysergic", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end +for k, v in pairs (GlobalState.MDDrugsLocs.diethylamide) do + ps.boxTarget('diethylamide'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = Lang.targets.lsd.die, + icon = 'fa-solid fa-temperature-high', + action = function() + if not ps.hasItem('empty_weed_bag') then return end + if not minigame() then TriggerServerEvent("md-drugs:server:faildiethylamide") return end + if not ps.progressbar(Lang.lsd.stealdie, 4000, 'uncuff') then return end + TriggerServerEvent("md-drugs:server:getdiethylamide", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end -RegisterNetEvent("md-drugs:client:getdiethylamide", function(data) - if not minigame() then return end - if not progressbar(Lang.lsd.stealdie, 4000, 'uncuff') then return end - TriggerServerEvent('md-drugs:server:getdiethylamide', data.data) -end) +for k,v in pairs (GlobalState.MDDrugsLocs.gettabs) do + ps.boxTarget('gettabs'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = Lang.targets.lsd.buyt, + icon = 'fa-solid fa-hand-holding-dollar', + action = function() + if not ps.hasItem('lsdlabkit') then ps.notify(Lang.lsd.havlabkit, 'error') return end + TriggerEvent("md-drugs:client:buytabs", k) + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end +for k, v in pairs (GlobalState.MDDrugsLocs.buykit) do + ps.boxTarget('buykit'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, { + { + label = Lang.targets.lsd.buy, + icon = 'fa-solid fa-hand-holding-dollar', + action = function() + if ps.hasItem('lsdlabkit') then ps.notify(Lang.lsd.havlabkit, 'error') return end + if not ps.progressbar(Lang.lsd.buykit, 4000, 'uncuff') then return end + TriggerEvent("md-drugs:client:buylabkit") + end, + canInteract = function() + if not handleGang(v.gang) then return false end + return true + end + } + }) +end -lib.callback.register("md-drugs:client:setlsdlabkit", function() +ps.registerCallback("md-drugs:client:setlsdlabkit", function() if tableout then Notify(Lang.lsd.tableout, 'error') return false @@ -50,54 +178,4 @@ lib.callback.register("md-drugs:client:setlsdlabkit", function() createLabKit(loc, head) return true, loc end -end) - -RegisterNetEvent("md-drugs:client:getlabkitback", function(data) - if not progressbar(Lang.lsd.tablepack, 4000, 'uncuff') then return end - DeleteObject(data.data) - TriggerServerEvent('md-drugs:server:getlabkitback') - tableout = false -end) - -RegisterNetEvent("md-drugs:client:heatliquid", function(data) - local PedCoords, head = GetEntityCoords(data.data), GetEntityHeading(data.data) - local dict = "scr_ie_svm_technical2" - if not ItemCheck('lysergic_acid') then return end - if not ItemCheck('diethylamide') then return end - if not minigame() then - dirtylsd = true - loadParticle(dict) - local exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", data.data, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) - SetParticleFxLoopedAlpha(exitPtfx, 3.0) - Wait(100) - AddMultiModel(dirtylabkit, {{event = "md-drugs:client:cleanlabkit", icon = "fa-solid fa-hand-sparkles", label = Lang.targets.lsd.clean, data = dirtylabkit}}, nil ) - return end - if not progressbar(Lang.lsd.heat, 7000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:heatliquid") -end) - - -RegisterNetEvent("md-drugs:client:refinequalityacid", function() - if not ItemCheck('lsd_one_vial') then return end - if not minigame() then TriggerServerEvent("md-drugs:server:failrefinequality") return end - if not progressbar(Lang.lsd.refine, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:refinequalityacid") -end) - -RegisterNetEvent("md-drugs:client:maketabpaper", function() - if not ItemCheck('tab_paper') then return end - if not minigame() then TriggerServerEvent("md-drugs:server:failtabs") return end - if not progressbar(Lang.lsd.dip, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:maketabpaper") -end) - -RegisterNetEvent("md-drugs:client:buytabs", function(data) - if not progressbar(Lang.lsd.buypaper, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:gettabpaper", data.data) -end) - -RegisterNetEvent("md-drugs:client:buylabkit", function() - if hasItem('lsdlabkit') then Notify(Lang.lsd.hav, 'error') return end - if not progressbar(Lang.lsd.buykit, 4000, 'uncuff') then return end - TriggerServerEvent("md-drugs:server:getlabkit") -end) +end) \ No newline at end of file diff --git a/client/meth.lua b/client/meth.lua index 4aeba44..c43f2ef 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -82,7 +82,7 @@ CreateThread(function() end) CreateThread(function() - local config = lib.callback.await('md-drugs:server:getLocs', false) + local config = ps.callback('md-drugs:server:getLocs', false) AddBoxZoneSingle("methTeleOut",config.singleSpot.MethTeleIn, {name = 'teleout', icon = "fa-solid fa-door-open", label = Lang.targets.meth.enter, action = function() SetEntityCoords(PlayerPedId(), config.singleSpot.MethTeleOut) end} ) AddBoxZoneSingle("methtelein",config.singleSpot.MethTeleOut, {name = 'teleout', icon = "fa-solid fa-door-closed", label = Lang.targets.meth.exit, action = function() SetEntityCoords(PlayerPedId(), config.singleSpot.MethTeleIn) end} ) local options = { diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 0bbaf35..c41161e 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -2,9 +2,9 @@ local carryPackage = nil RegisterNetEvent("md-drugs:client:GetOxyCar", function() lib.requestModel("burrito3", Config.RequestModelTime) - local paid = lib.callback.await('md-drugs:server:payfortruck', false) + local paid = ps.callback('md-drugs:server:payfortruck', false) if not paid then return end - local loca = lib.callback.await('md-drugs:server:getLocs', false) + local loca = ps.callback('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) @@ -15,7 +15,7 @@ RegisterNetEvent("md-drugs:client:GetOxyCar", function() end) RegisterNetEvent("md-drugs:client:getoxylocationroute", function() - local config = lib.callback.await('md-drugs:server:getLocs', false) + local config = ps.callback('md-drugs:server:getLocs', false) local loc = config.oxylocations[math.random(#config.oxylocations)] if loc ~= nil then SetNewWaypoint(loc.x, loc.y) diff --git a/client/pedspawns.lua b/client/pedspawns.lua index 0fd9675..f1e2375 100644 --- a/client/pedspawns.lua +++ b/client/pedspawns.lua @@ -1,7 +1,7 @@ CreateThread(function() - local config = lib.callback.await('md-drugs:server:getLocs', false) - local num = lib.callback.await('md-drugs:server:GetMerchant', false) + local config = ps.callback('md-drugs:server:getLocs', false) + local num = ps.callback('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) diff --git a/client/pharma.lua b/client/pharma.lua index b3b225c..59aa46f 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,5 +1,5 @@ -lib.callback.register("md-drugs:client:prescriptionpad", function(data, op) +ps.registerCallback("md-drugs:client:prescriptionpad", function(data, op) if getJobType() ~= 'ems' then return end local input = lib.inputDialog('Who To Give A Prescription To?',{ {type = 'select', label = 'Player Name', options = data}, @@ -14,7 +14,7 @@ RegisterNetEvent("md-drugs:client:fillprescription", function(data) TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) -lib.callback.register("md-drugs:client:unbottle", function() +ps.registerCallback("md-drugs:client:unbottle", function() if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end return true end) diff --git a/client/target.lua b/client/target.lua deleted file mode 100644 index d046d46..0000000 --- a/client/target.lua +++ /dev/null @@ -1,24 +0,0 @@ - -CreateThread(function() - local config = lib.callback.await('md-drugs:server:getLocs', false) - if not config then print('Yo Dawg You Broke Your Locations.lua') return end - AddBoxZoneSingle('telecokein', config.singleSpot.CokeTeleIn, {action = function()tele(config.singleSpot.CokeTeleOut)end, icon = 'fa-solid fa-door-open', label = Lang.targets.coke.enter}) -- coke - AddBoxZoneSingle('telecokeout', config.singleSpot.CokeTeleOut, {action = function()tele(config.singleSpot.CokeTeleIn) end, icon = "fa-solid fa-door-closed", label = Lang.targets.coke.exit}) -- coke - AddBoxZoneMulti('makepowder', config.MakePowder, {event = "md-drugs:client:makepowder", icon = "fa-solid fa-scissors", label = Lang.targets.coke.chop}) -- coke - AddBoxZoneMulti('steallysergic', config.lysergicacid, {event = "md-drugs:client:getlysergic", icon = "fa-solid fa-prescription-bottle", label = Lang.targets.lsd.lys}) -- lsd - AddBoxZoneMulti('stealdiethylamide', config.diethylamide, {event = "md-drugs:client:getdiethylamide", icon = "fa-solid fa-prescription-bottle", label = Lang.targets.lsd.die}) -- lsd - AddBoxZoneMulti('gettabs', config.gettabs, {event = "md-drugs:client:buytabs", icon = "fa-solid fa-eye-dropper", label = Lang.targets.lsd.buyt}) -- lsd - AddBoxZoneMulti('dryheroin', config.dryplant, {event = "md-drugs:client:dryplant", icon = "fa-solid fa-temperature-full", label = Lang.targets.heroin.dry}) -- heroin - AddBoxZoneMulti('cutheroin', config.cutheroinone, {event = "md-drugs:client:cutheroin", icon = "fa-solid fa-flask", label = Lang.targets.heroin.cut}) -- heroin - AddBoxZoneMulti('fillneedle', config.fillneedle, {event = "md-drugs:client:fillneedle", icon = "fa-solid fa-syringe", label = Lang.targets.heroin.fill}) -- heroin - AddBoxZoneMulti('makecrack', config.makecrack, {event = "md-drugs:client:makecrackone", icon = "fa-solid fa-temperature-high", label = Lang.targets.crack.cook}) -- crack - AddBoxZoneMulti('bagcrack', config.bagcrack, {event = "md-drugs:client:bagcrack", icon = "fa-solid fa-weight-scale", label = Lang.targets.crack.bag}) -- crack - AddBoxZoneMulti('fillprescription', config.FillPrescription, {event = "md-drugs:client:fillprescription", icon = "fa-solid fa-prescription", label = Lang.targets.pha.fill}) -- pharma - AddBoxZoneSingle('payfortruck', config.singleSpot.Payfortruck, {event = "md-drugs:client:GetOxyCar", icon = "fa-solid fa-truck-moving", label = Lang.targets.oxy.pay}) -- oxy runs - AddBoxZoneSingle('drymescaline', config.singleSpot.DryOut, {event = "md-drugs:client:drymescaline", icon = "fa-solid fa-temperature-full", label = Lang.targets.mescaline.dry}) -- mescaline - AddBoxZoneMulti('stealisosafrole', config.isosafrole, {event = "md-drugs:client:stealisosafrole", icon = "fa-solid fa-vial", label = Lang.targets.xtc.iso}) -- xtc - AddBoxZoneMulti('stealmdp2p', config.mdp2p, {event = "md-drugs:client:stealmdp2p", icon = "fa-solid fa-vial", label = Lang.targets.xtc.mdp}) -- xtc - AddBoxZoneMulti('rawxtcloc', config.rawxtcloc, {event = "md-drugs:client:makingrawxtc", icon = "fa-solid fa-tablets", label = Lang.targets.xtc.raw}) -- xtc - AddBoxZoneSingle('buypress', config.singleSpot.buypress, {event = "md-drugs:client:buypress", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.xtc.press}) -- xtc - AddBoxZoneMulti('stamp', config.stamp, {event = "md-drugs:client:stampwhite", icon = "fa-solid fa-tablets", label = Lang.targets.xtc.stamp}) -- xtc -end) diff --git a/client/weed.lua b/client/weed.lua index 0be6270..5b8370a 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -54,7 +54,7 @@ AddEventHandler('onResourceStop', function(resourceName) end) CreateThread(function() - local config = lib.callback.await('md-drugs:server:getLocs', false) + local config = ps.callback('md-drugs:server:getLocs', false) AddBoxZoneMulti('weeddry', config.WeedDry, { name = 'dryweed', icon = "fas fa-sign-in-alt", @@ -147,7 +147,7 @@ end) local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) local options = {} - local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed',tableName) + local items = ps.callback('md-drugs:server:GetRecipe', false,'weed',tableName) for k, v in pairs(items) do local label = {} local item = '' diff --git a/client/xtc.lua b/client/xtc.lua index 2b2cb5f..9699339 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -22,7 +22,7 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) end end) -lib.callback.register('md-drugs:client:setpress', function(type) +ps.registerCallback('md-drugs:client:setpress', function(type) if xtcpress then Notify(Lang.xtc.out, 'error') return false diff --git a/clientRun.lua b/clientRun.lua new file mode 100644 index 0000000..5e816ee --- /dev/null +++ b/clientRun.lua @@ -0,0 +1,27 @@ +function loadFile(filePath) + local resourceName = 'md-drugs' + local fullScript = LoadResourceFile(resourceName, filePath) + if not fullScript then + ps.error("Error: Failed to load module '" .. filePath .. "' from resource '" .. resourceName .. "'.") + return false + end + local chunk, err = load(fullScript, filePath, "t") + if not chunk then + ps.error("Error loading Lua chunk from '" .. filePath .. "': " .. tostring(err)) + return false + end + + local success, execErr = pcall(chunk) + if not success then + ps.error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) + return false + end + ps.success("Successfully loaded module '" .. filePath .. "' from resource '" .. resourceName .. "'.") + return true +end + +for scriptName, toggle in pairs(Config.Drugs) do + if not toggle then goto continue end + loadFile('client/' .. scriptName .. '.lua') + ::continue:: +end \ No newline at end of file diff --git a/fxmanifest.lua b/fxmanifest.lua index 153a10e..6720e30 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -5,26 +5,30 @@ fx_version "cerulean" game "gta5" version '3.9.0' client_scripts { - 'client/**.lua', + 'client/functions.lua', + 'client/animationsandfunctions.lua', + 'clientRun.lua', } server_scripts { 'server/functions.lua', - 'server/**.lua', + 'serverRun.lua', '@oxmysql/lib/MySQL.lua', } shared_scripts { - 'shared/config.lua', - '@ox_lib/init.lua', 'shared/**.lua', + '@ox_lib/init.lua', } lua54 'yes' files { 'stream/mushroom.ytyp', - 'stream/mushroom.ydr' + 'stream/mushroom.ydr', + 'client/**.lua', + 'server/**.lua', + 'locales/**.lua' } data_file 'DLC_ITYP_REQUEST' 'stream/mushroom.ytyp' diff --git a/shared/english.lua b/locales/en.lua similarity index 96% rename from shared/english.lua rename to locales/en.lua index ffe3865..febdf07 100644 --- a/shared/english.lua +++ b/locales/en.lua @@ -1,296 +1,298 @@ -Lang = {} - -Lang.targets = { - coke = { - pick = 'Pick Cocaine', - cut = 'Cut Cocaine', - bag = 'Bag Cocaine', - enter = 'Enter Building', - exit = 'Exit Building', - chop = 'Chop Coca Leaves', - - }, - CornerSell = { - sell = 'Sell %s Of %s For $%s', - deny = 'Deny Price' - }, - crack = { - cook = 'Cook Crack', - bag = 'Bag Crack' - }, - Delivery = { - Deliver = 'Deliver For %s', - open = 'Open %s Shop', - hand = 'Hand Over' - }, - heroin = { - pick = 'Pick Poppies', - up = 'Pick Up Table', - dry = 'Dry Poppies', - cut = 'Cut Heroin', - cook = 'Cook Heroin', - kit = 'Buy Heroin Lab Kit', - clean = 'Clean Table', - fill = 'Fill Syringe', - vial = 'Make Vial', - }, - lean = { - git = 'Get Task', - st = 'Steal From Car' - }, - lsd = { - buy = 'Buy LSD Lab Kit', - heat = 'Heat Liquid', - refine = 'Refine Quality', - paper = 'Make Tab Paper', - back = 'Pick Up Lab Kit', - dab = 'Dab LSD on sheets', - clean = 'Clean Table', - lys = 'Steal Lysergic Acid', - die = 'Steal Diethylamide', - buyt = 'Buy Tabs', - }, - mescaline = { - pick = 'Pick Cactus', - dry = 'Dry Out Cactus', - }, - meth = { - bag = 'Bag Up Meth', - enter = 'Enter Buidling', - exit = 'Exit Building', - cook = 'Cook Meth', - tray = 'Grab Tray', - box = 'Box Up Meth', - adjust = 'Adjust Temperature', - eph = 'Steal Ephedrine', - ace = 'Steal Acetone', - mission = 'Get Mission', - stealfromcar = 'Steal From Car', - }, - oxy = { - pack = 'Get Oxy Package', - talk = 'Talk To Buyer', - pay = 'Pay For Truck', - }, - pha = { - fill = 'Fill Prescription', - }, - shrooms = { - pick = 'Pick Shrooms', - }, - travel = { - travel = 'Open Travelling Merchant', - }, - xtc = { - iso = 'Steal Isosafrole', - mdp = 'Steal MDP2P', - raw = 'Make Raw XTC', - press = 'Buy XTC Press', - stamp = 'Stamp Pills', - make = 'Make XTC', - pick = 'Pick Up Press', - }, - weed = { - pick = 'Pick Weed', - dry = 'Dry Weed', - dpick = 'Pick Dried Weed', - butt = 'Open Edible Menu', - oil = 'Make Oil' - }, - Wholesale = { - talk = 'Talk To Buyer' - }, - -} - -Lang.Coke = { - -- client side progressbars - picking = "Picking Leaves", - makepow = 'Chopping Leaves Into A Powder', - cutting = 'Cutting Coke With Baking Soda', - bagging = "Bilbo Baggins This Bitch", - -- end progressbars - cut = "You Cut Some Coke", - nocutcoke = "You Cant Cut Coke With No Coke Idiot", - bagcoke = "You Bagged Up Coke", - nobagcoke = "You Cant Bag Up Coke Without Coke Idiot", -} -Lang.Crack = { - --client side - cookcrack = "Cooking Some Crack", - bagcrack = 'Bilbo Baggin This Bitch', - -- server - makecrack = 'Nice Crack', - nocoke = 'You Cant Make This Without Coke' -} -Lang.Cornerselling = { - -- client side notifys - inveh = 'STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', - toofar = "To Far From Your Corner Homie", - selling = 'Selling %s For $%s', - deny = "Fuck That Offer", - start = "Get That Paper", - stop = "Lazy Ass Cant Even Sell Drugs", - nodrugs = "What You Gonna sell? Air?", - notcops = "Not Enough Cops", - no = 'You Cant Sell Drugs Here!', - -- end client side notifys - -- progressbars - sell = "Selling Drugs", -} -Lang.Delivery = { - -- client side - emailn = 'Not A Drug Dealer', - emailsub = 'Hurry Up And Get The Package To The Buyer', - emailcon = 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring %s Of %s', - search = "Searching For A Delivery ...", - none = "Nothing Close By", - busy = "You Havent Even Finished The One I Told You Too", - found = "Marked On Your Map", - already = "Already Deliverying", - checkrep = "Current Dealer Rep: ", - -- progressbars - pack = 'Handing Off Package', - -- end client side -} - -Lang.Heroin = { - --client - pick = " Picking Poppies Up", - tableout = 'You Already Have A Table Out', - dryout = "Drying Out Poppies", - cutting = "Cutting Heroin With Baking Soda", - secret = "SHHHHHHHHH", - table = "Placing Table Down", - success = "Heated Heroin Properly", - clean = 'Cleaning Heroin Table', - needles = 'Filling Syringe', - pickup = 'Picking Up The Heroin Table', - -- - cutheroin = 'You Made Some Cut Heroin', - noheroin = "How Can You Cut Heroin Without Heroin Idiot", - vial = 'You Made A Vial Of Heroin', - novial = "How Can You Make Heroin Vials Without Heroin Idiot", - fail = 'You Over Heated Them Idiot', - fill = 'Filled The Syringe', - nofill = 'How Are You Going To Fill Needles Of Heroin Without Heroin', - haskit = 'You Already Have A Heroin Lab Kit' -} -Lang.Lean = { - marked = ' Car Has Been Marked On Your Map', - lean = 'You Got Purple Lean', - dextro = ' You Got Red Dextro', - act = 'You Already Have A Lean Task', -} - -Lang.lsd = { - steallys = 'Stealing Lysergic Acid', - stealdie = 'Stealing Lysergic Acid', - tableout = 'You Already Have A Table Out', - tablepack = 'Packing Table Up', - heat = 'Heating Up Liquids', - clean = 'Cleaning The Table', - refine = 'Refining The Quality', - dip = 'Dipping LSD On The Paper', - buypaper = 'Buying Tab Paper', - buykit = 'Buying Lab Kit', - place = 'Placing Table Down', - hav = 'You Already Have A Table', - -- server - lys = 'You Got Lysergic Acid', - die = 'You Got Diethylamide', - cleaned = 'You Cleaned It Perfectly', - madelsd = 'You Made LSD!', - failed = 'You Over Heated Them Idiot', - refined = 'You Refined Them!', - broke = 'Your Broke Ass Cant Afford these!', - novial = 'No LSD Vials Idiot', -} -Lang.mescaline = { - pick = "Picking Cactus", - dry = 'Drying Out Cactus', - nocactus = 'No Cactus Bulbs', - eat = 'eating mescaline' -} - -Lang.meth = { - inside = 'Stuff Inside Already', - increaseheat = 'Increasing Heat', - mission = 'Car Has Been Marked On Your Map', - ace = 'You Got Some Acetone', - eph = 'You Got Some Ephedrine', - mix = 'Adding Things To The Mix', - nobag = 'No Bags', - act = 'You Already Have A Meth Task', -} - -Lang.oxy = { - truck = 'Your Truck Is Here', - cantcarry = 'You Aint That Strong, You Can Only Carry One', - hand = 'Handing Over oxy', - empty = 'You Cant Be Empty Handed Idiot', - broke = 'Your Broke Ass Cant Afford This', - hot = 'Car Is Hot Dump It Now', - next = 'Get To the Next Location' -} - -Lang.Pharma = { - notems = 'You Are Not A Medical Person', - write = 'Writing Prescription', - fill = 'Filling Prescription', - open = 'Opening Bottle', - pills = 'You Got Some Pills!', - no = 'You Dont Have A Prescription' -} - -Lang.Shrooms = { - pick = 'Picking Shrooms', - eat = 'Eating Shrooms', - trip = 'Have A Good Trip!' -} - -Lang.Weed = { - pick = 'Harvesting Weed', - busy = 'Already Drying One Out', - canna = 'Making Canna-butter', - brown = 'Making Special Brownies', - cook = 'Making Special Cookies', - Choc = 'Making Special Chocolate', - muff = 'Making Special Muffin', - stovehot = 'Stove Is Too Hot Wait 30 Seconds To Cool Down', - shat = 'Making Shatter', - roll = 'Rolling Blunts', - wait = 'Wait A Little Bit For To Drive', - take = 'Taking Down The Weed', - -- - nodry = 'You Need Wet Cannabis To Dry', - noweed = 'Cant Roll A Blunt With Air', - noshat = 'You Need Shatter To Do A Dab', - notorch = 'You Need A butane Torch' -} - -Lang.xtc = { - out = 'You Have A Press Out Already', - pressing = 'Pressing Pills', - raw = 'Making Raw XTC', - mdp2p = 'Stealing MDP2P', - iso = 'Stealing Isosafrole', - fail = 'Dude Its A Circle Not Rocket Science', - pickup = 'Picking Up The Press', - stamp = 'Stamping %s Pills', - buyp = "Buying Press", - -- - cash = 'I need 20k In Cash', - press = { - title = {single = 'Single Press', dual = 'Dual Press', triple = 'Triple Press', quad = 'Quad Press'}, - des = {single ='Buy a single press for 20k', dual = '20 of each unstamped single stack pill and your single press ', - triple = '50 of each unstamped dual stack pill and your dual press ', quad = '150 of each unstamped Triple stack pill and your triple press' - } - } -} - -Lang.Wholesale = { - al = 'You Already Have A Delivery To Make', - na = 'No One Answered, Try Again Later', - -} +Lang = {} + +Lang.targets = { + coke = { + pick = 'Pick Cocaine', + cut = 'Cut Cocaine', + bag = 'Bag Cocaine', + enter = 'Enter Building', + exit = 'Exit Building', + chop = 'Chop Coca Leaves', + + }, + CornerSell = { + sell = 'Sell %s Of %s For $%s', + deny = 'Deny Price' + }, + crack = { + cook = 'Cook Crack', + bag = 'Bag Crack' + }, + Delivery = { + Deliver = 'Deliver For %s', + open = 'Open %s Shop', + hand = 'Hand Over' + }, + heroin = { + pick = 'Pick Poppies', + up = 'Pick Up Table', + dry = 'Dry Poppies', + cut = 'Cut Heroin', + cook = 'Cook Heroin', + kit = 'Buy Heroin Lab Kit', + clean = 'Clean Table', + fill = 'Fill Syringe', + vial = 'Make Vial', + }, + lean = { + git = 'Get Task', + st = 'Steal From Car' + }, + lsd = { + buy = 'Buy LSD Lab Kit', + heat = 'Heat Liquid', + refine = 'Refine Quality', + paper = 'Make Tab Paper', + back = 'Pick Up Lab Kit', + dab = 'Dab LSD on sheets', + clean = 'Clean Table', + lys = 'Steal Lysergic Acid', + die = 'Steal Diethylamide', + buyt = 'Buy Tabs', + }, + mescaline = { + pick = 'Pick Cactus', + dry = 'Dry Out Cactus', + }, + meth = { + bag = 'Bag Up Meth', + enter = 'Enter Buidling', + exit = 'Exit Building', + cook = 'Cook Meth', + tray = 'Grab Tray', + box = 'Box Up Meth', + adjust = 'Adjust Temperature', + eph = 'Steal Ephedrine', + ace = 'Steal Acetone', + mission = 'Get Mission', + stealfromcar = 'Steal From Car', + }, + oxy = { + pack = 'Get Oxy Package', + talk = 'Talk To Buyer', + pay = 'Pay For Truck', + }, + pha = { + fill = 'Fill Prescription', + }, + shrooms = { + pick = 'Pick Shrooms', + }, + travel = { + travel = 'Open Travelling Merchant', + }, + xtc = { + iso = 'Steal Isosafrole', + mdp = 'Steal MDP2P', + raw = 'Make Raw XTC', + press = 'Buy XTC Press', + stamp = 'Stamp Pills', + make = 'Make XTC', + pick = 'Pick Up Press', + }, + weed = { + pick = 'Pick Weed', + dry = 'Dry Weed', + dpick = 'Pick Dried Weed', + butt = 'Open Edible Menu', + oil = 'Make Oil' + }, + Wholesale = { + talk = 'Talk To Buyer' + }, + +} + +Lang.Coke = { + -- client side progressbars + picking = "Picking Leaves", + makepow = 'Chopping Leaves Into A Powder', + cutting = 'Cutting Coke With Baking Soda', + bagging = "Bilbo Baggins This Bitch", + -- end progressbars + cut = "You Cut Some Coke", + nocutcoke = "You Cant Cut Coke With No Coke Idiot", + bagcoke = "You Bagged Up Coke", + nobagcoke = "You Cant Bag Up Coke Without Coke Idiot", +} +Lang.Crack = { + --client side + cookcrack = "Cooking Some Crack", + bagcrack = 'Bilbo Baggin This Bitch', + -- server + makecrack = 'Nice Crack', + nocoke = 'You Cant Make This Without Coke' +} +Lang.Cornerselling = { + -- client side notifys + inveh = 'STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', + toofar = "To Far From Your Corner Homie", + selling = 'Selling %s For $%s', + deny = "Fuck That Offer", + start = "Get That Paper", + stop = "Lazy Ass Cant Even Sell Drugs", + nodrugs = "What You Gonna sell? Air?", + notcops = "Not Enough Cops", + no = 'You Cant Sell Drugs Here!', + -- end client side notifys + -- progressbars + sell = "Selling Drugs", +} +Lang.Delivery = { + -- client side + emailn = 'Not A Drug Dealer', + emailsub = 'Hurry Up And Get The Package To The Buyer', + emailcon = 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring %s Of %s', + search = "Searching For A Delivery ...", + none = "Nothing Close By", + busy = "You Havent Even Finished The One I Told You Too", + found = "Marked On Your Map", + already = "Already Deliverying", + checkrep = "Current Dealer Rep: ", + -- progressbars + pack = 'Handing Off Package', + -- end client side +} + +Lang.Heroin = { + --client + pick = " Picking Poppies Up", + tableout = 'You Already Have A Table Out', + dryout = "Drying Out Poppies", + cutting = "Cutting Heroin With Baking Soda", + secret = "SHHHHHHHHH", + table = "Placing Table Down", + success = "Heated Heroin Properly", + clean = 'Cleaning Heroin Table', + needles = 'Filling Syringe', + pickup = 'Picking Up The Heroin Table', + -- + cutheroin = 'You Made Some Cut Heroin', + noheroin = "How Can You Cut Heroin Without Heroin Idiot", + vial = 'You Made A Vial Of Heroin', + novial = "How Can You Make Heroin Vials Without Heroin Idiot", + fail = 'You Over Heated Them Idiot', + fill = 'Filled The Syringe', + nofill = 'How Are You Going To Fill Needles Of Heroin Without Heroin', + haskit = 'You Already Have A Heroin Lab Kit' +} +Lang.Lean = { + marked = ' Car Has Been Marked On Your Map', + lean = 'You Got Purple Lean', + dextro = ' You Got Red Dextro', + act = 'You Already Have A Lean Task', +} + +Lang.lsd = { + steallys = 'Stealing Lysergic Acid', + stealdie = 'Stealing Lysergic Acid', + tableout = 'You Already Have A Table Out', + tablepack = 'Packing Table Up', + heat = 'Heating Up Liquids', + clean = 'Cleaning The Table', + refine = 'Refining The Quality', + dip = 'Dipping LSD On The Paper', + buypaper = 'Buying Tab Paper', + buykit = 'Buying Lab Kit', + place = 'Placing Table Down', + hav = 'You Already Have A Table', + -- server + lys = 'You Got Lysergic Acid', + die = 'You Got Diethylamide', + cleaned = 'You Cleaned It Perfectly', + madelsd = 'You Made LSD!', + failed = 'You Over Heated Them Idiot', + refined = 'You Refined Them!', + broke = 'Your Broke Ass Cant Afford these!', + novial = 'No LSD Vials Idiot', +} +Lang.mescaline = { + pick = "Picking Cactus", + dry = 'Drying Out Cactus', + nocactus = 'No Cactus Bulbs', + eat = 'eating mescaline' +} + +Lang.meth = { + inside = 'Stuff Inside Already', + increaseheat = 'Increasing Heat', + mission = 'Car Has Been Marked On Your Map', + ace = 'You Got Some Acetone', + eph = 'You Got Some Ephedrine', + mix = 'Adding Things To The Mix', + nobag = 'No Bags', + act = 'You Already Have A Meth Task', +} + +Lang.oxy = { + truck = 'Your Truck Is Here', + cantcarry = 'You Aint That Strong, You Can Only Carry One', + hand = 'Handing Over oxy', + empty = 'You Cant Be Empty Handed Idiot', + broke = 'Your Broke Ass Cant Afford This', + hot = 'Car Is Hot Dump It Now', + next = 'Get To the Next Location' +} + +Lang.Pharma = { + notems = 'You Are Not A Medical Person', + write = 'Writing Prescription', + fill = 'Filling Prescription', + open = 'Opening Bottle', + pills = 'You Got Some Pills!', + no = 'You Dont Have A Prescription' +} + +Lang.Shrooms = { + pick = 'Picking Shrooms', + eat = 'Eating Shrooms', + trip = 'Have A Good Trip!' +} + +Lang.Weed = { + pick = 'Harvesting Weed', + busy = 'Already Drying One Out', + canna = 'Making Canna-butter', + brown = 'Making Special Brownies', + cook = 'Making Special Cookies', + Choc = 'Making Special Chocolate', + muff = 'Making Special Muffin', + stovehot = 'Stove Is Too Hot Wait 30 Seconds To Cool Down', + shat = 'Making Shatter', + roll = 'Rolling Blunts', + wait = 'Wait A Little Bit For To Drive', + take = 'Taking Down The Weed', + -- + nodry = 'You Need Wet Cannabis To Dry', + noweed = 'Cant Roll A Blunt With Air', + noshat = 'You Need Shatter To Do A Dab', + notorch = 'You Need A butane Torch' +} + +Lang.xtc = { + out = 'You Have A Press Out Already', + pressing = 'Pressing Pills', + raw = 'Making Raw XTC', + mdp2p = 'Stealing MDP2P', + iso = 'Stealing Isosafrole', + fail = 'Dude Its A Circle Not Rocket Science', + pickup = 'Picking Up The Press', + stamp = 'Stamping %s Pills', + buyp = "Buying Press", + -- + cash = 'I need 20k In Cash', + press = { + title = {single = 'Single Press', dual = 'Dual Press', triple = 'Triple Press', quad = 'Quad Press'}, + des = {single ='Buy a single press for 20k', dual = '20 of each unstamped single stack pill and your single press ', + triple = '50 of each unstamped dual stack pill and your dual press ', quad = '150 of each unstamped Triple stack pill and your triple press' + } + } +} + +Lang.Wholesale = { + al = 'You Already Have A Delivery To Make', + na = 'No One Answered, Try Again Later', + +} + +return Lang \ No newline at end of file diff --git a/server/cocaine.lua b/server/cocaine.lua index 626da99..0c5100a 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -50,9 +50,8 @@ end) RegisterServerEvent('md-drugs:server:makepowder', function(num) local src = source - ps.debug(#(GetEntityCoords(GetPlayerPed(src)) - GlobalState.MDDrugsLocs.MakePowder[num].loc)) if not ps.checkDistance(src, GlobalState.MDDrugsLocs.MakePowder[num].loc, 3.5) then - Notifys(src, 'You are not in the correct location', 'error') + ps.notify(src, 'You are not in the correct location', 'error') return end local tier = 'tier1' @@ -71,7 +70,7 @@ RegisterServerEvent('md-drugs:server:cutcokeone', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, GlobalState.MDDrugsLocs.CuttingCoke[num].loc, 2.5) then - Notifys(src, 'You are not in the correct location', 'error') + ps.notify(src, 'You are not in the correct location', 'error') return end if Config.TierSystem then @@ -94,7 +93,7 @@ RegisterServerEvent('md-drugs:server:bagcoke', function(num) local src = source local tier = 'tier1' if not ps.checkDistance(src, GlobalState.MDDrugsLocs.BaggingCoke[num].loc, 2.5) then - Notifys(src, 'You are not in the correct location', 'error') + ps.notify(src, 'You are not in the correct location', 'error') return end if Config.TierSystem then @@ -120,10 +119,9 @@ local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} for k, v in pairs (cokecut) do ps.createUseable(k, function(source, item) local src = source - local Player = getPlayer(src) if not ps.hasItem(src, 'bakingsoda') then ps.notify(src, 'You Need Baking Soda For this', 'error') return end if ps.hasItem(src,item.name) then - local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting It Further') + local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting It Further') if not check then return end if ps.removeItem(src, k, 1) and ps.removeItem(src, 'bakingsoda', 1) then ps.addItem(src, 'loosecoke', v) diff --git a/server/consumables.lua b/server/consumables.lua index f05135d..92c8fb7 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -150,7 +150,7 @@ for k, v in pairs(Consume) do local anim = v.anim or Consumables.defaultanim local progressbartext = v.progressbartext or Consumables.defaultprogresstext local add = v.add or {hunger = 0} - local done = lib.callback.await('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k) + local done = ps.callback('md-drugs:client:consumedrugs', source, time, effect, anim, progressbartext, add, k) if done then RemoveItem(source, k, 1) end diff --git a/server/cornerselling.lua b/server/cornerselling.lua index ac8c2c3..32f58e3 100644 --- a/server/cornerselling.lua +++ b/server/cornerselling.lua @@ -121,7 +121,7 @@ local Drugs = { ["cupofdextro"] = {rep = 1,min = 18, max = 40}, } -lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped) +ps.registerCallback('md-drugs:server:cornerselling:getAvailableDrugs', function(source, ped) local Player = getPlayer(source) local rep = getRep(source, 'cornerselling') if not Player then return nil end @@ -144,7 +144,7 @@ lib.callback.register('md-drugs:server:cornerselling:getAvailableDrugs', functio end end) -lib.callback.register('md-drugs:server:hasDrugs', function(source) +ps.registerCallback('md-drugs:server:hasDrugs', function(source) local Player = getPlayer(source) for k, v in pairs(Drugs) do local item = Player.Functions.GetItemByName(k) diff --git a/server/crack.lua b/server/crack.lua index 5e3b3d7..b957509 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -1,62 +1,82 @@ -local QBCore = exports['qb-core']:GetCoreObject() RegisterServerEvent('md-drugs:server:makecrackone', function(num) local src = source - local Player = getPlayer(src) - local count,type, tier = 0, 'cookcrack', 'tier1' - if not checkLoc(src, 'makecrack', num) then return end + local tier = 'tier1' + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.makecrack[num].loc, 2.0) then + ps.notify(src, 'You are not in the correct location', 'error') + return + end if Config.TierSystem then local crackTiers = { - {item = 'loosecoke', tier = 'tier1', log = ' Cut Crack'}, - {item = 'loosecokestagetwo', tier = 'tier2', log = ' Cut Crack tier 2'}, - {item = 'loosecokestagethree', tier = 'tier3', log = ' Cut Crack tier 3'} + {item = 'loosecoke', tier = 'tier1'}, + {item = 'loosecokestagetwo', tier = 'tier2'}, + {item = 'loosecokestagethree', tier = 'tier3'} } for _, v in ipairs(crackTiers) do - if count >= 1 then break end - if Player.Functions.GetItemByName(v.item) then - tier = v.tier - count = count + 1 + if ps.hasItem(src, v.item) then + tier = v.tier + break end end end - if not GetRecipe(src, 'crack', type, tier) then return end + if not GetRecipe(src, 'crack', 'cookcrack', tier) then return end end) RegisterServerEvent('md-drugs:server:bagcrack', function(num) local src = source - local Player = getPlayer(src) - local count,type, tier = 0, 'bagcrack', 'tier1' - if not checkLoc(src, 'bagcrack', num) then return end + local tier = 'tier1' + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.bagcrack[num].loc, 2.0) then + ps.notify(src, 'You are not in the correct location', 'error') + return + end if Config.TierSystem then local crackTiers = { - {item = 'crackrock', tier = 'tier1', log = ' Bagged Crack'}, - {item = 'crackrockstagetwo', tier = 'tier2', log = ' Bagged Crack tier 2'}, - {item = 'crackrockstagethree', tier = 'tier3', log = ' Bagged Crack tier 3'} + {item = 'crackrock', tier = 'tier1'}, + {item = 'crackrockstagetwo', tier = 'tier2'}, + {item = 'crackrockstagethree', tier = 'tier3'} } for _, v in ipairs(crackTiers) do - if count >= 1 then break end - if Player.Functions.GetItemByName(v.item) then - tier = v.tier - count = count + 1 + if ps.hasItem(src, v.item) then + tier = v.tier + break end end end - if not GetRecipe(src, 'crack', type, tier) then return end + if not GetRecipe(src, 'crack', 'bagcrack', tier) then return end end) local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3} for k, v in pairs (cokecut) do - CUI(k, function(source, item) + ps.createUseable(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 - local check = lib.callback.await('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further') + if ps.hasItem(src, item.name) then + if not ps.hasItem(src, 'bakingsoda', 1) then return end + local check = ps.callback('md-drugs:client:uncuff', src, 'Cutting Crack Rock Further') if not check then return end - if RemoveItem(src, k, 1) and RemoveItem(src, 'bakingsoda', 1) then - AddItem(src, 'crackrock', v) + if ps.removeItem(src, k, 1) and ps.removeItem(src, 'bakingsoda', 1) then + ps.addItem(src, 'crackrock', v) end end end) end + +RegisterNetEvent("md-drugs:server:failcrackone", function(num) + local src = source + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.makecrack[num].loc, 2.0) then + ps.notify(src, 'You are not in the correct location', 'error') + return + end + local items = { + loosecoke = 1, + loosecokestagetwo = 1, + loosecokestagethree = 1 + } + for k,v in pairs(items) do + if ps.hasItem(src, k, v) then + ps.removeItem(src, k, v) + ps.notify(src, 'You failed to make crack and lost '..v..' '..k, 'error') + return + end + end +end) \ No newline at end of file diff --git a/server/deliveries.lua b/server/deliveries.lua index b62d4aa..1fb6115 100644 --- a/server/deliveries.lua +++ b/server/deliveries.lua @@ -80,7 +80,7 @@ local dloc = { {coords = vector4(223.98, 121.53, 102.76, 259.68)}, {coords = vector4(102.19, -255.02, 50.05, 83.59)}, } -lib.callback.register('md-drugs:server:getDealers', function(data) +ps.registerCallback('md-drugs:server:getDealers', function(data) local check = MySQL.query.await('SELECT * FROM dealers', {}) local loc = json.encode({x = 899.98, y = -2603.24, z = 6.11, h = 176.12 }) if not check[1] then @@ -99,7 +99,7 @@ local DeliveryItems = { { item = "coke_brick", minrep = 0, payout = {min = 10, max = 50}}, } -lib.callback.register('md-drugs:server:GetDeliveryItem', function(data) +ps.registerCallback('md-drugs:server:GetDeliveryItem', function(data) local src = source local Player = getPlayer(src) local itemnum = math.random(1, #DeliveryItems) diff --git a/server/functions.lua b/server/functions.lua index 84a21f6..4771245 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -323,7 +323,7 @@ function getCops() return amount end -lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) +ps.registerCallback('md-drugs:server:GetCoppers', function(source, cb, args) local amount = 0 local players = QBCore.Functions.GetQBPlayers() for k, v in pairs(players) do @@ -334,7 +334,7 @@ lib.callback.register('md-drugs:server:GetCoppers', function(source, cb, args) return amount end) -lib.callback.register('md-drugs:server:GetRep', function(source, cb, args) +ps.registerCallback('md-drugs:server:GetRep', function(source, cb, args) local src = source local rep = GetAllRep(source) return rep diff --git a/server/heroin.lua b/server/heroin.lua index fa2f620..efa3de1 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -37,7 +37,7 @@ function heroinCooldown(loc) end) end -lib.callback.register('removeCleaningkit', function(source) +ps.registerCallback('removeCleaningkit', function(source) local Player = getPlayer(source) for k, v in pairs(heroinLabKits) do if v.ownerid == Player.PlayerData.citizenid then @@ -141,7 +141,7 @@ CUI('heroinlabkit', function(source, item) local src = source local Player = getPlayer(src) if not Itemcheck(source, 'heroinlabkit', 1) then return end - local placed, loc = lib.callback.await('md-drugs:client:setheroinlabkit', src) + local placed, loc = ps.callback('md-drugs:client:setheroinlabkit', src) if placed then RemoveItem(src, 'heroinlabkit', 1) table.insert(heroinLabKits, { diff --git a/server/locations.lua b/server/locations.lua index 613a9c1..c1a6141 100644 --- a/server/locations.lua +++ b/server/locations.lua @@ -134,11 +134,11 @@ function checkLoc(source, event, num) end local loc = Target.Travellingmerchant[math.random(1, #Target.Travellingmerchant)] -lib.callback.register('md-drugs:server:getLocs', function() +ps.registerCallback('md-drugs:server:getLocs', function() return Target end) -lib.callback.register('md-drugs:server:GetMerchant', function(source) +ps.registerCallback('md-drugs:server:GetMerchant', function(source) return loc end) diff --git a/server/lsd.lua b/server/lsd.lua index eaded7a..647e617 100644 --- a/server/lsd.lua +++ b/server/lsd.lua @@ -1,29 +1,44 @@ -local QBCore = exports['qb-core']:GetCoreObject() + local prices = { tabcost = 100, -- price per piece of tab paper event does 10 at a time lsdlabkitcost = 10000 -- price of the lsd lab kit } - +local timedOut = {} +local function timeout(src, time) + timedOut[src] = true + CreateThread(function() + Wait(time) + timedOut[src] = nil + end) +end local lsdTables = {} RegisterServerEvent('md-drugs:server:getlysergic', function(num) local src = source - if not checkLoc(src, 'lysergicacid', num) then return end - if AddItem(src,'lysergic_acid', 2) then + if timedOut[src] then return end + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.lysergicacid[num].loc, 2.0) then + Notifys(src, Lang.lsd.notinloc, "error") + return end + timeout(src, 3000) + ps.addItem(src, 'lysergic_acid', 2) end) RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) local src = source - if not checkLoc(src, 'diethylamide', num) then return end - if AddItem(src,'diethylamide', 2) then + if not ps.checkDistance(src, GlobalState.MDDrugsLocs.diethylamide[num].loc, 2.0) then + Notifys(src, Lang.lsd.notinloc, "error") + return end + if timedOut[src] then return end + timeout(src, 3000) + ps.addItem(src, 'diethylamide', 2) end) CUI('lsdlabkit', function(source, item) local src = source local Player = getPlayer(src) - local placed, loc = lib.callback.await('md-drugs:client:setlsdlabkit', src) + local placed, loc = ps.callback('md-drugs:client:setlsdlabkit', src) if placed then if RemoveItem(src, 'lsdlabkit', 1) then table.insert(lsdTables, { @@ -46,7 +61,7 @@ local function hasLabKit(source) end end -lib.callback.register('md-drugs:server:removecleaningkit', function(source) +ps.registerCallback('md-drugs:server:removecleaningkit', function(source) local src = source if not Itemcheck(src, 'cleaningkit', 1) then return end if RemoveItem(src,"cleaningkit", 1) then diff --git a/server/oxyruns.lua b/server/oxyruns.lua index cf2cc77..a3539f6 100644 --- a/server/oxyruns.lua +++ b/server/oxyruns.lua @@ -4,7 +4,7 @@ local prices = { hotchance = 30, itemChance = 20, } -lib.callback.register('md-drugs:server:payfortruck', function() +ps.registerCallback('md-drugs:server:payfortruck', function() local src = source local Player = getPlayer(src) if Player.Functions.RemoveMoney('cash', prices.payfortruck) or Player.Functions.RemoveMoney('bank', prices.payfortruck) then diff --git a/server/pharma.lua b/server/pharma.lua index 3949ddf..69aad4f 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -25,7 +25,7 @@ CUI('prescription_pad', function(source, item) end end local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}} - local data = lib.callback.await('md-drugs:client:prescriptionpad', src, near, options) + local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options) if type(data) == 'table' then local give = QBCore.Functions.GetPlayerByCitizenId(data.who) for i = 1, #options do @@ -42,7 +42,7 @@ for m, d in pairs (pharmabottle) do CUI(d, function(source, item) local src = source local Player = getPlayer(src) - local check = lib.callback.await("md-drugs:client:unbottle", src) + local check = ps.callback("md-drugs:client:unbottle", src) if check then local get = { ['vicodinbottle'] = 'vicodin', diff --git a/server/recipes.lua b/server/recipes.lua index 120c5e6..63e4f28 100644 --- a/server/recipes.lua +++ b/server/recipes.lua @@ -139,7 +139,7 @@ function GetRecipe(source, type, method, tier) ps.craftItem(source,recipe[type][method][tier]) end -lib.callback.register('md-drugs:server:GetRecipe', function(source, type, cat) +ps.registerCallback('md-drugs:server:GetRecipe', function(source, type, cat) if not source then return false end return recipe[type][cat] end) \ No newline at end of file diff --git a/server/shops.lua b/server/shops.lua index 3eb404f..acbe2f0 100644 --- a/server/shops.lua +++ b/server/shops.lua @@ -53,7 +53,7 @@ local stores = { } } -lib.callback.register('md-drugs:server:menu', function(source, data) +ps.registerCallback('md-drugs:server:menu', function(source, data) local src = source if data == 'travellingMerchant' then return {table = stores.travel, des = '$', id = 'travellingMerchant', title = 'travelling Merchant'} diff --git a/server/weed.lua b/server/weed.lua index 8e87e36..93ded81 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -122,7 +122,7 @@ CUI("weedgrinder", function(source, item) local Player = getPlayer(src) local has = Player.Functions.GetItemByName("drycannabis") if not has then Notifys(src, 'You Need Dried Cannabis', 'error') return end - local check = lib.callback.await('md-drugs:client:uncuff', src, 'Grinding Weed') + local check = ps.callback('md-drugs:client:uncuff', src, 'Grinding Weed') if not check then return end if RemoveItem(src, "drycannabis",1 ) then AddItem(src, "grindedweed", 1) @@ -132,7 +132,7 @@ end) CUI("mdwoods", function(source, item) local src = source local Player = getPlayer(src) - local check = lib.callback.await('md-drugs:client:uncuff', src, 'Breaking Blunt Open') + local check = ps.callback('md-drugs:client:uncuff', src, 'Breaking Blunt Open') if not check then return end if RemoveItem(src, "mdwoods",1 ) then AddItem(src, "bluntwrap", 5) diff --git a/server/xtc.lua b/server/xtc.lua index 57c19aa..86c3d03 100644 --- a/server/xtc.lua +++ b/server/xtc.lua @@ -27,7 +27,7 @@ for k, v in pairs (presses) do CUI(v.item, function(source, item) local src = source local Player = getPlayer(src) -local check, loc = lib.callback.await('md-drugs:client:setpress', src, v.data) +local check, loc = ps.callback('md-drugs:client:setpress', src, v.data) if check then if RemoveItem(src, v.item, 1) then table.insert(activePresses, { diff --git a/serverRun.lua b/serverRun.lua new file mode 100644 index 0000000..42cf07c --- /dev/null +++ b/serverRun.lua @@ -0,0 +1,27 @@ +function loadFile(filePath) + local resourceName = 'md-drugs' + local fullScript = LoadResourceFile(resourceName, filePath) + if not fullScript then + ps.error("Error: Failed to load module '" .. filePath .. "' from resource '" .. resourceName .. "'.") + return false + end + local chunk, err = load(fullScript, filePath, "t") + if not chunk then + ps.error("Error loading Lua chunk from '" .. filePath .. "': " .. tostring(err)) + return false + end + + local success, execErr = pcall(chunk) + if not success then + ps.error("Error executing Lua chunk from '" .. filePath .. "': " .. tostring(execErr)) + return false + end + ps.success("Successfully loaded module '" .. filePath .. "' from resource '" .. resourceName .. "'.") + 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/config.lua b/shared/config.lua index 678d781..be46299 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -1,5 +1,6 @@ Config = {} --Ignore. ps = exports.ps_lib:init() +ps.insertLang("en") Config.respawnTime = 150 -- Seconds Config.Fuel = "LegacyFuel" -- type the name of script you use i.e. ps-fuel, cdn-fuel, LegacyFuel Config.TierSystem = true -- allows for three tiers of certain drugs ( coke, heroin, crack, lsd) @@ -22,12 +23,10 @@ Config.Tier1 = 100 -- amount to hit for level 2 Config.Tier2 = 300 -- amount to hit for level 3 ---------------------------------- BRIDGE -Config.progressbartype = 'oxcir' -- either 'qb', 'oxcir', 'oxbar' -Config.Notify = 'ox' -- -- either 'qb' or 'ox' or 'okok' + Config.Phone = 'qb' -- either 'qb' or 'yflip' or 'qs' Config.Dispatch = 'ps' -- either 'ps', 'cd', 'core', 'aty' -Config.Target = 'qb' -- qb or ox -Config.Inventory = 'ox' -- qb or ox, other if you dont use ox just mark as qb + Config.Minigames = { ps_circle = {amount = 2, speed = 8,}, ps_maze = {timelimit = 15}, @@ -49,4 +48,23 @@ Config.Minigames = { Config.minigametype = 'ox' -- look above for options or choose none if you dont want any minigames -------- Woah Where did like all the locations go? ---- read the readme to find out \ No newline at end of file +--- read the readme to find out +--- +Config.Drugs = { + cocaine = true, + consumables =false, + crack = true, + cornerselling = false, + heroin = false, + deliveries = false, + lean = false, + lsd = false, + mescaline = false, + meth = false, + oxyruns = false, + pharma = false, + shrooms = false, + weed = false, + wholesale = false, + xtc = false, +} \ No newline at end of file