diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index b9aa20d..7a9425d 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -1,5 +1,3 @@ - -local QBCore = exports['qb-core']:GetCoreObject() local started = nil local function loadParticle(dict) diff --git a/client/cocaine.lua b/client/cocaine.lua index f61e0e6..1c3eca9 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local CocaPlant = {} local cuttingcoke = nil local baggingcoke = nil diff --git a/client/consumables.lua b/client/consumables.lua index ad9fd81..480a759 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,5 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() - RegisterNetEvent('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) if not progressbar(progresstext .. GetLabel(item).. "!", time, anim ) then return end TriggerServerEvent('md-drugs:server:removeconsum', item) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index 52b2efd..b3748bd 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local sell = false local sold = false local targbusy = false diff --git a/client/crack.lua b/client/crack.lua index 4476308..092f01e 100644 --- a/client/crack.lua +++ b/client/crack.lua @@ -1,5 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() - 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 diff --git a/client/deliveries.lua b/client/deliveries.lua index b32ae7e..c9372ba 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local isActive = false local dealer = {} diff --git a/client/functions.lua b/client/functions.lua index 2407a09..cc1d97d 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -258,12 +258,21 @@ end function ItemCheck(item) -if GetResourceState('ox_inventory') == 'started' then - if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') return false end -else - if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end - if QBCore.Functions.HasItem(item) then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') return false end + if GetResourceState('ox_inventory') == 'started' then + if exports.ox_inventory:GetItemCount(item) >= 1 then return true else Notify('You Need ' .. GetLabel(item) .. " !", 'error') return false end + else + if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end + if QBCore.Functions.HasItem(item) then return true else Notify('You Need ' .. QBCore.Shared.Items[item].label .. " !", 'error') return false end + end end + +function hasItem(item) + if GetResourceState('ox_inventory') == 'started' then + if exports.ox_inventory:GetItemCount(item) >= 1 then return true else return false end + else + if QBCore.Shared.Items[item] == nil then print("There Is No " .. item .. " In Your QB Items.lua") return end + if QBCore.Functions.HasItem(item) then return true else return false end + end end function ItemCheckMulti(item) @@ -663,4 +672,12 @@ RegisterCommand('DrugRep', function() } }) lib.showContext('DrugRep') -end, false) \ No newline at end of file +end, false) + +function getJobType() + return QBCore.Functions.GetPlayerData().job.type +end + +function getJobName() + return QBCore.Functions.GetPlayerData().job.name +end diff --git a/client/heroin.lua b/client/heroin.lua index ee25cf8..dae939d 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local PoppyPlants = {} local herointable = false diff --git a/client/lean.lua b/client/lean.lua index 9444a9a..9b9f903 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -1,5 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() - RegisterNetEvent("md-drugs:client:getsyruplocationtobuy", function() Notify(Lang.Lean.marked, "success") SpawnCarPedChase() diff --git a/client/lsd.lua b/client/lsd.lua index 998d319..a51a8bd 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local tableout = false local function createLabKit(coord, head) @@ -101,7 +100,7 @@ RegisterNetEvent("md-drugs:client:buytabs", function(data) end) RegisterNetEvent("md-drugs:client:buylabkit", function() - if QBCore.Functions.HasItem('lsdlabkit') then Notify(Lang.lsd.hav, 'error') return end + 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) diff --git a/client/mescaline.lua b/client/mescaline.lua index 12da5e8..faa6085 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local Mescaline = {} local function pick(loc) diff --git a/client/meth.lua b/client/meth.lua index b4237fc..4aeba44 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local amonia = nil local tray = nil local heated = nil diff --git a/client/oxyruns.lua b/client/oxyruns.lua index d256f5c..0bbaf35 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local carryPackage = nil RegisterNetEvent("md-drugs:client:GetOxyCar", function() @@ -9,7 +8,7 @@ RegisterNetEvent("md-drugs:client:GetOxyCar", function() 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)) + TriggerEvent("vehiclekeys:client:SetOwner", GetVehicleNumberPlateText(oxycar)) Notify(Lang.oxy.truck, 'success') TriggerEvent("md-drugs:client:getoxylocationroute") AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fa-solid fa-box", label = Lang.targets.oxy.pack}, nil ) diff --git a/client/pedspawns.lua b/client/pedspawns.lua index 2f22ce5..0fd9675 100644 --- a/client/pedspawns.lua +++ b/client/pedspawns.lua @@ -1,4 +1,4 @@ -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) diff --git a/client/pharma.lua b/client/pharma.lua index 1970137..3793d9d 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,7 +1,6 @@ -local QBCore = exports['qb-core']:GetCoreObject() lib.callback.register("md-drugs:client:prescriptionpad", function(data, op) - if not QBCore.Functions.GetPlayerData().job.type == 'ems' then return end + if getJobType() ~= 'ems' then return end local input = lib.inputDialog('Who To Give A Prescription To?',{ {type = 'select', label = 'Player Name', options = data}, {type = 'select', label = 'Prescription', options = op}}) diff --git a/client/shrooms.lua b/client/shrooms.lua index 5f9ba24..9ffd5b0 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local shrooms = {} local function LoadModels(hash) diff --git a/client/target.lua b/client/target.lua index a73bdb9..d046d46 100644 --- a/client/target.lua +++ b/client/target.lua @@ -1,5 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() -local icon = "fa solid fa-eye" CreateThread(function() local config = lib.callback.await('md-drugs:server:getLocs', false) diff --git a/client/weed.lua b/client/weed.lua index a4f0f88..4f93edb 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -1,10 +1,9 @@ -local QBCore = exports['qb-core']:GetCoreObject() local WeedPlant = {} local exploded, drying = false, false local function hasJob() if Config.Joblock then - if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then + if getJobName() == Config.weedjob then return true else return false end else return true end diff --git a/client/wholesale.lua b/client/wholesale.lua index faef517..ebfbbc7 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local miss = false RegisterNetEvent("md-drugs:client:GetLocation", function(drug) diff --git a/client/xtc.lua b/client/xtc.lua index 1813cbe..2b2cb5f 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -1,4 +1,3 @@ -local QBCore = exports['qb-core']:GetCoreObject() local xtcpress = false RegisterNetEvent("md-drugs:client:setpress", function(type) diff --git a/server/heroin.lua b/server/heroin.lua index c9ed9e1..06f5696 100644 --- a/server/heroin.lua +++ b/server/heroin.lua @@ -48,6 +48,7 @@ local src = source end) RegisterServerEvent("heroin:pickupCane", function(loc) + if CheckDist(source, h[loc].location) then return end if not h[loc].taken then h[loc].taken = true GlobalState.PoppyPlants = h @@ -103,7 +104,7 @@ RegisterServerEvent('md-drugs:server:getheroinlabkit', function() local Player = getPlayer(src) if not checkLoc(source, 'singleSpot', 'buyheroinlabkit') then return end local has = Player.Functions.GetItemByName('heroinlabkit') - if has then Notifys(src, 'You Already Have A Heroin Lab Kit', 'error') return end + if has then Notifys(src, Lang.Heroin.haskit, 'error') return end if Player.Functions.RemoveMoney('cash', prices.heroinlabkitprice) then AddItem(src, 'heroinlabkit', 1) else diff --git a/server/weed.lua b/server/weed.lua index a8d93a4..675f1e7 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -54,13 +54,13 @@ function WeedCooldown(loc) end RegisterNetEvent("weed:pickupCane", function(loc) - local src = source + if CheckDist(source, weedPlant[loc].location) then return end if not weedPlant[loc].taken then weedPlant[loc].taken = true GlobalState.WeedPlant = weedPlant TriggerClientEvent("weed:removeCane", -1, loc) WeedCooldown(loc) - AddItem(src, 'wetcannabis', 1) + AddItem(source, 'wetcannabis', 1) Log(GetName(source) .. ' Picked Weed With a distance of ' .. dist(source, weedPlant[loc].location) .. ' vectors', 'weed') end end) diff --git a/server/wholesale.lua b/server/wholesale.lua index 237a182..f6bd0ee 100644 --- a/server/wholesale.lua +++ b/server/wholesale.lua @@ -19,10 +19,10 @@ for k, v in pairs (burners) do QBCore.Functions.CreateUseableItem(k, function(source, item) local src = source local Player = getPlayer(src) - if getCops() < Config.PoliceCount then return Notifys(src, 'Nobody Answered, Try Again Later', 'error') end + if getCops() < Config.PoliceCount then return Notifys(src, Lang.Wholesale.na, 'error') end for m, d in pairs (active) do if d.cid == Player.PlayerData.citizenid then - return Notifys(src, 'You Already Have A Delivery To Make', 'error' ) + return Notifys(src, Lang.Wholesale.al, 'error' ) end end local tab = '' diff --git a/shared/english.lua b/shared/english.lua index fb6c6ed..ffe3865 100644 --- a/shared/english.lua +++ b/shared/english.lua @@ -173,7 +173,8 @@ Lang.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' + 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', @@ -289,5 +290,7 @@ Lang.xtc = { } Lang.Wholesale = { - al = 'Already Called Someone!' + al = 'You Already Have A Delivery To Make', + na = 'No One Answered, Try Again Later', + }