From fefd53857ea136d8a0e9c727512ed94b618558b7 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Wed, 23 Oct 2024 16:04:09 -0700 Subject: [PATCH 01/20] test test --- client/cocaine.lua | 12 ++--- client/consumables.lua | 18 ++++---- client/cornerselling.lua | 34 ++++++-------- client/deliveries.lua | 95 +++++++++++++++++++--------------------- client/functions.lua | 11 +++++ server/consumables.lua | 9 ++-- shared/english.lua | 23 +++++++++- 7 files changed, 109 insertions(+), 93 deletions(-) diff --git a/client/cocaine.lua b/client/cocaine.lua index 66ebd51..8553d7a 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -15,7 +15,7 @@ RegisterNetEvent('coke:respawnCane', function(loc) if not CocaPlant[loc] then CocaPlant[loc] = CreateObject(hash, v.location, false, true, true) Freeze(CocaPlant[loc], true, v.heading) - AddSingleModel(CocaPlant[loc], {icon = 'fas fa-hand', label = 'Pick Cocaine', action = function() if not pick(loc) then return end end}, loc) + AddSingleModel(CocaPlant[loc], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(loc) then return end end}, loc) end end) @@ -31,7 +31,7 @@ RegisterNetEvent("coke:init", function() 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) - AddSingleModel(CocaPlant[k], {icon = 'fas fa-hand', label = 'Pick Cocaine', action = function() if not pick(k) then return end end}, k) + AddSingleModel(CocaPlant[k], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(k) then return end end}, k) end end end) @@ -92,12 +92,12 @@ end) CreateThread(function() if Config.FancyCokeAnims == false then - AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "Cut Coke"}) - AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "Bag Coke"}) + AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut}) + AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag}) else AddBoxZoneSingle('cutcoke', vector3(1093.17, -3195.74, -39.19), - { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = "cut up", canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut, canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) AddBoxZoneSingle('bagcokepowder', vector3(1090.29, -3195.66, -39.13), - { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = "bagging", canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) end end) diff --git a/client/consumables.lua b/client/consumables.lua index 929f9e5..8880f00 100644 --- a/client/consumables.lua +++ b/client/consumables.lua @@ -1,11 +1,9 @@ local QBCore = exports['qb-core']:GetCoreObject() RegisterNetEvent('md-drugs:client:consumedrugs', function(time, effect, anim, progresstext, status, item) - print(time, effect, anim, progresstext, status, item) if not progressbar(progresstext .. GetLabel(item).. "!", time, anim ) then return end TriggerServerEvent('md-drugs:server:removeconsum', item) for k, v in pairs (status) do - print(k,v) if k == 'health' then local cur = GetEntityHealth(PlayerPedId()) SetEntityHealth(PlayerPedId(), cur + v) @@ -21,7 +19,7 @@ RegisterNetEvent('md-drugs:client:consumedrugs', function(time, effect, anim, pr TriggerEvent('md-drugs:client:recievebuff', k, v) end end - TriggerEvent('evidence:client:SetStatus', 'widepupils', 200) if effect == "alien" then AlienEffect() elseif effect == "ecstacy" then EcstasyEffect() elseif effect == "meth" then MethBagEffect() elseif effect == "coke" then CokeBaggyEffect() elseif effect == "trevor" then TrevorEffect() else end if status == nil then return end + TriggerEvent('evidence:client:SetStatus', 'widepupils', 200) if effect == "alien" then AlienEffect() elseif effect == "ecstacy" then EcstasyEffect() elseif effect == "meth" then MethBagEffect() elseif effect == "coke" then CokeBaggyEffect() elseif effect == "trevor" then TrevorEffect() else end if status == nil then return end end) RegisterNetEvent('md-drugs:client:recievebuff', function(type, amount) @@ -36,12 +34,12 @@ if type == 'speed' then end if type == 'strength' then local strength = 0 - SetCurrentPedWeapon(PlayerPedId(), 'weapon_unarmed', true) - SetWeaponDamageModifier(GetHashKey("WEAPON_UNARMED"), 60.0) - repeat - strength = strength + 1 - Wait(1000) - until strength == amount - SetWeaponDamageModifier(GetHashKey("WEAPON_UNARMED"), 1.0) + SetCurrentPedWeapon(PlayerPedId(), 'weapon_unarmed', true) + SetWeaponDamageModifier(GetHashKey("WEAPON_UNARMED"), 50.0) + repeat + strength = strength + 1 + Wait(1000) + until strength == amount + SetWeaponDamageModifier(GetHashKey("WEAPON_UNARMED"), 1.0) end end) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index d862af3..fea3aff 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -7,7 +7,7 @@ local function sellDrug(item, amount, price, targ) PoliceCall(20) targbusy = true if IsPedInAnyVehicle(PlayerPedId(), true) then - Notify('STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', 'error') + Notify(Lang.Cornerselling.inveh, 'error') FreezeEntityPosition(targ, false) ClearPedTasks(targ) Wait(10000) @@ -16,7 +16,7 @@ local function sellDrug(item, amount, price, targ) sold = true sell = false return end - if not progressbar('Selling ' .. GetLabel(item) .. '!', 4000, 'uncuff') then return end + if not progressbar(string.format(Lang.Cornerselling.selling, GetLabel(item), price), 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price) FreezeEntityPosition(targ, false) ClearPedTasks(targ) @@ -29,7 +29,7 @@ local function sellDrug(item, amount, price, targ) local function deny(targ) PoliceCall(20) targbusy = true - if not progressbar('Telling This Dumbass To Leave!', 4000, 'argue5') then return end + if not progressbar(Lang.Cornerselling.deny, 4000, 'argue5') then return end FreezeEntityPosition(targ, false) ClearPedTasks(targ) Wait(10000) @@ -50,25 +50,17 @@ function Cornersell() TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) FreezeEntityPosition(targ, true) local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) - if item == 'nothing' then Notify(' You Aint Got Shit', 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end + if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { - { label = 'Sell ' .. amount .. ' Of ' .. GetLabel(item) .. ' For $' .. price .. '!', icon = "fas fa-eye", - action = function() - sellDrug(item, amount, price, targ) - end, - onSelect = function() - sellDrug(item, amount, price, targ) - end, + { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon = "fas fa-eye", + action = function() sellDrug(item, amount, price, targ) end, + onSelect = function() sellDrug(item, amount, price, targ) end, canInteract = function() if not targbusy then return true end end, }, - { label = 'Deny Price', icon = "fas fa-eye", - action = function() - deny(targ) - end, - onSelect = function() - deny(targ) - end, + { label = Lang.targets.CornerSell.deny, icon = "fas fa-eye", + action = function() deny(targ) end, + onSelect = function() deny(targ) end, canInteract = function() if not targbusy then return true end end, }, @@ -85,18 +77,18 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item ~= 'nothing' then if sell then - Notify('Lazy Ass Cant Even Sell Drugs', 'error') + Notify(Lang.Cornerselling.stop, 'error') sell = false else sell = true - Notify('Go Make That Paper', 'success') + Notify(Lang.Cornerselling.start, 'success') repeat Wait(1000) if not Cornersell() then end until sell == false end else - Notify('You Cant Sell Air', 'error') + Notify(Lang.Cornerselling.nodrugs, 'error') end end) diff --git a/client/deliveries.lua b/client/deliveries.lua index fb3056f..efdc807 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -2,47 +2,47 @@ local QBCore = exports['qb-core']:GetCoreObject() local isActive = false RegisterNetEvent('md-drugs:client:opendealermenu', function() local dealermenu = {} + local rep = GetRep() if Config.StupidassNewQbItemName then for k, v in pairs (QBConfig.ProductsStupidNameRewrite) do - if QBCore.Functions.GetPlayerData().metadata["dealerrep"] >= v.minrep then - dealermenu[#dealermenu + 1] = { - icon = GetImage(v.name), - title = GetLabel(v.name), - description = v.price, - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = QBConfig.ProductsStupidNameRewrite, - num = k, - } - } - - lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu}) - end - end + if rep.dealerrep >= v.minrep then + dealermenu[#dealermenu + 1] = { + icon = GetImage(v.name), + title = GetLabel(v.name), + description = v.price, + event = "md-drugs:client:travellingmerchantox", + args = { + item = v.name, + cost = v.price, + amount = v.amount, + table = QBConfig.ProductsStupidNameRewrite, + num = k, + } + } + end + end else for k, v in pairs (QBConfig.Products) do - if QBCore.Functions.GetPlayerData().metadata["dealerrep"] >= v.minrep then - dealermenu[#dealermenu + 1] = { - icon = GetImage(v.name), - title = GetLabel(v.name), - description = v.price, - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = QBConfig.Products, - num = k, - } - } - - lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu}) - end - end + if rep.dealerrep >= v.minrep then + dealermenu[#dealermenu + 1] = { + icon = GetImage(v.name), + title = GetLabel(v.name), + description = v.price, + event = "md-drugs:client:travellingmerchantox", + args = { + item = v.name, + cost = v.price, + amount = v.amount, + table = QBConfig.Products, + num = k, + } + } + + end + end end + sorter(dealermenu, 'title') + lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu}) lib.showContext('dealermenu') end) @@ -58,11 +58,11 @@ CreateThread(function() local options = { { icon = 'fas fa-user-secret', - label = "Deliver For " .. v.name, + 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) if bool then - Email('Not A Drug Dealer', 'Hurry Up And Get The Package To The Buyer', 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring ' .. amount .. ' Of '.. GetLabel(item) .. '!' ) + 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}) end end, @@ -70,26 +70,21 @@ CreateThread(function() local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k) if item then TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) - Email('Not A Drug Dealer', 'Hurry Up And Get The Package To The Buyer', 'I Swear To God If It Doesnt Get There I Will Tell Your Mom You Said Fuck Just Bring ' .. amount .. ' Of '.. GetLabel(item) .. '!' ) + Email(Lang.Delivery.emailn, Lang.Delivery.emailsub, string.format(Lang.Delivery.emailcon, amount, GetLabel(item))) end end }, { icon = 'fas fa-user-secret', - label = "Open " .. v.name .. "'s Shop", - action = function() - TriggerEvent('md-drugs:client:opendealermenu') - end, - onSelect = function() - TriggerEvent('md-drugs:client:opendealermenu') - end - + label = string.format(Lang.targets.Delivery.openm, v.name), + action = function() TriggerEvent('md-drugs:client:opendealermenu') end, + onSelect = function() TriggerEvent('md-drugs:client:opendealermenu') end } } AddMultiModel(dealer[k], options) end end) - +-- TODO add a blip for the delivery location RegisterNetEvent('md-drugs:client:setLocation', function(data) local coord = json.decode(data.coords) if isActive then @@ -102,9 +97,9 @@ RegisterNetEvent('md-drugs:client:setLocation', function(data) Freeze(Buyer, true, 180) AddSingleModel(Buyer, { icon = 'fas fa-user-secret', - label = "Hand Off", + label = Lang.targets.Delivery.hand, action = function() - if not progressbar('Delivering The Package', 4000, 'uncuff') then return end + if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end isActive = false DeletePed(Buyer) RemoveBlip(deliveryBlip) diff --git a/client/functions.lua b/client/functions.lua index 480adfd..b53e097 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -198,6 +198,17 @@ function GetLabel(label) end end +function GetRep() + local rep = lib.callback.await('md-drugs:server:GetRep', false) + return rep +end + + +function sorter(sorting, value) + table.sort(sorting, function(a, b) return a[value] < b[value] end) +end + + function ItemCheck(item) local success diff --git a/server/consumables.lua b/server/consumables.lua index 344e086..d832447 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -7,16 +7,15 @@ for k, v in pairs (Consumables.Items) do QBCore.Functions.CreateUseableItem(k, f if v.effect == nil then v.effect = 0 end if v.anim == nil then v.anim = Consumables.defaultanim end if v.progressbartext == nil then v.progressbartext = Consumables.defaultprogresstext end - if v.add == nil then v.add = 'none' end + if v.add == nil then v.add = {hunger = 0} end TriggerClientEvent("md-drugs:client:consumedrugs", source, v.time, v.effect, v.anim, v.progressbartext, v.add, k) end) end RegisterNetEvent('md-drugs:server:removeconsum', function(item) - local src = source - RemoveItem(source,item, 1) - Log(GetName(source) .. ' Got High With ' .. item .. '!', 'consuming') -end) + RemoveItem(source,item, 1) + Log(GetName(source) .. ' Got High With ' .. item .. '!', 'consuming') +end) RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval) print(stat,statval) diff --git a/shared/english.lua b/shared/english.lua index 6b8d1d3..9b41502 100644 --- a/shared/english.lua +++ b/shared/english.lua @@ -1,5 +1,22 @@ Lang = {} +Lang.targets = { + coke = { + pick = 'Pick Cocaine', + cut = 'Cut Cocaine', + bag = 'Bag Cocaine' + }, + CornerSell = { + sell = 'Sell %s Of %s For $%s', + deny = 'Deny Price' + }, + Delivery = { + Deliver = 'Deliver For %s', + open = 'Open %s Shop', + hand = 'Hand Over' + } +} + Lang.Coke = { -- client side progressbars picking = "Picking Leaves", @@ -22,8 +39,9 @@ Lang.Crack = { } Lang.Cornerselling = { -- client side notifys + inveh = 'STRANGER DANGER, I WONT GET IN THE CAR WITH YOU', toofar = "To Far From Your Corner Homie", - inacar = " You Cant Sell While In A Car", + selling = 'Selling %s For $%s', deny = "Fuck That Offer", start = "Get That Paper", stop = "Lazy Ass Cant Even Sell Drugs", @@ -35,6 +53,9 @@ Lang.Cornerselling = { } 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", From d3e99d6440b0a4c4e10e870a777a1c6d4bc38209 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:44:46 -0700 Subject: [PATCH 02/20] added lang and sorts --- client/animationsandfunctions.lua | 6 +- client/deliveries.lua | 20 ++++--- client/functions.lua | 12 +++- client/heroin.lua | 27 ++++----- client/lean.lua | 27 ++++----- client/lsd.lua | 47 ++++++--------- client/mescaline.lua | 10 ++-- client/meth.lua | 33 +++++++---- client/oxyruns.lua | 12 ++-- client/pharma.lua | 11 ++-- client/shrooms.lua | 5 +- client/target.lua | 40 ++++++------- client/travellingmerchant.lua | 2 + client/weed.lua | 37 ++++++------ client/wholesale.lua | 4 +- client/xtc.lua | 82 ++++++++++---------------- shared/english.lua | 95 ++++++++++++++++++++++++++++++- 17 files changed, 279 insertions(+), 191 deletions(-) diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 2fb9662..2dbbabd 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -537,9 +537,9 @@ RegisterCommand('DrugRep', function() 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-syringe", title = 'Heroin: '..rep.heroin}, + {icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd}, + {icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep}, } }) lib.showContext('DrugRep') diff --git a/client/deliveries.lua b/client/deliveries.lua index efdc807..b933660 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -84,16 +84,22 @@ CreateThread(function() AddMultiModel(dealer[k], options) end end) --- TODO add a blip for the delivery location + RegisterNetEvent('md-drugs:client:setLocation', function(data) local coord = json.decode(data.coords) - if isActive then - Blip(vector3(coord.x, coord.y, coord.z), 'Drop Off') - return - end + local deliveryBlip = AddBlipForCoord(coord.x, coord.y, coord.z) + SetBlipSprite(deliveryBlip, 1) + SetBlipDisplay(deliveryBlip, 2) + SetBlipScale(deliveryBlip, 1.0) + SetBlipAsShortRange(deliveryBlip, false) + SetBlipColour(deliveryBlip, 27) + BeginTextCommandSetBlipName("STRING") + AddTextComponentSubstringPlayerName('Drug Delivery') + EndTextCommandSetBlipName(deliveryBlip) + SetBlipRoute(deliveryBlip, true) + if isActive then return end isActive = true - Blip(vector3(coord.x, coord.y, coord.z), 'Drop Off') - Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false) + local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false) Freeze(Buyer, true, 180) AddSingleModel(Buyer, { icon = 'fas fa-user-secret', diff --git a/client/functions.lua b/client/functions.lua index b53e097..63464ca 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -53,7 +53,17 @@ function progressbar(text, time, anim) end end - function minigame(tier) +function loadParticle(dict) + if not HasNamedPtfxAssetLoaded(dict) then + RequestNamedPtfxAsset(dict) + end + while not HasNamedPtfxAssetLoaded(dict) do + Wait(0) + end + SetPtfxAssetNextCall(dict) +end + +function minigame() local time = 0 local game = Config.Minigames if minigametype == 'ps_circle' then diff --git a/client/heroin.lua b/client/heroin.lua index 87407ee..3f4eb26 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -13,7 +13,7 @@ local Ped = "g_m_y_famdnf_01" local labkitlocation = Config.buyheroinlabkit local heroinkitdealer = CreatePed(0, Ped, labkitlocation.x, labkitlocation.y, labkitlocation.z-1, labkitlocation.w, false, false) Freeze(heroinkitdealer, true, labkitlocation.w) - AddSingleModel(heroinkitdealer, { label = "Buy Heroin Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) + AddSingleModel(heroinkitdealer, { label = lang.targets.heroin.kit, icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) end) ---- plant spawns dont edit @@ -23,7 +23,7 @@ RegisterNetEvent('heroin:respawnCane', function(loc) if not PoppyPlants[loc] then PoppyPlants[loc] = CreateObject(hash, v.location, false, true, true) Freeze(PoppyPlants[loc], true, v.heading) - AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = "pick Poppies", action = function() pickher(loc) end}, loc ) + AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(loc) end}, loc ) end end) @@ -43,7 +43,7 @@ RegisterNetEvent("heroin:init", function() if not v.taken then PoppyPlants[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(PoppyPlants[k], true, v.heading) - AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = "pick Poppies", action = function() pickher(k) end}, k ) + AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(k) end}, k ) end end end) @@ -105,8 +105,8 @@ else SetEntityHeading(heroinlabkit, head) PlaceObjectOnGroundProperly(heroinlabkit) local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = "Cook Heroin", data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = heroinlabkit, canInteract = function() if herointable then return true end end}, + { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, + { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, } AddMultiModel(heroinlabkit, options, heroinlabkit) end @@ -117,7 +117,7 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) local loc = GetEntityCoords(data.data) local head = GetEntityHeading(data.data) if not ItemCheck('emptyvial') then return end - if not minigame(2, 8) then + if not minigame() then TriggerServerEvent("md-drugs:server:failheatingheroin") DeleteObject(data.data) local dirtylabkitheroin = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false) @@ -127,10 +127,7 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", dirtylabkitheroin, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) SetParticleFxLoopedAlpha(heroinkit, 3.0) SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0) - local options = { - { event = "md-drugs:client:cleanheroinlabkit", icon = "fas fa-box-circle-check", label = "Clean It", data = dirtylabkitheroin} - } - AddMultiModel(dirtylabkitheroin, options, nil ) + AddMultiModel(dirtylabkitheroin, {event = "md-drugs:client:cleanheroinlabkit",icon = "fas fa-box-circle-check",label = Lang.target.heroin.clean, data = dirtylabkitheroin}, nil ) return end if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquidheroin") @@ -151,8 +148,8 @@ local head = GetEntityHeading(data) SetEntityHeading(heroinlabkit, head) PlaceObjectOnGroundProperly(heroinlabkit) local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = "Cook Heroin", data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = heroinlabkit, canInteract = function() if herointable then return true end end}, + { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, + { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, } AddMultiModel(heroinlabkit, options, heroinlabkit) end) @@ -167,9 +164,9 @@ RegisterNetEvent("md-drugs:client:getheroinkitback", function(data) end) -RegisterNetEvent("md-drugs:client:fillneedle", function(data) - if not minigame(2, 8) then TriggerServerEvent("md-drugs:server:failheroin", data.data) return end - if not progressbar(Lang.Heroin.needles, 4000, 'uncuff') then return end +RegisterNetEvent("md-drugs:client:fillneedle", function(data) + if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", data.data) return end + if not progressbar(Lang.Heroin.needles, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillneedle", data.data) end) diff --git a/client/lean.lua b/client/lean.lua index 202bcfd..836792c 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -5,7 +5,7 @@ CreateThread(function() lib.requestModel(current, Config.RequestModelTime) local SyrupLocation = CreatePed(0, current,Config.SyrupVendor.x,Config.SyrupVendor.y,Config.SyrupVendor.z-1, Config.SyrupVendor.w, false, false) Freeze(SyrupLocation, true, Config.SyrupVendor.w) - AddSingleModel(SyrupLocation, { type = "client", label = "Get Task", icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil ) + AddSingleModel(SyrupLocation, { type = "client", label = Lang.targets.lean.git, icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil ) end) @@ -21,12 +21,8 @@ local items = lib.callback.await('md-drugs:server:GetRecipe', false,'lean', 'cup for k, v in pairs (items) do label = {} local item = '' - for m, d in pairs (items[k].take) do - table.insert(label, GetLabel(m) .. ' X ' .. d) - end - for m,d in pairs (items[k].give) do - item = m - end + for m, d in pairs (items[k].take) do table.insert(label, GetLabel(m) .. ' X ' .. d) end + for m,d in pairs (items[k].give) do item = m end store[#store + 1] = { icon = GetImage(item), description = table.concat(label, ", "), @@ -34,22 +30,23 @@ for k, v in pairs (items) do event = 'md-drugs:client:stirlean', args = { item = item, - recipe = 'weed', + recipe = 'lean', num = k, label = 'Cooking Up ' .. GetLabel(item), - table = 'edibles' - + table = 'cups' } } lib.registerContext({id = 'leanCraft',title = "Make Lean", options = store}) end +sorter(store, 'title') lib.showContext('leanCraft') end) + local busy = false RegisterNetEvent('md-drugs:client:stirlean', function(data) -if busy then return end - busy = true -if not progressbar(data.label, 4000, 'uncuff') then busy = false return end -TriggerServerEvent('md-drugs:server:finishcup', data) -busy = false + if busy then return end + busy = true + if not progressbar(data.label, 4000, 'uncuff') then busy = false return end + TriggerServerEvent('md-drugs:server:finishcup', data) + busy = false end) \ No newline at end of file diff --git a/client/lsd.lua b/client/lsd.lua index ab63013..fcc16a5 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -2,34 +2,26 @@ local QBCore = exports['qb-core']:GetCoreObject() local tableout = false -local function loadParticle(dict) - if not HasNamedPtfxAssetLoaded(dict) then - RequestNamedPtfxAsset(dict) - end - while not HasNamedPtfxAssetLoaded(dict) do - Wait(0) - end - SetPtfxAssetNextCall(dict) -end + CreateThread(function() local Ped = "g_m_y_famdnf_01" lib.requestModel(Ped, Config.RequestModelTime) local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false) Freeze(tabdealer, true, Config.buylsdlabkit.w) - AddSingleModel(tabdealer,{ type = "client", label = "Buy LSD Lab Kit", icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer ) + AddSingleModel(tabdealer,{ type = "client", label = lang.targets.lsd.buy, icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer ) end) RegisterNetEvent("md-drugs:client:getlysergic", function(data) - if not minigame(2, 8) then return end + 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) RegisterNetEvent("md-drugs:client:getdiethylamide", function(data) - if not minigame(2, 8) then return end + 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) @@ -47,10 +39,10 @@ else SetEntityHeading(labkit, head) PlaceObjectOnGroundProperly(labkit) local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = "Heat Liquid" , data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = "Refine", data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = "Dab Sheets", data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = labkit, canInteract = function() if tableout then return true end end}, + { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, + { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, + { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, + { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, } AddMultiModel(labkit, options, labkit) end @@ -65,10 +57,10 @@ end) RegisterNetEvent("md-drugs:client:heatliquid", function(data) local PedCoords = GetEntityCoords(data.data) - dict = "scr_ie_svm_technical2" + local dict = "scr_ie_svm_technical2" if not ItemCheck('lysergic_acid') then return end if not ItemCheck('diethylamide') then return end - if not minigame(2, 8) then + if not minigame() then TriggerServerEvent("md-drugs:server:failheating") DeleteObject(data.data) local dirtylabkit = CreateObject("v_ret_ml_tablea", PedCoords.x, PedCoords.y, PedCoords.z-1, true, false) @@ -77,10 +69,7 @@ RegisterNetEvent("md-drugs:client:heatliquid", function(data) PlaceObjectOnGroundProperly(dirtylabkit) SetParticleFxLoopedAlpha(exitPtfx, 3.0) Wait(100) - local options = { - { event = "md-drugs:client:cleanlabkit", icon = "fas fa-box-circle-check", label = "Clean It", data = dirtylabkit} - } - AddMultiModel(dirtylabkit, options, nil ) + AddMultiModel(dirtylabkit, { event = "md-drugs:client:cleanlabkit", icon = "fas fa-box-circle-check", 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") @@ -96,10 +85,10 @@ RegisterNetEvent("md-drugs:client:cleanlabkit", function(data) local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z-1, true, false) PlaceObjectOnGroundProperly(labkit) local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = "Heat Liquid" , data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = "Refine", data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = "Dab Sheets", data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = "Pick Up", data = labkit, canInteract = function() if tableout then return true end end}, + { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, + { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, + { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, + { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, } AddMultiModel(labkit, options, labkit) end @@ -107,14 +96,14 @@ end) RegisterNetEvent("md-drugs:client:refinequalityacid", function() if not ItemCheck('lsd_one_vial') then return end - if not minigame(2, 8) then TriggerServerEvent("md-drugs:server:failrefinequality") 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(2, 8) then TriggerServerEvent("md-drugs:server:failtabs") 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) @@ -126,7 +115,7 @@ end) RegisterNetEvent("md-drugs:client:buylabkit", function() - if QBCore.Functions.HasItem('lsdlabkit') then Notify('You Have One Idiot', 'error') return end + if QBCore.Functions.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 b02a55b..e33abbc 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -7,18 +7,20 @@ function LoadModel(hash) while not HasModelLoaded(hash) do Wait(3000) end -end +end + local function pick(loc) if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", loc) end + RegisterNetEvent('Mescaline:respawnCane', function(loc) local v = GlobalState.Mescaline[loc] local hash = GetHashKey(v.model) if not Mescaline[loc] then Mescaline[loc] = CreateObject(hash, v.location, false, true, true) Freeze(Mescaline[loc], true, v.heading) - AddSingleModel(Mescaline[loc], {icon = "fas fa-hand",label = "pick Cactus",action = function() pick(loc) end}, loc ) + AddSingleModel(Mescaline[loc], {icon = "fas fa-hand",label = lang.targets.mescaline.pick, action = function() pick(loc) end}, loc ) end end) @@ -38,7 +40,7 @@ RegisterNetEvent("Mescaline:init", function() if not v.taken then Mescaline[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(Mescaline[k], true, v.heading) - AddSingleModel(Mescaline[k], {icon = "fas fa-hand",label = "pick Cactus",action = function() pick(k) end}, k) + AddSingleModel(Mescaline[k], {icon = "fas fa-hand",label = lang.targets.mescaline.pick,action = function() pick(k) end}, k) end end end) @@ -82,7 +84,7 @@ local chance2 = math.random(1,100) if not progressbar(Lang.mescaline.eat, 4000, 'uncuff') then return end if chance <= Config.Badtrip then AlienEffect() - clone = ClonePed(PlayerPedId(), false, false, true) + local clone = ClonePed(PlayerPedId(), false, false, true) SetEntityAsMissionEntity(clone) SetEntityVisible(clone, true) SetPedRelationshipGroupHash(clone) diff --git a/client/meth.lua b/client/meth.lua index a96aec5..bf1b0a1 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -20,7 +20,7 @@ end local function dials() if amonia == true then - if not minigame(2, 8) then + if not minigame() then AddExplosion(1005.773, -3200.402, -38.524, 49, 10, true, false, true, true) ClearPedTasks(PlayerPedId()) amonia = nil @@ -41,7 +41,17 @@ if tray then Freeze(bucket, true, 90.0) SmashMeth() Wait(100) - AddSingleModel(bucket, {name = 'bucket',icon = 'fa-solid fa-car',label = 'Bag Meth',action = function() DeleteObject(bucket)amonia = nil heated = nil tray = nil active = nil BagMeth() TriggerServerEvent('md-drugs:server:getmeth')end,}, bucket) + AddSingleModel(bucket, + {name = 'bucket',icon = 'fa-solid fa-car',label = Lang.targets.meth.bag, + action = function() + DeleteObject(bucket) + amonia = nil + heated = nil + tray = nil + active = nil + BagMeth() + TriggerServerEvent('md-drugs:server:getmeth') + end,}, bucket) end end @@ -74,34 +84,35 @@ end) CreateThread(function() - AddBoxZoneSingle("methTeleOut",Config.MethTeleIn, {name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} ) - AddBoxZoneSingle("methtelein",Config.MethTeleOut, {name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleIn) end} ) + AddBoxZoneSingle("methTeleOut",Config.MethTeleIn, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.enter, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} ) + AddBoxZoneSingle("methtelein",Config.MethTeleOut, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.exit, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleIn) end} ) local options = { - { name = 'methcook', icon = "fas fa-sign-in-alt", label = "Cook Meth", distance = 2.5, action = function() startcook() end, onSelect = function() startcook() end, + { name = 'methcook', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, onSelect = function() startcook() end, canInteract = function() if amonia == nil and active == nil then return true end end, }, - { name = 'grabtray', icon = "fas fa-sign-in-alt", label = "Grab Tray", distance = 2.5, onSelect = function() trayscarry() end, action = function() trayscarry() end, + { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, onSelect = function() trayscarry() end, action = function() trayscarry() end, canInteract = function() if heated and amonia and tray == nil then return true end end, }, } AddBoxZoneMultiOptions("cookmeth",vector3(1005.72, -3200.33, -38.52), options ) - AddBoxZoneSingle('boxmeth', vector3(1012.15, -3194.04, -39.20), {name = 'boxmeth',icon = "fas fa-sign-in-alt",label = "Box Up Meth",action = function() smash()end, + AddBoxZoneSingle('boxmeth', vector3(1012.15, -3194.04, -39.20), {name = 'boxmeth',icon = "fas fa-sign-in-alt",label = Lang.targets.meth.box,action = function() smash()end, canInteract = function() if tray then return true end end}) - AddBoxZoneSingle('adjustdials',vector3(1007.89, -3201.17, -38.99),{ name = 'adjustdials', icon = "fas fa-sign-in-alt", label = "Adjust Dials", distance = 5, action = function() dials() end, + AddBoxZoneSingle('adjustdials',vector3(1007.89, -3201.17, -38.99),{ name = 'adjustdials', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.adjust, + distance = 5, action = function() dials() end, canInteract = function() if amonia and heated == nil then return true end end }) if Config.MethHeist == false then - AddBoxZoneMulti('methep', Config.MethEph, {icon = "fas fa-sign-in-alt", label = "Steal Ephedrine", event = 'md-drugs:client:stealeph'}) - AddBoxZoneMulti('methace', Config.Methace, {icon = "fas fa-sign-in-alt", label = "Steal Acetone", event = 'md-drugs:client:stealace'}) + AddBoxZoneMulti('methep', Config.MethEph, {icon = "fas fa-sign-in-alt", label = Lang.targets.meth.eph, event = 'md-drugs:client:stealeph'}) + AddBoxZoneMulti('methace', Config.Methace, {icon = "fas fa-sign-in-alt", label = Lang.targets.meth.ace, event = 'md-drugs:client:stealace'}) end end) @@ -114,7 +125,7 @@ if not Config.MethHeist == false then Freeze(methdealer, true, 220.0) Wait(100) AddSingleModel(methdealer,{ - label = "Get Mission", + label = Lang.targets.meth.mission, icon = "fas fa-eye", action = function() Notify(Lang.meth.mission, "success") diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 69f132c..391d5b2 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -6,13 +6,12 @@ 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 oxycar = CreateVehicle("burrito3",Config.truckspawn.x, Config.truckspawn.y,Config.truckspawn.z, Config.truckspawn.h, true, false) + local oxycar = CreateVehicle("burrito3",Config.truckspawn.x, Config.truckspawn.y,Config.truckspawn.z, Config.truckspawn.w, true, false) exports[Config.Fuel]:SetFuel(oxycar, 100.0) TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(oxycar)) Notify(Lang.oxy.truck, 'success') TriggerEvent("md-drugs:client:getoxylocationroute") - SetVehicleEngineOn(oxycar, true, true) - AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fas fa-box-circle-check", label = "Get Package"}, nil ) + AddSingleModel(oxycar, { event = "md-drugs:client:getfromtrunk", icon = "fas fa-box-circle-check", label = Lang.targets.oxy.pack}, nil ) end) @@ -27,7 +26,7 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function() SetBlipAsShortRange(deliveryBlip, false) SetBlipColour(deliveryBlip, 27) BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(text) + AddTextComponentSubstringPlayerName('Oxy Buyer') EndTextCommandSetBlipName(deliveryBlip) SetBlipRoute(deliveryBlip, true) local current = "g_m_y_famdnf_01" @@ -38,8 +37,8 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function() Wait(1000) until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0 RemoveBlip(deliveryBlip) - PoliceCall(Config.PoliceAlertOxy) - AddSingleModel(oxybuyer, { type = "client", label = "Talk To Buyer", icon = "fas fa-eye", + PoliceCall(Config.PoliceAlertOxy) + AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fas fa-eye", action = function() if carryPackage then if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end @@ -78,7 +77,6 @@ end) RegisterNetEvent("md-drugs:client:giveoxybox", function(data) - if carryPackage then if not progressbar(Lang.oxy.hand, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:giveoxybox") diff --git a/client/pharma.lua b/client/pharma.lua index e608c93..00875b1 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,15 +1,16 @@ local QBCore = exports['qb-core']:GetCoreObject() RegisterNetEvent("md-drugs:client:prescriptionpad", function(args) +local icon, event = 'fa-solid fa-file-prescription', 'md-drugs:client:writeprescription' if QBCore.Functions.GetPlayerData().job.type == Config.PharmaJob then lib.registerContext({ id = 'prescriptionpad', title = "Prescription Pad", options = { - {title = 'Give Vics', description = 'Give Vics ', icon = 'fa-solid fa-file-prescription', event = 'md-drugs:client:writeprescription', args = {item = 'vicodin_prescription'}}, - {title = 'Give Madderal', description = 'Give Madderal ', icon = 'fa-solid fa-file-prescription', event = 'md-drugs:client:writeprescription', args = {item = 'adderal_prescription'}}, - {title = 'Give Morphin',description = 'Give Morphin ',icon = 'fa-solid fa-file-prescription', event = 'md-drugs:client:writeprescription', args = {item = 'morphine_prescription'}}, - {title = 'Give Zany', description = 'Give Zany ', icon = 'fa-solid fa-file-prescription', event = 'md-drugs:client:writeprescription', args = {item = 'xanax_prescription'} }, + {title = 'Give Vics', description = 'Give Vics ', icon = icon, event = event, args = {item = 'vicodin_prescription'}}, + {title = 'Give Madderal', description = 'Give Madderal ', icon = icon, event = event, args = {item = 'adderal_prescription'}}, + {title = 'Give Morphin', description = 'Give Morphin ', icon = icon, event = event, args = {item = 'morphine_prescription'}}, + {title = 'Give Zany', description = 'Give Zany ', icon = icon, event = event, args = {item = 'xanax_prescription'} }, } }) lib.showContext('prescriptionpad') @@ -41,7 +42,7 @@ RegisterNetEvent("md-drugs:client:unbottle", function(item) TriggerServerEvent('md-drugs:server:unbottle', item) end) - +-- TODO: @Mustachedom convert to consumables RegisterNetEvent('md-drugs:client:takepharma', function(itemName) if not progressbar(Lang.Pharma.consume, 1000, 'eat') then return end if itemName == "vicodin" then diff --git a/client/shrooms.lua b/client/shrooms.lua index 5507ebc..c5baefa 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -9,6 +9,7 @@ function LoadModel(hash) Wait(3000) end end + local function pick(loc) if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) @@ -19,7 +20,7 @@ RegisterNetEvent('shrooms:respawnCane', function(loc) if not shrooms[loc] then shrooms[loc] = CreateObject(hash, v.location, false, true, true) Freeze(shrooms[loc], true, v.heading) - AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = "pick shrooms", action = function() pick(loc) end }, loc ) + AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(loc) end }, loc ) end end) AddEventHandler('onResourceStart', function(resource) @@ -60,7 +61,7 @@ end) if not v.taken then shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(shrooms[k], true, v.heading) - AddSingleModel(shrooms[k],{ icon = "fas fa-hand", label = "pick shrooms", action = function() pick(k) end }, k ) + AddSingleModel(shrooms[k],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(k) end }, k ) end end end) diff --git a/client/target.lua b/client/target.lua index c25572c..d45bcc4 100644 --- a/client/target.lua +++ b/client/target.lua @@ -1,23 +1,23 @@ local QBCore = exports['qb-core']:GetCoreObject() - +local icon = "fas fa-sign-in-alt" CreateThread(function() - AddBoxZoneMulti('makepowder', Config.MakePowder, { type = "client", event = "md-drugs:client:makepowder", icon = "fas fa-sign-in-alt", label = "chop it up"}) -- coke - AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Enter Building",action = function() tele(Config.CokeTeleOut) end,}) -- coke - AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {name = 'teleout',icon = "fas fa-sign-in-alt",label = "Exit Building",action = function() tele(Config.CokeTeleIn) end,}) -- coke - AddBoxZoneMulti('steallysergic', Config.lysergicacid, { type = "client", event = "md-drugs:client:getlysergic", icon = "fas fa-sign-in-alt", label = "stealing Lysergic"}) -- lsd - AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {type = "client", event = "md-drugs:client:getdiethylamide", icon = "fas fa-sign-in-alt", label = "stealing Diethylamide"}) -- lsd - AddBoxZoneMulti('gettabs', Config.gettabs, {type = "client", event = "md-drugs:client:buytabs", icon = "fas fa-sign-in-alt", label = "Buy Tabs"}) -- lsd - AddBoxZoneMulti('dryheroin', Config.dryplant, {type = "client",event = "md-drugs:client:dryplant", icon = "fas fa-sign-in-alt", label = "Dry Poppies"}) -- heroin - AddBoxZoneMulti('cutheroin', Config.cutheroinone, {type = "client", event = "md-drugs:client:cutheroin", icon = "fas fa-sign-in-alt", label = "Cut Heroin"}) -- heroin - AddBoxZoneMulti('fillneedle', Config.fillneedle, {type = "client", event = "md-drugs:client:fillneedle", icon = "fas fa-sign-in-alt", label = "Fill Needles"}) -- heroin - AddBoxZoneMulti('makecrack', Config.makecrack, {type = "client", event = "md-drugs:client:makecrackone", icon = "fas fa-sign-in-alt", label = "Cook Crack"}) -- crack - AddBoxZoneMulti('bagcrack', Config.bagcrack, {type = "client", event = "md-drugs:client:bagcrack", icon = "fas fa-sign-in-alt", label = "Bag Crack"}) -- crack - AddBoxZoneMulti('fillprescription', Config.FillPrescription, {type = "client", event = "md-drugs:client:fillprescription", icon = "fas fa-sign-in-alt", label = "Fill Prescription"}) -- pharma - AddBoxZoneSingle('payfortruck', Config.Payfortruck, { event = "md-drugs:client:GetOxyCar", icon = "fas fa-sign-in-alt", label = "Pay For Truck"}) -- oxy runs - AddBoxZoneSingle('drymescaline', Config.DryOut, { type = "client", event = "md-drugs:client:drymescaline", icon = "fas fa-sign-in-alt", label = "Dry Out"}) -- mescaline - AddBoxZoneMulti('stealisosafrole', Config.isosafrole, {type = "client", event = "md-drugs:client:stealisosafrole", icon = "fas fa-sign-in-alt", label = "Steal Isosafrole"}) -- xtc - AddBoxZoneMulti('stealmdp2p', Config.mdp2p, {type = "client", event = "md-drugs:client:stealmdp2p", icon = "fas fa-sign-in-alt", label = "Steal MDP2P"}) -- xtc - AddBoxZoneMulti('rawxtcloc', Config.rawxtcloc, {type = "client", event = "md-drugs:client:makingrawxtc", icon = "fas fa-sign-in-alt", label = "Make Raw XTC"}) -- xtc - AddBoxZoneSingle('buypress', Config.buypress, { type = "client",event = "md-drugs:client:buypress", icon = 'fas fa-eye', label = 'Buy Press'}) -- xtc - AddBoxZoneMulti('stamp', Config.stamp, {type = "client", event = "md-drugs:client:stampwhite", icon = 'fas fa-eye', label = 'Stamp Pills'}) -- xtc + AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {action = function()tele(Config.CokeTeleOut)end, icon = icon, label = Lang.targets.coke.enter}) -- coke + AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {action = function()tele(Config.CokeTeleIn) end, icon = icon, label = Lang.targets.coke.exits}) -- coke + AddBoxZoneMulti('makepowder', Config.MakePowder, {event = "md-drugs:client:makepowder", icon = icon, label = Lang.targets.coke.chop}) -- coke + AddBoxZoneMulti('steallysergic', Config.lysergicacid, {event = "md-drugs:client:getlysergic", icon = icon, label = Lang.targets.lsd.lys}) -- lsd + AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {event = "md-drugs:client:getdiethylamide", icon = icon, label = Lang.targets.lsd.die}) -- lsd + AddBoxZoneMulti('gettabs', Config.gettabs, {event = "md-drugs:client:buytabs", icon = icon, label = Lang.targets.lsd.buyt}) -- lsd + AddBoxZoneMulti('dryheroin', Config.dryplant, {event = "md-drugs:client:dryplant", icon = icon, label = Lang.targets.heroin.dry}) -- heroin + AddBoxZoneMulti('cutheroin', Config.cutheroinone, {event = "md-drugs:client:cutheroin", icon = icon, label = Lang.targets.heroin.cut}) -- heroin + AddBoxZoneMulti('fillneedle', Config.fillneedle, {event = "md-drugs:client:fillneedle", icon = icon, label = Lang.targets.heroin.fill}) -- heroin + AddBoxZoneMulti('makecrack', Config.makecrack, {event = "md-drugs:client:makecrackone", icon = icon, label = Lang.targets.crack.cook}) -- crack + AddBoxZoneMulti('bagcrack', Config.bagcrack, {event = "md-drugs:client:bagcrack", icon = icon, label = Lang.targets.crack.bag}) -- crack + AddBoxZoneMulti('fillprescription', Config.FillPrescription, {event = "md-drugs:client:fillprescription", icon = icon, label = Lang.targets.pha.fill}) -- pharma + AddBoxZoneSingle('payfortruck', Config.Payfortruck, {event = "md-drugs:client:GetOxyCar", icon = icon, label = Lang.targets.oxy.pay}) -- oxy runs + AddBoxZoneSingle('drymescaline', Config.DryOut, {event = "md-drugs:client:drymescaline", icon = icon, label = Lang.targets.mescaline.dry}) -- mescaline + AddBoxZoneMulti('stealisosafrole', Config.isosafrole, {event = "md-drugs:client:stealisosafrole", icon = icon, label = Lang.targets.xtc.iso}) -- xtc + AddBoxZoneMulti('stealmdp2p', Config.mdp2p, {event = "md-drugs:client:stealmdp2p", icon = icon, label = Lang.targets.xtc.mdp}) -- xtc + AddBoxZoneMulti('rawxtcloc', Config.rawxtcloc, {event = "md-drugs:client:makingrawxtc", icon = icon, label = Lang.targets.xtc.raw}) -- xtc + AddBoxZoneSingle('buypress', Config.buypress, {event = "md-drugs:client:buypress", icon = icon, label = Lang.targets.xtc.press}) -- xtc + AddBoxZoneMulti('stamp', Config.stamp, {event = "md-drugs:client:stampwhite", icon = icon, label = Lang.targets.xtc.stamp}) -- xtc end) diff --git a/client/travellingmerchant.lua b/client/travellingmerchant.lua index bfed39c..9d33363 100644 --- a/client/travellingmerchant.lua +++ b/client/travellingmerchant.lua @@ -28,6 +28,7 @@ CreateThread(function() } lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu}) end + sorter(ShopMenu, 'title') end) @@ -44,6 +45,7 @@ RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data) }, { type = 'number', label = "Amount to buy", description = settext, min = 0, max = max, default = 1 }, }) + if not dialog[1] then return end if data.cost == "Free" then data.cost = 0 end TriggerServerEvent("md-drugs:server:travellingmerchantox", dialog[2], dialog[1], data.item, data.cost, data.table, data.num ) end) diff --git a/client/weed.lua b/client/weed.lua index 0998749..b0cc124 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -2,6 +2,7 @@ local QBCore = exports['qb-core']:GetCoreObject() local WeedPlant = {} local exploded = nil local drying = false + function LoadModel(hash) hash = GetHashKey(hash) RequestModel(hash) @@ -29,7 +30,7 @@ RegisterNetEvent('weed:respawnCane', function(loc) AddSingleModel(WeedPlant[loc], { icon = "fas fa-hand", - label = "Pick Weed", + label = Lang.targets.weed.pick, action = function() if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", loc) @@ -53,7 +54,7 @@ RegisterNetEvent("weed:init", function() AddSingleModel(WeedPlant[k], { icon = "fas fa-hand", - label = "Pick Weed", + label = Lang.targets.weed.pick, action = function() if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", k) @@ -90,7 +91,7 @@ CreateThread(function() AddBoxZoneMulti('weeddry', Config.WeedDry, { name = 'dryweed', icon = "fas fa-sign-in-alt", - label = "Dry Weed", + label = Lang.targets.weed.dry, distance = 1, action = function() if not ItemCheck('wetcannabis') then return end @@ -101,12 +102,12 @@ CreateThread(function() local weedplant = CreateObject("bkr_prop_weed_drying_01a", loc.x, loc.y+.2, loc.z, true, false) drying = true FreezeEntityPosition(weedplant, true) - Notify("Wait A little Bit To Dry", "success") + Notify(Lang.Weed.wait, "success") Wait(math.random(1000,5000)) - Notify("Take Down The Weed", "success") + Notify(Lang.Weed.take, "success") AddSingleModel(weedplant, { icon = "fas fa-sign-in-alt", - label = "Pick Up Weed", + label = Lang.targets.weed.dpick, action = function() DeleteEntity(weedplant) drying = false @@ -121,23 +122,23 @@ CreateThread(function() if hasJob() then return true end end }) -AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Enter Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end, +AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.enter, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end, canInteract = function() if hasJob() then return true end end }) -AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = "Exit Building", distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end, +AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.exit, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end, canInteract = function() if hasJob() then return true end end }) -AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = 'Open Butter Menu', action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt", +AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = Lang.Weed.butt, action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt", canInteract = function() if hasJob() then return true end end }) AddBoxZoneSingle('makeoil',Config.MakeOil, { name = 'Oil', icon = "fas fa-sign-in-alt", - label = "Make Oil", + label = Lang.targets.weed.oil, action = function() if not ItemCheckMulti({'butane', 'grindedweed'}) then return end - if not minigame(2, 8) then + if not minigame() then local explosion = math.random(1,100) local loc = GetEntityCoords(PlayerPedId()) if explosion <= 99 then @@ -173,10 +174,10 @@ CreateThread(function() BikerWeedFarm.Plant8.Clear(false) BikerWeedFarm.Plant9.Clear(false) RefreshInterior(BikerWeedFarm.interiorId) - stove = CreateObject("prop_cooker_03",vector3(1045.49, -3198.46, -38.15-1), true, false) + local stove = CreateObject("prop_cooker_03",vector3(1045.49, -3198.46, -38.15-1), true, false) SetEntityHeading(stove, 270.00) FreezeEntityPosition(stove, true) - stove2 = CreateObject("prop_cooker_03",vector3(1038.90, -3198.66, -38.17-1), true, false) + local stove2 = CreateObject("prop_cooker_03",vector3(1038.90, -3198.66, -38.17-1), true, false) SetEntityHeading(stove2, 90.00) FreezeEntityPosition(stove2, true) end) @@ -220,16 +221,15 @@ local current = "u_m_m_jesus_01" } lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop}) end + sorter(WeedShop, 'title') end) CreateThread(function() local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'edibles') local items2 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'blunts') local items3 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'bluntwrap') -local craft = {} -local blunt = {} -local bluntwrap = {} -local label = {} +local craft, blunt, bluntwrap, label = {}, {}, {}, {} + for k, v in pairs (items) do label = {} local item = '' @@ -303,6 +303,9 @@ for k, v in pairs (items3) do } lib.registerContext({id = 'mddrugsbluntwraps',title = "Dip Blunt Wrap", options = bluntwrap}) end +sorter(craft, 'title') +sorter(blunt, 'title') +sorter(bluntwrap, 'title') end) RegisterNetEvent("md-drugs:client:MakeWeedItems", function(data) diff --git a/client/wholesale.lua b/client/wholesale.lua index 5c5579c..4ccf90c 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -5,7 +5,7 @@ local deliveryBlip = nil RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) if not GetCops(Config.PoliceCount) then return end if miss then - Notify('Already Called Someone', 'error') + Notify(Lang.Wholesale.al, 'error') else TriggerServerEvent('md-drugs:server:RemoveBurner', drug) Notify(notify, 'success') @@ -29,7 +29,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) SetEntityInvincible(drugdealer, true) AddSingleModel(drugdealer, { type = "client", - label = "Talk To Buyer", + label = Lang.Wholesale.talk, icon = "fas fa-eye", action = function() local luck = math.random(1,100) diff --git a/client/xtc.lua b/client/xtc.lua index 2909490..15f935b 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -1,7 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local xtcpress = false - RegisterNetEvent("md-drugs:client:setpress", function(type) if xtcpress then Notify(Lang.xtc.out, 'error') @@ -11,38 +10,30 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) progressbar('Setting Press On The Ground', 4000, 'uncuff') local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) PlaceObjectOnGroundProperly(press) - SetEntityHeading(press, head) + SetEntityHeading(press, head) local options = { { icon = "fas fa-eye", - label = "Make XTC", + label = Lang.targets.xtc.make, distance = 2.0, - action = function() - TriggerEvent("md-drugs:client:XTCMenu", type) - end, - onSelect = function() - TriggerEvent("md-drugs:client:XTCMenu", type) - end, + action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end, + onSelect = function() TriggerEvent("md-drugs:client:XTCMenu", type)end, canInteract = function() if xtcpress then return true end end }, { - icon = "fas fa-eye", - label = "Pick Up", - action = function() - TriggerEvent("md-drugs:client:GetPressBack", type, press) - end, - onSelect = function() - TriggerEvent("md-drugs:client:GetPressBack", type, press) - end, + icon = "fas fa-eye", + label = Lang.targets.xtc.pick, + action = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, + onSelect = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, distance = 2.0, - canInteract = function() - if xtcpress then return true end end + canInteract = function() + if xtcpress then return true end end }, } AddMultiModel(press, options, nil) end -end) +end) RegisterNetEvent("md-drugs:client:XTCMenu", function(type) lib.registerContext({ @@ -84,21 +75,21 @@ RegisterNetEvent("md-drugs:client:XTCMenu", function(type) end) RegisterNetEvent("md-drugs:client:GetPressBack", function(type, press) - if not progressbar('Packing Up The Press', 5000, 'uncuff') then return end + if not progressbar(Lang.xtc.pickup, 5000, 'uncuff') then return end DeleteObject(press) xtcpress = false TriggerServerEvent("md-drugs:server:getpressback", type) end) RegisterNetEvent("md-drugs:client:stealisosafrole", function(data) - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end if not progressbar(Lang.xtc.iso, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealisosafrole",data.data) end) RegisterNetEvent("md-drugs:client:stealmdp2p", function(data) - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end if not progressbar(Lang.xtc.mdp2p, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stealmdp2p", data.data) end) @@ -120,61 +111,50 @@ end) ------------------------------------------------------------------ Stamping RegisterNetEvent("md-drugs:client:stampwhite", function(data) - lib.registerContext({ - id = 'stampxtc', - title = 'Stamp XTC Menu', + lib.registerContext({ id = 'stampxtc', title = 'Stamp XTC Menu', options = { - { - icon = GetImage('white_xtc'), - title = 'White XTC', + { icon = GetImage('white_xtc'), title = 'White XTC', onSelect = function() - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end - if not progressbar('Stamping White Pills', 4000, 'uncuff') then return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end + if not progressbar(string.format(Lang.xtc.stamp, 'White'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampwhite",data.data) - end + end }, - { - icon = GetImage('red_xtc'), - title = 'Red XTC', + { icon = GetImage('red_xtc'), title = 'Red XTC', onSelect = function() - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end - if not progressbar('Stamping Red Pills', 4000, 'uncuff') then return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end + if not progressbar(string.format(Lang.xtc.stamp, 'Red'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampred", data.data) end }, - { - icon = GetImage('orange_xtc'), - title = 'Orange XTC', + { icon = GetImage('orange_xtc'), title = 'Orange XTC', onSelect = function() - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end - if not progressbar('Stamping Orange Pills', 4000, 'uncuff') then return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end + if not progressbar(string.format(Lang.xtc.stamp, 'Orange'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stamporange", data.data) end, }, - { - icon = GetImage('blue_xtc'), - title = 'Blue XTC', + { icon = GetImage('blue_xtc'), title = 'Blue XTC', onSelect = function() - if not minigame(2, 8) then Notify(Lang.xtc.fail, "error") return end - if not progressbar('Stamping Blue Pills', 4000, 'uncuff') then return end + if not minigame() then Notify(Lang.xtc.fail, "error") return end + if not progressbar(string.format(Lang.xtc.stamp, 'Blue'), 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:stampblue", data.data) end }, - } - }) + }) lib.showContext('stampxtc') end) RegisterNetEvent("md-drugs:client:getsinglepress", function() - if not progressbar('Buying Press', 4000, 'uncuff') then return end + if not progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:buypress") end) RegisterNetEvent("md-drugs:client:exchangepresses", function(data) - if not progressbar('Buying Press', 4000, 'uncuff') then return end + if not progressbar(Lang.xtc.buyp, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:upgradepress", data.data) end) diff --git a/shared/english.lua b/shared/english.lua index 9b41502..bd401d0 100644 --- a/shared/english.lua +++ b/shared/english.lua @@ -4,17 +4,98 @@ Lang.targets = { coke = { pick = 'Pick Cocaine', cut = 'Cut Cocaine', - bag = 'Bag 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' + }, + 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' + }, + oxy = { + pack = 'Get Oxy Package', + talk = 'Talk To Buyer', + pay = 'Pay For Truck', + }, + pha = { + fill = 'Fill Prescription', + }, + shrooms = { + pick = 'Pick Shrooms', + }, + 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 = { @@ -106,6 +187,7 @@ Lang.lsd = { 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', @@ -169,6 +251,8 @@ Lang.Weed = { 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', @@ -183,6 +267,13 @@ Lang.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' +} + +Lang.Wholesale = { + al = 'Already Called Someone!' } \ No newline at end of file From 9df44f726d458103f7ca908966077668dac2c2f2 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:49:03 -0700 Subject: [PATCH 03/20] fix --- client/cocaine.lua | 11 ++++++----- client/deliveries.lua | 2 +- client/heroin.lua | 2 +- client/lsd.lua | 2 +- client/mescaline.lua | 4 ++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/client/cocaine.lua b/client/cocaine.lua index 8553d7a..d55dd90 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -4,9 +4,9 @@ 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) -return true + if not progressbar(Lang.Coke.picking, 4000, 'uncuff') then return end + TriggerServerEvent("coke:pickupCane", loc) + return true end RegisterNetEvent('coke:respawnCane', function(loc) @@ -15,7 +15,7 @@ RegisterNetEvent('coke:respawnCane', function(loc) if not CocaPlant[loc] then CocaPlant[loc] = CreateObject(hash, v.location, false, true, true) Freeze(CocaPlant[loc], true, v.heading) - AddSingleModel(CocaPlant[loc], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(loc) then return end end}, loc) + AddSingleModel(CocaPlant[loc], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(loc) then return end end}, loc) end end) @@ -31,7 +31,7 @@ RegisterNetEvent("coke:init", function() 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) - AddSingleModel(CocaPlant[k], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(k) then return end end}, k) + AddSingleModel(CocaPlant[k], {icon = 'fas fa-hand', label = Lang.targets.coke.pick, action = function() if not pick(k) then return end end}, k) end end end) @@ -42,6 +42,7 @@ AddEventHandler('onResourceStart', function(resource) TriggerEvent('coke:init') end end) + RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() Wait(3000) LoadModel('prop_plant_01a') diff --git a/client/deliveries.lua b/client/deliveries.lua index b933660..dec9466 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -76,7 +76,7 @@ CreateThread(function() }, { icon = 'fas fa-user-secret', - label = string.format(Lang.targets.Delivery.openm, v.name), + label = string.format(Lang.targets.Delivery.open, v.name), action = function() TriggerEvent('md-drugs:client:opendealermenu') end, onSelect = function() TriggerEvent('md-drugs:client:opendealermenu') end } diff --git a/client/heroin.lua b/client/heroin.lua index 3f4eb26..454a52e 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -13,7 +13,7 @@ local Ped = "g_m_y_famdnf_01" local labkitlocation = Config.buyheroinlabkit local heroinkitdealer = CreatePed(0, Ped, labkitlocation.x, labkitlocation.y, labkitlocation.z-1, labkitlocation.w, false, false) Freeze(heroinkitdealer, true, labkitlocation.w) - AddSingleModel(heroinkitdealer, { label = lang.targets.heroin.kit, icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) + AddSingleModel(heroinkitdealer, { label = Lang.targets.heroin.kit, icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) end) ---- plant spawns dont edit diff --git a/client/lsd.lua b/client/lsd.lua index fcc16a5..63a40ce 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -9,7 +9,7 @@ local Ped = "g_m_y_famdnf_01" lib.requestModel(Ped, Config.RequestModelTime) local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false) Freeze(tabdealer, true, Config.buylsdlabkit.w) - AddSingleModel(tabdealer,{ type = "client", label = lang.targets.lsd.buy, icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer ) + AddSingleModel(tabdealer,{ type = "client", label = Lang.targets.lsd.buy, icon = "fas fa-eye", event = "md-drugs:client:buylabkit", distance = 2.0}, tabdealer ) end) diff --git a/client/mescaline.lua b/client/mescaline.lua index e33abbc..a8d3ace 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -20,7 +20,7 @@ RegisterNetEvent('Mescaline:respawnCane', function(loc) if not Mescaline[loc] then Mescaline[loc] = CreateObject(hash, v.location, false, true, true) Freeze(Mescaline[loc], true, v.heading) - AddSingleModel(Mescaline[loc], {icon = "fas fa-hand",label = lang.targets.mescaline.pick, action = function() pick(loc) end}, loc ) + AddSingleModel(Mescaline[loc], {icon = "fas fa-hand",label = Lang.targets.mescaline.pick, action = function() pick(loc) end}, loc ) end end) @@ -40,7 +40,7 @@ RegisterNetEvent("Mescaline:init", function() if not v.taken then Mescaline[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(Mescaline[k], true, v.heading) - AddSingleModel(Mescaline[k], {icon = "fas fa-hand",label = lang.targets.mescaline.pick,action = function() pick(k) end}, k) + AddSingleModel(Mescaline[k], {icon = "fas fa-hand",label = Lang.targets.mescaline.pick,action = function() pick(k) end}, k) end end end) From e9f722a140b18fd6aade3900533d2ca46c1c7b1d Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Thu, 24 Oct 2024 12:56:34 -0700 Subject: [PATCH 04/20] reduce code, more langs, patch work, moved pharma drugs to consumables --- client/animationsandfunctions.lua | 286 ++++++++++++++---------------- client/cornerselling.lua | 4 +- client/crack.lua | 2 +- client/deliveries.lua | 13 +- client/functions.lua | 2 +- client/lean.lua | 2 +- client/pharma.lua | 14 -- client/travellingmerchant.lua | 45 ++--- client/weed.lua | 139 +++++---------- client/xtc.lua | 10 +- server/functions.lua | 1 - server/pharma.lua | 9 - shared/config.lua | 4 +- shared/consumables.lua | 280 +++++++++++++++-------------- shared/english.lua | 14 +- 15 files changed, 377 insertions(+), 448 deletions(-) diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 2dbbabd..1c677d7 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -14,78 +14,73 @@ end function MethCooking() -local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" -lib.requestAnimDict(animDict, 500) -dict = "scr_ornate_heist" -local ped = PlayerPedId() -SetEntityCoords(ped, vector3(1005.773, -3200.402, -38.524)) -Wait(1) -local targetPosition = GetEntityCoords(ped) -local animDuration = GetAnimDuration(animDict, animName) * 800 -FreezeEntityPosition(ped, true) -local scenePos, sceneRot = vector3(1010.656, -3198.445, -38.925), vector3(0.0, 0.0, 0.0) -local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) -NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) -local sacid = CreateObjectNoOffset(`bkr_prop_meth_sacid`, targetPosition, 1, 1, 0) -NetworkAddEntityToSynchronisedScene(sacid, netScene, animDict, "chemical_pour_short_sacid", 4.0, -8.0, 1) -local ammonia = CreateObjectNoOffset(`bkr_prop_meth_ammonia`, targetPosition, 1, 1, 0) -NetworkAddEntityToSynchronisedScene(ammonia, netScene, animDict, "chemical_pour_short_ammonia", 4.0, -8.0, 1) -NetworkStartSynchronisedScene(netScene) -Wait(animDuration) -NetworkStopSynchronisedScene(netScene) -DeleteObject(sacid) -DeleteObject(ammonia) -FreezeEntityPosition(ped, false) -lib.requestModel('hei_prop_heist_thermite', 2000) -loadParticle('scr_ornate_heist') - -local thermite = CreateObject('hei_prop_heist_thermite', vector3(1005.76, -3201.3, -39.25), true, false, false) -FreezeEntityPosition(thermite, true) -SetEntityRotation(thermite, 190.0, 90.0, 140.0, 3, true ) -Wait(1000) -local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) -Wait(math.random(10000, 20000)) -StopParticleFxLooped(therm, true) + local animDict, animName = "anim@amb@business@meth@meth_monitoring_cooking@cooking@", "chemical_pour_short_cooker" + lib.requestAnimDict(animDict, 500) + SetEntityCoords(PlayerPedId(), vector3(1005.773, -3200.402, -38.524)) + local targetPosition = GetEntityCoords(PlayerPedId()) + local animDuration = GetAnimDuration(animDict, animName) * 800 + FreezeEntityPosition(PlayerPedId(), true) + local scenePos, sceneRot = vector3(1010.656, -3198.445, -38.925), vector3(0.0, 0.0, 0.0) + local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(PlayerPedId(), netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + local sacid = CreateObjectNoOffset(`bkr_prop_meth_sacid`, targetPosition, 1, 1, 0) + NetworkAddEntityToSynchronisedScene(sacid, netScene, animDict, "chemical_pour_short_sacid", 4.0, -8.0, 1) + local ammonia = CreateObjectNoOffset(`bkr_prop_meth_ammonia`, targetPosition, 1, 1, 0) + NetworkAddEntityToSynchronisedScene(ammonia, netScene, animDict, "chemical_pour_short_ammonia", 4.0, -8.0, 1) + NetworkStartSynchronisedScene(netScene) + Wait(animDuration) + NetworkStopSynchronisedScene(netScene) + DeleteObject(sacid) DeleteObject(ammonia) + FreezeEntityPosition(PlayerPedId(), false) + lib.requestModel('hei_prop_heist_thermite', 2000) + loadParticle('scr_ornate_heist') + local thermite = CreateObject('hei_prop_heist_thermite', vector3(1005.76, -3201.3, -39.25), true, false, false) + FreezeEntityPosition(thermite, true) + SetEntityRotation(thermite, 190.0, 90.0, 140.0, 3, true ) + Wait(1000) + local therm = StartParticleFxLoopedOnEntity('scr_heist_ornate_thermal_burn', thermite, 0.0, 1.4, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) + Wait(math.random(10000, 20000)) + StopParticleFxLooped(therm, true) end function SmashMeth() -local ver = "" -local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" -lib.requestAnimDict(animDict, 500) -local ped = PlayerPedId() -local targetPosition = vector3(1012.628, -3194.619, -39.589) -SetEntityCoords(ped, targetPosition) -Wait(1) -local animDuration = GetAnimDuration(animDict, animName) * 800 -FreezeEntityPosition(ped, true) -local scenePos, sceneRot = vector3(1008.734, -3196.646, -39.99), vector3(0.0, 0.0, 1.08) -local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) -NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) -local objects, sceneObjects = {}, { - { hash = `w_me_hammer`, animName = "break_weigh_" .. ver .. "hammer"}, - { hash = `bkr_Prop_Meth_SmashedTray_01_frag_`, animName = "break_weigh_"..ver.."tray01"}, - { hash = `bkr_Prop_Meth_Tray_02a`, animName = "break_weigh_"..ver.."tray01^1"}, - { hash = `bkr_Prop_Meth_Tray_02a`, animName = "break_weigh_"..ver.."tray01^2"}, - { hash = `bkr_Prop_Meth_SmashedTray_01_frag_`, animName = "break_weigh_"..ver.."tray01^3"}, -} -for i=1, #sceneObjects, 1 do - local obj = CreateObjectNoOffset(sceneObjects[i].hash, targetPosition, true, true, true) - NetworkAddEntityToSynchronisedScene(obj, netScene, animDict, sceneObjects[i].animName, 4.0, -8.0, 1) - objects[#objects+1] = obj -end -NetworkStartSynchronisedScene(netScene) -Wait(animDuration) -NetworkStopSynchronisedScene(netScene) -for i=1, #objects, 1 do - DeleteObject(objects[i]) -end -RemoveAnimDict(animDict) -FreezeEntityPosition(ped, false) + local ver = "" + local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char02" + lib.requestAnimDict(animDict, 500) + local ped = PlayerPedId() + local targetPosition = vector3(1012.628, -3194.619, -39.589) + SetEntityCoords(ped, targetPosition) + Wait(1) + local animDuration = GetAnimDuration(animDict, animName) * 800 + FreezeEntityPosition(ped, true) + local scenePos, sceneRot = vector3(1008.734, -3196.646, -39.99), vector3(0.0, 0.0, 1.08) + local netScene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, netScene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + local objects, sceneObjects = {}, { + { hash = `w_me_hammer`, animName = "break_weigh_" .. ver .. "hammer"}, + { hash = `bkr_Prop_Meth_SmashedTray_01_frag_`, animName = "break_weigh_"..ver.."tray01"}, + { hash = `bkr_Prop_Meth_Tray_02a`, animName = "break_weigh_"..ver.."tray01^1"}, + { hash = `bkr_Prop_Meth_Tray_02a`, animName = "break_weigh_"..ver.."tray01^2"}, + { hash = `bkr_Prop_Meth_SmashedTray_01_frag_`, animName = "break_weigh_"..ver.."tray01^3"}, + } + for i=1, #sceneObjects, 1 do + local obj = CreateObjectNoOffset(sceneObjects[i].hash, targetPosition, true, true, true) + NetworkAddEntityToSynchronisedScene(obj, netScene, animDict, sceneObjects[i].animName, 4.0, -8.0, 1) + objects[#objects+1] = obj + end + NetworkStartSynchronisedScene(netScene) + Wait(animDuration) + NetworkStopSynchronisedScene(netScene) + for i=1, #objects, 1 do + DeleteObject(objects[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) end function BagMeth() -local ver = "" + local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" lib.requestAnimDict(animDict, 500) local animDuration = GetAnimDuration(animDict, animName) * 1000 @@ -142,7 +137,6 @@ for i=1, #scenesList, 1 do end Wait(animDuration-11000) --- Citizen.Wait(45000) for i=1, #scenesList, 1 do NetworkStopSynchronisedScene(scenesList[i]) end @@ -154,18 +148,18 @@ FreezeEntityPosition(ped, false) end function Tray() -local pos = GetEntityCoords(PlayerPedId(), true) -RequestAnimDict('anim@heists@box_carry@') -while (not HasAnimDictLoaded('anim@heists@box_carry@')) do -Wait(7) -end -TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) -RequestModel("bkr_prop_meth_tray_02a") -while not HasModelLoaded("bkr_prop_meth_tray_02a") do -Wait(0) -end -local trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) -AttachEntityToEntity(trays, PlayerPedId(), GetPedBoneIndex(PlayerPedId(), 28422), 0.01,-0.2, -0.2, 20.0, 0.0, 0.0, true, true, false, true, 1, true) + local pos = GetEntityCoords(PlayerPedId(), true) + RequestAnimDict('anim@heists@box_carry@') + while (not HasAnimDictLoaded('anim@heists@box_carry@')) do + Wait(7) + end + TaskPlayAnim(PlayerPedId(), 'anim@heists@box_carry@', 'idle', 5.0, -1, -1, 50, 0, false, false, false) + RequestModel("bkr_prop_meth_tray_02a") + while not HasModelLoaded("bkr_prop_meth_tray_02a") do + Wait(0) + end + local trays = CreateObject("bkr_prop_meth_tray_02a", pos.x, pos.y, pos.z, true, true, true) + 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 @@ -183,52 +177,49 @@ function CutCoke() { hash = `prop_cs_credit_card`, animName = "coke_cut_v5_creditcard"}, { hash = `prop_cs_credit_card`, animName = "coke_cut_v5_creditcard^1"} }, - } -local scenesList, entitiesList = {}, {} -for i=1, #scenes, 1 do - local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) - NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) - for j=1, #scenes[i], 1 do - local s = scenes[i][j] - RequestModel(s.hash) - while not HasModelLoaded(s.hash) do - Wait(0) + local scenesList, entitiesList = {}, {} + for i=1, #scenes, 1 do + local scene = NetworkCreateSynchronisedScene(scenePos, sceneRot, 2, false, false, 1065353216, 0, 1.3) + NetworkAddPedToSynchronisedScene(ped, scene, animDict, animName, 1.5, -4.0, 1, 16, 1148846080, 0) + for j=1, #scenes[i], 1 do + local s = scenes[i][j] + RequestModel(s.hash) + while not HasModelLoaded(s.hash) do + Wait(0) + end + local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) + SetModelAsNoLongerNeeded(s.hash) + entitiesList[#entitiesList+1] = obj + NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) end - local obj = CreateObjectNoOffset(s.hash, coords, true, true, true) - SetModelAsNoLongerNeeded(s.hash) - entitiesList[#entitiesList+1] = obj - NetworkAddEntityToSynchronisedScene(obj, scene, animDict, s.animName, 4.0, -8.0, 1) + scenesList[#scenesList+1] = scene + end + DisableCamCollisionForEntity(ped) + FreezeEntityPosition(ped, true) + for i=1, #scenesList, 1 do + NetworkStartSynchronisedScene(scenesList[i]) end - scenesList[#scenesList+1] = scene -end -DisableCamCollisionForEntity(ped) -FreezeEntityPosition(ped, true) -for i=1, #scenesList, 1 do - NetworkStartSynchronisedScene(scenesList[i]) -end -Wait(animDuration-11000) -for i=1, #scenesList, 1 do - NetworkStopSynchronisedScene(scenesList[i]) -end -for i=1, #entitiesList, 1 do - DeleteEntity(entitiesList[i]) -end -RemoveAnimDict(animDict) -FreezeEntityPosition(ped, false) + Wait(animDuration-11000) + for i=1, #scenesList, 1 do + NetworkStopSynchronisedScene(scenesList[i]) + end + for i=1, #entitiesList, 1 do + DeleteEntity(entitiesList[i]) + end + RemoveAnimDict(animDict) + FreezeEntityPosition(ped, false) end CreateThread(function() - BikerCocaine = exports['bob74_ipl']:GetBikerCocaineObject() BikerCocaine.Style.Set(BikerCocaine.Style.upgrade) BikerCocaine.Security.Set(BikerCocaine.Security.upgrade) BikerCocaine.Details.Enable({BikerCocaine.Details.cokeBasic1, BikerCocaine.Details.cokeBasic2, BikerCocaine.Details.cokeBasic3}, true) - end) - function BagCoke() +function BagCoke() local ver = "" local animDict, animName = "anim@amb@business@meth@meth_smash_weight_check@", "break_weigh_"..ver.."char01" lib.requestAnimDict(animDict, 500) @@ -281,7 +272,6 @@ for i=1, #scenesList, 1 do end Wait(animDuration-11000) --- Citizen.Wait(45000) for i=1, #scenesList, 1 do NetworkStopSynchronisedScene(scenesList[i]) end @@ -382,18 +372,18 @@ end local hit = 0 function SpawnCarPedChase() -local ped = GetEntityCoords(PlayerPedId()) -local stoploc = vector3(-1157.63, -3056.71, 13.94) -local start = Config.StartLoc[math.random(1,#Config.StartLoc)] -if started then -- checks if active -else + local stoploc = vector3(-1157.63, -3056.71, 13.94) + local start = Config.StartLoc[math.random(1,#Config.StartLoc)] + if started then + Notify(Lang.lean.act,'error') + else started = true 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, 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) FreezeEntityPosition(pilot2, true) SetEntityInvincible(pilot2, true) SetEntityAsMissionEntity(leancar) @@ -401,16 +391,16 @@ else SetPedIntoVehicle(driver, leancar, -1) SetPedFleeAttributes(driver,false) TaskVehicleDriveToCoordLongrange(driver, leancar, stoploc.x, stoploc.y, stoploc.z-1, 50.0, 524288, 25.0) - SetPedKeepTask(driver, true) -- everything above is ped/ veh spawn - repeat -- repeats Wait(1000) only until + SetPedKeepTask(driver, true) + repeat Wait(1000) - until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 -- either the distance is within 20 OR the driver is dead + until #(GetEntityCoords(driver) - stoploc) < 20.0 or GetEntityHealth(driver) == 0 RemoveBlip(leancar) - if GetEntityHealth(driver) == 0 then -- once one of those thing ends, the loop breaks and carries on from here + if GetEntityHealth(driver) == 0 then AddSingleModel(leancar, { name = 'leancar', icon = 'fa-solid fa-car', label = 'Steal From Car', action = function() hit = hit + 1 - if not minigame(2,8) then return end + if not minigame() then return end TriggerServerEvent('md-drugs:server:givelean') started = nil if math.random(1,100) <= 30 or hit == 4 then @@ -421,7 +411,7 @@ else end end}, nil) else - repeat -- this second loop is to spawn the helicopter when the truck is in distance + repeat Wait(1000) until #(GetEntityCoords(driver) - GetEntityCoords(pilot2)) < 25.0 Wait( 3 * 1000) @@ -447,7 +437,8 @@ local stoploc = vector3(-1157.63, -3056.71, 13.94) local start = Config.StartLoc[math.random(1,#Config.StartLoc)] local startedmeth = false -if startedmeth then +if startedmeth then + Notify(Lang.meth.act,'error') else startedmeth = true lib.requestModel(`journey`, Config.RequestModelTime) @@ -473,7 +464,7 @@ else icon = 'fa-solid fa-car', label = 'Steal From Car', action = function() - if not minigame(2,8) then return end + if not minigame() then return end TriggerServerEvent('md-drugs:server:givemethingridients') startedmeth = nil if math.random(1,100) <= 30 then @@ -507,26 +498,25 @@ end function SetUpPeds() AddRelationshipGroup('setups') -local ped = GetEntityCoords(PlayerPedId()) -local peds = { - {x = ped.x+3, y = ped.y-5, z = ped.z-1, }, - {x = ped.x+6, y = ped.y-10, z = ped.z-1,}, - {x = ped.x+-2,y = ped.y+5, z = ped.z-1,}, - {x = ped.x+8, y = ped.y-12, z = ped.z-1,}, - {x = ped.x+5, y = ped.y-2, z = ped.z-1, }, - {x = ped.x+2, y = ped.y-20, z = ped.z-1,}, - {x = ped.x+1, y = ped.y-10, z = ped.z-1,}, -} -for i = 1, #peds do - local k = peds[i] - print(GetPedRelationshipGroupHash(i) ) - i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true) - SetPedRelationshipGroupHash(i, 'setups') - GiveWeaponToPed(i, "weapon_pistol", 1, false, true) - TaskCombatPed(i, PlayerPedId(), 0, 16) - SetPedCombatAttributes(i, 46, true) -end - + local ped = GetEntityCoords(PlayerPedId()) + local peds = { + {x = ped.x+3, y = ped.y-5, z = ped.z-1, }, + {x = ped.x+6, y = ped.y-10, z = ped.z-1,}, + {x = ped.x+-2,y = ped.y+5, z = ped.z-1,}, + {x = ped.x+8, y = ped.y-12, z = ped.z-1,}, + {x = ped.x+5, y = ped.y-2, z = ped.z-1, }, + {x = ped.x+2, y = ped.y-20, z = ped.z-1,}, + {x = ped.x+1, y = ped.y-10, z = ped.z-1,}, + } + for i = 1, #peds do + local k = peds[i] + print(GetPedRelationshipGroupHash(i) ) + i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true) + SetPedRelationshipGroupHash(i, 'setups') + GiveWeaponToPed(i, "weapon_pistol", 1, false, true) + TaskCombatPed(i, PlayerPedId(), 0, 16) + SetPedCombatAttributes(i, 46, true) + end end RegisterCommand('DrugRep', function() diff --git a/client/cornerselling.lua b/client/cornerselling.lua index fea3aff..2414e64 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -47,8 +47,8 @@ function Cornersell() Wait(1000) until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0 lib.requestAnimDict("rcmme_tracey1") - TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) - FreezeEntityPosition(targ, true) + TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) FreezeEntityPosition(targ, true) + local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { diff --git a/client/crack.lua b/client/crack.lua index 0a9b887..c10d4e1 100644 --- a/client/crack.lua +++ b/client/crack.lua @@ -3,7 +3,7 @@ local QBCore = exports['qb-core']:GetCoreObject() RegisterNetEvent("md-drugs:client:makecrackone", function(data) if not ItemCheck('bakingsoda') then return end - if not minigame(2, 8) then TriggerServerEvent("md-drugs:server:failcrackone", data.data) 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) diff --git a/client/deliveries.lua b/client/deliveries.lua index dec9466..10f8331 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -3,13 +3,15 @@ local isActive = false RegisterNetEvent('md-drugs:client:opendealermenu', function() local dealermenu = {} local rep = GetRep() + print(rep.dealerrep) if Config.StupidassNewQbItemName then for k, v in pairs (QBConfig.ProductsStupidNameRewrite) do - if rep.dealerrep >= v.minrep then + + if rep.dealerrep >= v.minrep then dealermenu[#dealermenu + 1] = { icon = GetImage(v.name), title = GetLabel(v.name), - description = v.price, + description = '$'..v.price, event = "md-drugs:client:travellingmerchantox", args = { item = v.name, @@ -19,6 +21,7 @@ RegisterNetEvent('md-drugs:client:opendealermenu', function() num = k, } } + sorter(dealermenu, 'title') end end else @@ -27,7 +30,7 @@ RegisterNetEvent('md-drugs:client:opendealermenu', function() dealermenu[#dealermenu + 1] = { icon = GetImage(v.name), title = GetLabel(v.name), - description = v.price, + description = '$'..v.price, event = "md-drugs:client:travellingmerchantox", args = { item = v.name, @@ -37,11 +40,11 @@ RegisterNetEvent('md-drugs:client:opendealermenu', function() num = k, } } - + sorter(dealermenu, 'title') end end end - sorter(dealermenu, 'title') + lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu}) lib.showContext('dealermenu') end) diff --git a/client/functions.lua b/client/functions.lua index 63464ca..b376a55 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -215,7 +215,7 @@ end function sorter(sorting, value) - table.sort(sorting, function(a, b) return a[value] < b[value] end) + table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end) end diff --git a/client/lean.lua b/client/lean.lua index 836792c..eb3f876 100644 --- a/client/lean.lua +++ b/client/lean.lua @@ -36,9 +36,9 @@ for k, v in pairs (items) do table = 'cups' } } + sorter(store, 'title') lib.registerContext({id = 'leanCraft',title = "Make Lean", options = store}) end -sorter(store, 'title') lib.showContext('leanCraft') end) diff --git a/client/pharma.lua b/client/pharma.lua index 00875b1..95759a0 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -41,17 +41,3 @@ RegisterNetEvent("md-drugs:client:unbottle", function(item) if item.name == 'xanaxbottle' then item = 'xanax' end TriggerServerEvent('md-drugs:server:unbottle', item) end) - --- TODO: @Mustachedom convert to consumables -RegisterNetEvent('md-drugs:client:takepharma', function(itemName) - if not progressbar(Lang.Pharma.consume, 1000, 'eat') then return end - if itemName == "vicodin" then - exports['ps-buffs']:AddHealthBuff(10000, 20) - elseif itemName == "adderal" then - exports['ps-buffs']:StaminaBuffEffect(5000, 1.3) - elseif itemName == "xanax" then - exports['ps-buffs']:AddStressBuff(10000, 25) - else - exports['ps-buffs']:AddHealthBuff(10000, 40) - end -end) diff --git a/client/travellingmerchant.lua b/client/travellingmerchant.lua index 9d33363..a488602 100644 --- a/client/travellingmerchant.lua +++ b/client/travellingmerchant.lua @@ -7,31 +7,32 @@ local current = "g_m_y_famdnf_01" local CurrentLocation = Config.Travellingmerchant[num] local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) Freeze(travellingmerchant, true, CurrentLocation.w) - AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", action = function() lib.showContext('travellingmerchant') end}, nil) -end) + AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", + action = function() + local ShopMenu = {} + for k, v in pairs (Config.Items.items) do + ShopMenu[#ShopMenu + 1] = { + icon = GetImage(v.name), + description = '$'.. v.price, + title = GetLabel(v.name), + event = "md-drugs:client:travellingmerchantox", + args = { + item = v.name, + cost = v.price, + amount = v.amount, + table = Config.Items.items, + num = k + } + } + sorter(ShopMenu, 'title') + lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu}) + end + + lib.showContext('travellingmerchant') -CreateThread(function() - local ShopMenu = {} - for k, v in pairs (Config.Items.items) do - ShopMenu[#ShopMenu + 1] = { - icon = GetImage(v.name), - description = '$'.. v.price, - title = GetLabel(v.name), - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = Config.Items.items, - num = k - } - } - lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu}) - end - sorter(ShopMenu, 'title') + end}, nil) end) - RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data) local price = data.cost local settext = "Amnt: "..data.amount.." | Cost: "..price or "Cost: "..price diff --git a/client/weed.lua b/client/weed.lua index b0cc124..05ce42a 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -122,13 +122,13 @@ CreateThread(function() if hasJob() then return true end end }) -AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.enter, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end, +AddBoxZoneSingle('teleinweedout', Config.Teleout, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.exit, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Telein) end, canInteract = function() if hasJob() then return true end end }) -AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.exit, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end, +AddBoxZoneSingle('teleinweedin', Config.Telein, { name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.coke.enter, distance = 2.0, action = function() SetEntityCoords(PlayerPedId(),Config.Teleout) end, canInteract = function() if hasJob() then return true end end }) -AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = Lang.Weed.butt, action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt", +AddBoxZoneSingle('MakeButterCrafting', Config.MakeButter, {label = Lang.targets.weed.butt, action = function() lib.showContext('ButterCraft') end, icon = "fas fa-sign-in-alt", canInteract = function() if hasJob() then return true end end }) @@ -164,15 +164,9 @@ CreateThread(function() BikerWeedFarm.Security.Set(BikerWeedFarm.Security.upgrade) BikerWeedFarm.Details.Enable(BikerWeedFarm.Details.chairs, true) BikerWeedFarm.Details.Enable({BikerWeedFarm.Details.production, BikerWeedFarm.Details.chairs, BikerWeedFarm.Details.drying}, true) - BikerWeedFarm.Plant1.Clear(false) - BikerWeedFarm.Plant2.Clear(false) - BikerWeedFarm.Plant3.Clear(false) - BikerWeedFarm.Plant4.Clear(false) - BikerWeedFarm.Plant5.Clear(false) - BikerWeedFarm.Plant6.Clear(false) - BikerWeedFarm.Plant7.Clear(false) - BikerWeedFarm.Plant8.Clear(false) - BikerWeedFarm.Plant9.Clear(false) + BikerWeedFarm.Plant1.Clear(false) BikerWeedFarm.Plant2.Clear(false) BikerWeedFarm.Plant3.Clear(false) + BikerWeedFarm.Plant4.Clear(false) BikerWeedFarm.Plant5.Clear(false) BikerWeedFarm.Plant6.Clear(false) + BikerWeedFarm.Plant7.Clear(false) BikerWeedFarm.Plant8.Clear(false) BikerWeedFarm.Plant9.Clear(false) RefreshInterior(BikerWeedFarm.interiorId) local stove = CreateObject("prop_cooker_03",vector3(1045.49, -3198.46, -38.15-1), true, false) SetEntityHeading(stove, 270.00) @@ -202,8 +196,8 @@ local current = "u_m_m_jesus_01" lib.requestModel(current, Config.RequestModelTime) local CurrentLocation = Config.WeedSaleman - local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.h, false, false) - Freeze(WeedGuy, true, CurrentLocation.h) + local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) + Freeze(WeedGuy, true, CurrentLocation.w) AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end}, nil) for k, v in pairs (Config.Weed.items) do WeedShop[#WeedShop + 1] = { @@ -219,93 +213,46 @@ local current = "u_m_m_jesus_01" num = k, } } + sorter(WeedShop, 'title') lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop}) end - sorter(WeedShop, 'title') + end) +local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) + local options = {} + local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed',tableName) + for k, v in pairs(items) do + local label = {} + local item = '' + for m, d in pairs(v.take) do table.insert(label, GetLabel(m) .. ' X ' .. d) end + for m, d in pairs(v.give) do item = m end + options[#options + 1] = { + icon = GetImage(item), + description = table.concat(label, ", "), + title = GetLabel(item), + event = "md-drugs:client:MakeWeedItems", + args = { + item = item, + recipe = 'weed', + num = k, + label = eventLabelPrefix .. GetLabel(item), + table = tableName + } + } + end + sorter(options, 'title') + lib.registerContext({ + id = contextId, + title = contextTitle, + options = options + }) +end + CreateThread(function() -local items = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'edibles') -local items2 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'blunts') -local items3 = lib.callback.await('md-drugs:server:GetRecipe', false,'weed', 'bluntwrap') -local craft, blunt, bluntwrap, label = {}, {}, {}, {} - -for k, v in pairs (items) do - label = {} - local item = '' - for m, d in pairs (items[k].take) do - table.insert(label, GetLabel(m) .. ' X ' .. d) - end - for m,d in pairs (items[k].give) do - item = m - end - craft[#craft + 1] = { - icon = GetImage(item), - description = table.concat(label, ", "), - title = GetLabel(item), - event = "md-drugs:client:MakeWeedItems", - args = { - item = item, - recipe = 'weed', - num = k, - label = 'Cooking Up ' .. GetLabel(item), - table = 'edibles' - - } - } - lib.registerContext({id = 'ButterCraft',title = "Edible Cooking", options = craft}) -end -for k, v in pairs (items2) do - label = {} - local item = '' - for m, d in pairs (items2[k].take) do - table.insert(label, GetLabel(m) .. ' X ' .. d) - end - for m, d in pairs (items2[k].give) do - item = m - end - blunt[#blunt + 1] = { - icon = GetImage(item), - description = table.concat(label, ", "), - title = GetLabel(item), - event = "md-drugs:client:MakeWeedItems", - args = { - item = item, - recipe = 'weed', - num = k, - label = 'Rolling A ' .. GetLabel(item), - table = 'blunts' - } - } - lib.registerContext({id = 'mddrugsblunts',title = "Roll Blunts", options = blunt}) -end -for k, v in pairs (items3) do - label = {} - local item = '' - for m, d in pairs (items3[k].take) do - table.insert(label, GetLabel(m) .. ' X ' .. d) - end - for m,d in pairs (items3[k].give) do - item = m - end - bluntwrap[#bluntwrap + 1] = { - icon = GetImage(item), - description = table.concat(label, ", "), - title = GetLabel(item), - event = "md-drugs:client:MakeWeedItems", - args = { - item = item, - recipe = 'weed', - num = k, - label = 'Dipping Syrup To Make ' .. GetLabel(item), - table = 'bluntwrap' - } - } - lib.registerContext({id = 'mddrugsbluntwraps',title = "Dip Blunt Wrap", options = bluntwrap}) -end -sorter(craft, 'title') -sorter(blunt, 'title') -sorter(bluntwrap, 'title') +createBluntOptions('ButterCraft', "Edible Cooking", 'Cooking A ', 'edibles') +createBluntOptions('mddrugsblunts', "Roll Blunts", 'Rolling A ', 'blunts') +createBluntOptions('mddrugsbluntwraps', "Dipping Syrup", 'Dipping Syrup To Make ', 'bluntwrap') end) RegisterNetEvent("md-drugs:client:MakeWeedItems", function(data) diff --git a/client/xtc.lua b/client/xtc.lua index 15f935b..372f272 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -71,7 +71,7 @@ RegisterNetEvent("md-drugs:client:XTCMenu", function(type) } }) - lib.showContext('XTCmenu') + lib.showContext('XTCmenu') end) RegisterNetEvent("md-drugs:client:GetPressBack", function(type, press) @@ -164,10 +164,10 @@ RegisterNetEvent("md-drugs:client:buypress", function() id = 'buypresses', title = 'Purchase Presses', options = { - { title = 'Single Press', description = 'Buy a single press for 20k', icon = img, event = 'md-drugs:client:getsinglepress'}, - { title = 'Exchange Single For Dual', description = '20 of each unstamped single stack pill and your single press ', icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'dual'}}, - { title = 'Exchange Dual For Triple', description = '50 of each unstamped dual stack pill and your dual press ', icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'triple'}}, - { title = 'Exchange Triple For Quad', description = '150 of each unstamped Triple stack pill and your triple press ', icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'quad'}} + { title = Lang.xtc.press.title.single, description = Lang.xtc.des.title.single, icon = img, event = 'md-drugs:client:getsinglepress'}, + { title = Lang.xtc.press.title.dual, description = Lang.xtc.des.title.dual, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'dual'}}, + { title = Lang.xtc.press.title.triple, description = Lang.xtc.des.title.triple, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'triple'}}, + { title = Lang.xtc.press.title.quad, description = Lang.xtc.des.title.quad, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'quad'}} } }) lib.showContext('buypresses') diff --git a/server/functions.lua b/server/functions.lua index a5924ba..b201ab9 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -193,7 +193,6 @@ end function GetName(source) local Player = QBCore.Functions.GetPlayer(source) return Player.PlayerData.charinfo.firstname .. ' ' .. Player.PlayerData.charinfo.lastname - end function getRep(source, type) diff --git a/server/pharma.lua b/server/pharma.lua index 7b00214..6775310 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -42,16 +42,7 @@ QBCore.Functions.CreateUseableItem(d, function(source, item) end) end -local pharmadrugs = { "adderal", "vicodin", "xanax", "morphine"} -for k, v in pairs (pharmadrugs) do QBCore.Functions.CreateUseableItem(v, function(source, item) -local src = source - if TriggerClientEvent('md-drugs:client:takepharma', src, item.name) then - RemoveItem(src, item.name, 1) - Log(GetName(source) .. ' Took ' .. item.name .. '!', 'pharma') - end -end) -end RegisterServerEvent('md-drugs:server:fillprescription', function() local src = source local Player = QBCore.Functions.GetPlayer(src) diff --git a/shared/config.lua b/shared/config.lua index 4222fa3..f1eed7f 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -142,14 +142,12 @@ Config.FillPrescription = {---------- this is where you want people to take thei } Config.PharmaJob = "ems" -- what TYPE role you need to be on to get the command - - -------------- weed Config.Teleout = vector3(1066.31, -3183.36, -39.16) -- where you target to tele in Config.Telein = vector3(244.74, 374.54, 105.74) -- where you target to tele out Config.MakeButter = vector3(1045.48, -3198.49, -38.22) -- where you make cannabutter and baked edibles Config.MakeOil = vector3(1038.90, -3198.66, -38.17) -- where you make shatter -Config.WeedSaleman = vector4(1030.46, -3203.63, -38.2, 180.0) +Config.WeedSaleman = vector4(1030.77, -3203.18, -38.2, 262.37) Config.WeedDry = { -- where you dry leaves {loc = vector3(1043.0, -3191.59, -38.39),}, diff --git a/shared/consumables.lua b/shared/consumables.lua index cca4b1f..435a921 100644 --- a/shared/consumables.lua +++ b/shared/consumables.lua @@ -1,141 +1,147 @@ -Consumables = {} -Consumables.defaulttime = 4000 -Consumables.defaultanim = 'pflag2' -Consumables.defaultprogresstext = 'Consuming ' -- it will always show the label of the item being used after what you put here, make sure to keep the space at the end :) -Consumables.defaultstatval = 0 ---[[ - effect options - alien - ecstacy - meth - coke - trevor - none -]] - ---[[ -add = {} -health = number -- amount of health to give -stress = number -- number of stress to give -speed = number -- number of seconds you a fast boi -hunger = number -- number of hunger to fill -thirst = number -- same shit -strength = number -- how long you are strong boi - -]] -Consumables.Items = { - -- meth - ["methbags"] = { time = 4000, effect = 'meth', anim = "smoke", progressbartext = "Injesting", - add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}}, - ["cokebaggy"] = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, -["cokebaggystagetwo"] = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, -["cokebaggystagethree"] = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, --- heroin -["heroin_ready"] = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["heroin_readystagetwo"] = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["heroin_readystagethree"] = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, --- crack -["baggedcracked"] = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, -["baggedcrackedstagetwo"] = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, -["baggedcrackedstagethree"] = { anim = 'smell', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, --- xtc -["white_playboys"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_playboys2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_playboys3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_playboys4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_playboys"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_playboys2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_playboys3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_playboys4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_playboys"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_playboys2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_playboys3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_playboys4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_playboys"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_playboy2s"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_playboys3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_playboys4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_aliens"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_aliens2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_aliens3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_aliens4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_aliens"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_aliens2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_aliens3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_aliens4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_aliens"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_aliens3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_aliens2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_aliens4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_aliens"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_aliens2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_aliens3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_aliens4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_pl"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_pl2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_pl3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["white_pl4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_pl"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_pl2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_pl3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["blue_pl4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_pl"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_pl2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_pl3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["red_pl4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_pl"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_pl2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_pl3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -["orange_pl4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_trolls"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_trolls2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_trolls3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_trolls4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_trolls"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_trolls2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_trolls3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_trolls4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_trolls"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_trolls2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_trolls3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_trolls4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_trolls"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_trolls2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_trolls3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_trolls4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_cats2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_cats3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_cats4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["white_cats"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_cats"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_cats3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_cats2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["blue_cats4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_cats"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_cats2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_cats3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["red_cats4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_cats"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_cats2"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_cats3"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, - ["orange_cats4"] = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, +Consumables = {} +Consumables.defaulttime = 4000 +Consumables.defaultanim = 'pflag2' +Consumables.defaultprogresstext = 'Consuming ' -- it will always show the label of the item being used after what you put here, make sure to keep the space at the end :) +Consumables.defaultstatval = 0 +--[[ + effect options + alien + ecstacy + meth + coke + trevor + none +]] + +--[[ +add = {} +health = number -- amount of health to give +stress = number -- number of stress to give +speed = number -- number of seconds you a fast boi +hunger = number -- number of hunger to fill +thirst = number -- same shit +strength = number -- how long you are strong boi + +]] +Consumables.Items = { + -- meth + methbags = { time = 4000, effect = 'meth', anim = "smoke", progressbartext = "Injesting", + add = {health = -20, stress = -10, speed = 40, strength = 10, thirst = -30}}, + cokebaggy = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, + cokebaggystagetwo = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, + cokebaggystagethree = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, + -- heroin + heroin_ready = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + heroin_readystagetwo = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + heroin_readystagethree = { anim = 'shootup', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + -- crack + baggedcracked = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, + baggedcrackedstagetwo = { anim = 'smell', time = 1000, effect = 'coke', add = { stress = -10 }}, + baggedcrackedstagethree = { anim = 'smell', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + -- xtc + white_playboys = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_playboys2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_playboys3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_playboys4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_playboys = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_playboys2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_playboys3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_playboys4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_playboys = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_playboys2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_playboys3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_playboys4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_playboys = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_playboy2s = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_playboys3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_playboys4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_aliens = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_aliens2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_aliens3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_aliens4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_aliens = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_aliens2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_aliens3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_aliens4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_aliens = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_aliens3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_aliens2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_aliens4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_aliens = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_aliens2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_aliens3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_aliens4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_pl = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_pl2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_pl3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_pl4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_pl = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_pl2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_pl3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_pl4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_pl = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_pl2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_pl3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_pl4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_pl = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_pl2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_pl3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_pl4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_trolls = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_trolls2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_trolls3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_trolls4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_trolls = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_trolls2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_trolls3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_trolls4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_trolls = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_trolls2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_trolls3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_trolls4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_trolls = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_trolls2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_trolls3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_trolls4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_cats2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_cats3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_cats4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + white_cats = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_cats = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_cats3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_cats2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + blue_cats4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_cats = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_cats2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_cats3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + red_cats4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_cats = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_cats2 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_cats3 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, + orange_cats4 = { anim = 'edible', time = 1000, effect = 'ecstacy', add = { stress = -10 }}, -- weed - ["specialbrownie"] = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, - ["specialcookie"] = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, - ["specialchocolate"] = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, - ["specialmuffin"] = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, - ["blunt"] = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, - ["dextroblunts"] = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, - ["leanblunts"] = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, - ["chewyblunt"] = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, + specialbrownie = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, + specialcookie = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, + specialchocolate = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, + specialmuffin = { anim = 'edible', effect = 'alien', add = { hunger = 10, stress = -10 }}, + blunt = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, + dextroblunts = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, + leanblunts = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, + chewyblunt = { anim = 'smokeweed', effect = 'alien', add = { stress = -10 }}, -- lean - ["cupofdextro"] = { anim = 'cup', effect = 'alien', add = { stress = -10 }}, - ["cupoflean"] = { anim = 'cup', effect = 'alien', add = { stress = -10 }}, + cupofdextro = { anim = 'cup', effect = 'alien', add = { stress = -10 }}, + cupoflean = { anim = 'cup', effect = 'alien', add = { stress = -10 }}, -- lsd - ["smiley_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, - ["wildcherry_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, - ["yinyang_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, - ["pineapple_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, - ["bart_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, - ["gratefuldead_tabs"] = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + smiley_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + wildcherry_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + yinyang_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + pineapple_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + bart_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + gratefuldead_tabs = { anim = 'edible', effect = 'trevor', add = { stress = -10 }}, + + -- pharma + vicodin = { anim = 'pill', effect = 'none', add = { health = 20 }}, + adderal = { anim = 'pill', effect = 'none', add = { stress = -20 }}, + morphine = { anim = 'pill', effect = 'none', add = { health = 40 }}, + xanax = { anim = 'pill', effect = 'none', add = { stress = -40 }}, } diff --git a/shared/english.lua b/shared/english.lua index bd401d0..9724afd 100644 --- a/shared/english.lua +++ b/shared/english.lua @@ -172,7 +172,8 @@ Lang.Heroin = { Lang.Lean = { marked = ' Car Has Been Marked On Your Map', lean = 'You Got Purple Lean', - dextro = ' You Got Red Dextro' + dextro = ' You Got Red Dextro', + act = 'You Already Have A Lean Task', } Lang.lsd = { @@ -212,7 +213,8 @@ Lang.meth = { ace = 'You Got Some Acetone', eph = 'You Got Some Ephedrine', mix = 'Adding Things To The Mix', - nobag = 'No Bags' + nobag = 'No Bags', + act = 'You Already Have A Meth Task', } Lang.oxy = { @@ -271,7 +273,13 @@ Lang.xtc = { stamp = 'Stamping %s Pills', buyp = "Buying Press", -- - cash = 'I need 20k In Cash' + 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 = { From dbed6b3c47cbdeae630ab7f2201c6a8e84c1976f Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Thu, 24 Oct 2024 19:45:39 -0700 Subject: [PATCH 05/20] made makeMenu function, moved all stores from config to server/travellingmerchant.lua --- client/deliveries.lua | 48 +------------ client/functions.lua | 30 ++++++++ client/target.lua | 8 +-- client/travellingmerchant.lua | 43 +----------- client/weed.lua | 24 +------ server/cocaine.lua | 128 ++++++++++++++++------------------ server/consumables.lua | 21 +++--- server/functions.lua | 7 +- server/lean.lua | 1 - server/lsd.lua | 68 +++++++----------- server/mescaline.lua | 4 +- server/meth.lua | 24 +++---- server/travellingmerchant.lua | 85 +++++++++++++++++++--- shared/config.lua | 44 +----------- shared/qbdrugsrewrite.lua | 20 +----- 15 files changed, 239 insertions(+), 316 deletions(-) diff --git a/client/deliveries.lua b/client/deliveries.lua index 10f8331..d2d96f9 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -1,51 +1,9 @@ local QBCore = exports['qb-core']:GetCoreObject() local isActive = false -RegisterNetEvent('md-drugs:client:opendealermenu', function() - local dealermenu = {} - local rep = GetRep() - print(rep.dealerrep) - if Config.StupidassNewQbItemName then - for k, v in pairs (QBConfig.ProductsStupidNameRewrite) do - if rep.dealerrep >= v.minrep then - dealermenu[#dealermenu + 1] = { - icon = GetImage(v.name), - title = GetLabel(v.name), - description = '$'..v.price, - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = QBConfig.ProductsStupidNameRewrite, - num = k, - } - } - sorter(dealermenu, 'title') - end - end - else - for k, v in pairs (QBConfig.Products) do - if rep.dealerrep >= v.minrep then - dealermenu[#dealermenu + 1] = { - icon = GetImage(v.name), - title = GetLabel(v.name), - description = '$'..v.price, - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = QBConfig.Products, - num = k, - } - } - sorter(dealermenu, 'title') - end - end - end - - lib.registerContext({id = 'dealermenu',title = "Dealer Menu", options = dealermenu}) +RegisterNetEvent('md-drugs:client:opendealermenu', function() + local rep = GetRep() + makeMenu('dealermenu', rep) lib.showContext('dealermenu') end) diff --git a/client/functions.lua b/client/functions.lua index b376a55..c88cda4 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -218,6 +218,36 @@ function sorter(sorting, value) table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end) end +function makeMenu(name, rep) + local menu = {} + local data = lib.callback.await('md-drugs:server:menu', false, name) + for k, v in pairs (data.table) do + local allow = false + if rep == nil then + allow = true + else + if rep.dealerrep >= v.minrep then allow = true end + end + if allow then + menu[#menu + 1] = { + icon = GetImage(v.name), + description = '$'.. v.price, + title = GetLabel(v.name), + onSelect = function() + local settext = "Cost: $"..v.price + local dialog = exports.ox_lib:inputDialog(v.name .."!", { + { type = 'select', label = "Payment Type", default = "cash", options = { { value = "cash"}, { value = "bank"},}}, + { type = 'number', label = "Amount to buy", description = settext, min = 0, max = v.amount, default = 1 }, + }) + if not dialog[1] then return end + TriggerServerEvent("md-drugs:server:purchaseGoods", dialog[2], dialog[1], v.name, v.price, data.table, k) + end, + } + end + end + sorter(menu, 'title') + lib.registerContext({id = data.id, title = data.title, options = menu}) +end function ItemCheck(item) diff --git a/client/target.lua b/client/target.lua index d45bcc4..d114f66 100644 --- a/client/target.lua +++ b/client/target.lua @@ -1,9 +1,9 @@ local QBCore = exports['qb-core']:GetCoreObject() -local icon = "fas fa-sign-in-alt" +local icon = "fa solid fa-eye" CreateThread(function() - AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {action = function()tele(Config.CokeTeleOut)end, icon = icon, label = Lang.targets.coke.enter}) -- coke - AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {action = function()tele(Config.CokeTeleIn) end, icon = icon, label = Lang.targets.coke.exits}) -- coke - AddBoxZoneMulti('makepowder', Config.MakePowder, {event = "md-drugs:client:makepowder", icon = icon, label = Lang.targets.coke.chop}) -- coke + AddBoxZoneSingle('telecokein', Config.CokeTeleIn, {action = function()tele(Config.CokeTeleOut)end, icon = 'fa-solid fa-door-open', label = Lang.targets.coke.enter}) -- coke + AddBoxZoneSingle('telecokeout', Config.CokeTeleOut, {action = function()tele(Config.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 = icon, label = Lang.targets.lsd.lys}) -- lsd AddBoxZoneMulti('stealdiethylamide', Config.diethylamide, {event = "md-drugs:client:getdiethylamide", icon = icon, label = Lang.targets.lsd.die}) -- lsd AddBoxZoneMulti('gettabs', Config.gettabs, {event = "md-drugs:client:buytabs", icon = icon, label = Lang.targets.lsd.buyt}) -- lsd diff --git a/client/travellingmerchant.lua b/client/travellingmerchant.lua index a488602..9a48bb3 100644 --- a/client/travellingmerchant.lua +++ b/client/travellingmerchant.lua @@ -7,46 +7,9 @@ local current = "g_m_y_famdnf_01" local CurrentLocation = Config.Travellingmerchant[num] local travellingmerchant = CreatePed(0, current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) Freeze(travellingmerchant, true, CurrentLocation.w) - AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", + AddSingleModel(travellingmerchant, { label = "Travelling Merchant", icon = "fas fa-eye", action = function() - local ShopMenu = {} - for k, v in pairs (Config.Items.items) do - ShopMenu[#ShopMenu + 1] = { - icon = GetImage(v.name), - description = '$'.. v.price, - title = GetLabel(v.name), - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = Config.Items.items, - num = k - } - } - sorter(ShopMenu, 'title') - lib.registerContext({id = 'travellingmerchant',title = "Travelling Merchant", options = ShopMenu}) - end - - lib.showContext('travellingmerchant') - + makeMenu('travellingMerchant') + lib.showContext('travellingMerchant') end}, nil) end) - -RegisterNetEvent("md-drugs:client:travellingmerchantox", function(data) - local price = data.cost - local settext = "Amnt: "..data.amount.." | Cost: "..price or "Cost: "..price - local max = data.amount - local dialog = exports.ox_lib:inputDialog(data.item .."!", { - { type = 'select', label = "Payment Type", default = "cash", - options = { - { value = "cash"}, - { value = "bank"}, - } - }, - { type = 'number', label = "Amount to buy", description = settext, min = 0, max = max, default = 1 }, - }) - if not dialog[1] then return end - if data.cost == "Free" then data.cost = 0 end - TriggerServerEvent("md-drugs:server:travellingmerchantox", dialog[2], dialog[1], data.item, data.cost, data.table, data.num ) -end) diff --git a/client/weed.lua b/client/weed.lua index 05ce42a..121286b 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -191,32 +191,12 @@ AlienEffect() end) CreateThread(function() -local WeedShop = {} -local current = "u_m_m_jesus_01" - + local current = "u_m_m_jesus_01" lib.requestModel(current, Config.RequestModelTime) local CurrentLocation = Config.WeedSaleman local WeedGuy = CreatePed(0,current,CurrentLocation.x,CurrentLocation.y,CurrentLocation.z-1, CurrentLocation.w, false, false) Freeze(WeedGuy, true, CurrentLocation.w) - AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye",action = function() lib.showContext('WeedShop')end}, nil) - for k, v in pairs (Config.Weed.items) do - WeedShop[#WeedShop + 1] = { - icon = GetImage(v.name), - title = GetLabel(v.name), - description = '$'.. v.price, - event = "md-drugs:client:travellingmerchantox", - args = { - item = v.name, - cost = v.price, - amount = v.amount, - table = Config.Weed.items, - num = k, - } - } - sorter(WeedShop, 'title') - lib.registerContext({id = 'WeedShop',title = "Weed Shop", options = WeedShop}) - end - + AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil) end) local function createBluntOptions(contextId, contextTitle, eventLabelPrefix, tableName) diff --git a/server/cocaine.lua b/server/cocaine.lua index 171c731..4118ffd 100644 --- a/server/cocaine.lua +++ b/server/cocaine.lua @@ -34,78 +34,74 @@ AddEventHandler("coke:pickupCane", function(loc) end) RegisterServerEvent('md-drugs:server:makepowder', function(num) - local src = source - if CheckDist(src, Config.MakePowder[num]['loc']) then return end - if Config.TierSystem then - local coke = getRep(src, 'coke') - if coke <= Config.Tier1 then - if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end - Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') - elseif coke >= Config.Tier1 and coke <= Config.Tier2 then - if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier2') then return end - Log(GetName(src) .. ' Made Raw Coke tier 2' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') - else - if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier3') then return end - Log(GetName(src) ..' Made Raw Coke tier 3' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') - end - else - if not GetRecipe(src, 'cocaine', 'cokepowder', 'tier1') then return end - Log(GetName(src) .. ' Made Raw Coke' .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') - end + local src = source + if CheckDist(src, Config.MakePowder[num]['loc']) 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 + Log(GetName(src) .. logMessage .. dist(src, Config.MakePowder[num]['loc']) .. ' vectors', 'coke') end) RegisterServerEvent('md-drugs:server:cutcokeone', function() - local src = source - local Player = QBCore.Functions.GetPlayer(src) - if Config.TierSystem then - local coke = Player.Functions.GetItemByName('coke') - local coke2 = Player.Functions.GetItemByName('cokestagetwo') - local coke3 = Player.Functions.GetItemByName('cokestagethree') - if coke then - if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end - Log(GetName(src) .. ' Cut Coke', 'coke') - elseif coke2 then - if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier2') then return end - Log(GetName(src) .. ' Cut Coke tier 2', 'coke') - elseif coke3 then - if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier3') then return end - Log(GetName(src) .. ' Cut Coke tier 3', 'coke') - else - Notifys(src,Lang.Coke.nocutcoke, "error") - end - else - if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end - Log(GetName(src) .. ' Cut Coke', 'coke') - end + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local count = 0 + if Config.TierSystem then + local cokeTiers = { + {item = 'coke', tier = 'tier1', log = ' Cut Coke'}, + {item = 'cokestagetwo', tier = 'tier2', log = ' Cut Coke tier 2'}, + {item = 'cokestagethree', tier = 'tier3', log = ' Cut Coke tier 3'} + } + for _, v in ipairs(cokeTiers) do + if count >= 1 then return end + if Player.Functions.GetItemByName(v.item) then + if not GetRecipe(src, 'cocaine', 'cutcoke', v.tier) then return end + Log(GetName(src) .. v.log, 'coke') + return + end + end + Notifys(src, Lang.Coke.nocutcoke, "error") + else + if not GetRecipe(src, 'cocaine', 'cutcoke', 'tier1') then return end + Log(GetName(src) .. ' Cut Coke', 'coke') + end end) RegisterServerEvent('md-drugs:server:bagcoke', function() - local src = source - local Player = QBCore.Functions.GetPlayer(src) - if Config.TierSystem then - local coke = getRep(source, 'coke') - local locoke = Player.Functions.GetItemByName('loosecoke') - local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo') - local locoke3 = Player.Functions.GetItemByName('loosecokestagethree') - if locoke then - if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end - AddRep(src, 'coke') - Log(GetName(src) .. ' Bagged Coke and now has a rep of ' .. coke + 1, 'coke') - elseif locoke2 then - if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end - AddRep(src, 'coke') - Log(GetName(src) .. ' Bagged Coke tier 2 and now has a rep of ' .. coke + 1, 'coke') - elseif locoke3 then - if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier3') then return end - AddRep(src, 'coke') - Log(GetName(source) .. ' Bagged Coke tier 3 and now has a rep of ' .. coke + 1, 'coke') - else - Notifys(src, Lang.Coke.nobagcoke, "error") - end - else - if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end - Log(GetName(source) .. ' Bagged Coke', 'coke') - end + local src = source + local Player = QBCore.Functions.GetPlayer(src) + local count = 0 + if Config.TierSystem then + local coke = getRep(src, 'coke') + local cokeTiers = { + {item = 'loosecoke', tier = 'tier1', log = ' Bagged Coke'}, + {item = 'loosecokestagetwo', tier = 'tier2', log = ' Bagged Coke tier 2'}, + {item = 'loosecokestagethree', tier = 'tier3', log = ' Bagged Coke tier 3'} + } + for _, v in ipairs(cokeTiers) do + if Player.Functions.GetItemByName(v.item) then + if count >= 1 then return end + if not GetRecipe(src, 'cocaine', 'bagcoke', v.tier) then return end + AddRep(src, 'coke') + Log(GetName(src) .. v.log .. ' and now has a rep of ' .. coke + 1, 'coke') + return + end + end + Notifys(src, Lang.Coke.nobagcoke, "error") + else + if not GetRecipe(src, 'cocaine', 'bagcoke', 'tier1') then return end + Log(GetName(src) .. ' Bagged Coke', 'coke') + end end) local cokecut = {loosecokestagetwo = 2, loosecokestagethree = 3} diff --git a/server/consumables.lua b/server/consumables.lua index d832447..ea97049 100644 --- a/server/consumables.lua +++ b/server/consumables.lua @@ -1,15 +1,15 @@ local QBCore = exports['qb-core']:GetCoreObject() -for k, v in pairs (Consumables.Items) do QBCore.Functions.CreateUseableItem(k, function(source, item) - local src = source - local Player = QBCore.Functions.GetPlayer(src) - if v.time == nil then v.time = Consumables.defaulttime end - if v.effect == nil then v.effect = 0 end - if v.anim == nil then v.anim = Consumables.defaultanim end - if v.progressbartext == nil then v.progressbartext = Consumables.defaultprogresstext end - if v.add == nil then v.add = {hunger = 0} end - TriggerClientEvent("md-drugs:client:consumedrugs", source, v.time, v.effect, v.anim, v.progressbartext, v.add, k) - end) +for k, v in pairs(Consumables.Items) do + QBCore.Functions.CreateUseableItem(k, function(source, item) + if not Itemcheck(source, k, 1) then return end + local time = v.time or Consumables.defaulttime + local effect = v.effect or 0 + local anim = v.anim or Consumables.defaultanim + local progressbartext = v.progressbartext or Consumables.defaultprogresstext + local add = v.add or {hunger = 0} + TriggerClientEvent("md-drugs:client:consumedrugs", source, time, effect, anim, progressbartext, add, k) + end) end RegisterNetEvent('md-drugs:server:removeconsum', function(item) @@ -18,7 +18,6 @@ RegisterNetEvent('md-drugs:server:removeconsum', function(item) end) RegisterNetEvent('md-drugs:server:updatestatus', function(stat, statval) - print(stat,statval) local Player = QBCore.Functions.GetPlayer(source) if stat == "thirst" then local value = Player.PlayerData.metadata.thirst + statval diff --git a/server/functions.lua b/server/functions.lua index b201ab9..794fdac 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -261,7 +261,12 @@ function AddRep(source, type) MySQL.update('UPDATE drugrep SET drugrep = ? WHERE cid = ?', {update, Player.PlayerData.citizenid}) return true end - + +function sortTab(tbl, type) + table.sort(tbl, function(a, b) + return a[type] < b[type] + end) +end function ChecknRemove(source, table) local Player = QBCore.Functions.GetPlayer(source) diff --git a/server/lean.lua b/server/lean.lua index 81b22d6..8ef87ed 100644 --- a/server/lean.lua +++ b/server/lean.lua @@ -19,7 +19,6 @@ end) QBCore.Functions.CreateUseableItem('leancup', function(source, item) local src = source - local Player = QBCore.Functions.GetPlayer(src) if Itemcheck(src, 'leancup', 1) then TriggerClientEvent('md-drugs:client:leancraft', src) end diff --git a/server/lsd.lua b/server/lsd.lua index 0fca2f1..02fafda 100644 --- a/server/lsd.lua +++ b/server/lsd.lua @@ -9,8 +9,7 @@ RegisterServerEvent('md-drugs:server:getlysergic', function(num) end) RegisterServerEvent('md-drugs:server:getdiethylamide', function(num) -local src = source -local Player = QBCore.Functions.GetPlayer(src) + local src = source if CheckDist(src, Config.diethylamide[num]['loc']) then return end if AddItem(src,'diethylamide', 2) then Log(GetName(src) ..' Got Diethylamide with a distance of ' .. dist(source, Config.diethylamide[num]['loc']) .. '!', 'lsd') @@ -28,7 +27,7 @@ end) lib.callback.register('md-drugs:server:removecleaningkit', function(source) -local src = source + local src = source if not Itemcheck(src, 'cleaningkit', 1) then return end if RemoveItem(src,"cleaningkit", 1) then Log(GetName(src) ..' Wiped Down Their LSD Lab Kit!' , 'lsd') @@ -37,21 +36,21 @@ local src = source end) RegisterServerEvent('md-drugs:server:getlabkitback', function() -local src = source + local src = source if AddItem(src,"lsdlabkit", 1) then Log(GetName(src) ..' Picked Up Their LSD Lab Kit Back At ' .. GetCoords(src) .. '!', 'lsd') end end) RegisterServerEvent('md-drugs:server:heatliquid', function() -local src = source + local src = source if not GetRecipe(src, 'lsd', 'vial', 'heat') then return end Log(GetName(src) ..' Heated Basic LSD!', 'lsd') end) RegisterServerEvent('md-drugs:server:failheating', function() -local src = source -if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end + local src = source + if not ChecknRemove(source, {lysergic_acid = 1, diethylamide = 1}) then return end Notifys(src,Lang.lsd.failed, "error") Log(GetName(src) ..' Failed Basic LSD Like An Idiot!', 'lsd') end) @@ -59,7 +58,6 @@ end) RegisterServerEvent('md-drugs:server:refinequalityacid', function() local src = source -local randomchance = math.random(1,100) if not Itemcheck(src, 'lsd_one_vial', 1) then return end if Config.TierSystem then local lsd = getRep(src, 'lsd') @@ -79,6 +77,7 @@ if not Itemcheck(src, 'lsd_one_vial', 1) then return end Log(GetName(src) ..' Refined Acid and Now Has A Rep Of ' .. lsd + 1 .. '!', 'lsd') end else + local randomchance = math.random(1,100) if RemoveItem(src,'lsd_one_vial', 1) then if randomchance <= 60 then AddItem(src,'lsd_vial_two', 1) @@ -127,44 +126,31 @@ RegisterServerEvent('md-drugs:server:getlabkit', function() end end) - - - RegisterServerEvent('md-drugs:server:maketabpaper', function() -local src = source -local Player = QBCore.Functions.GetPlayer(src) -if not Itemcheck(src,'tab_paper', 1) then return end - if RemoveItem(src,'lsd_one_vial', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'smileyfacesheet', 1) - Log(GetName(src) ..' Made A Smiley Face Sheet', 'lsd') - elseif Player.Functions.RemoveItem('lsd_vial_two', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'wildcherrysheet', 1) - Log(GetName(src) ..' Made A Wild Cherry Sheet', 'lsd') - elseif Player.Functions.RemoveItem('lsd_vial_three', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'yinyangsheet', 1) - Log(GetName(src) ..' Made A Yin Yang Sheet', 'lsd') - elseif Player.Functions.RemoveItem('lsd_vial_four', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'pineapplesheet', 1) - Log(GetName(src) ..' Made A Pine Apple Sheet', 'lsd') - elseif Player.Functions.RemoveItem('lsd_vial_five', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'bartsheet', 1) - Log(GetName(src) ..' Made A Cluckin Bell Sheet', 'lsd') - elseif Player.Functions.RemoveItem('lsd_vial_six', 1) then - RemoveItem(src,'tab_paper', 1) - AddItem(src,'gratefuldeadsheet', 1) - Log(GetName(src) ..' Made A Maze Sheet', 'lsd') - else - Notifys(Lang.lsd.novial, "error") + local src = source + if not Itemcheck(src,'tab_paper', 1) then return end + local count = 0 + local vialdata = { + {vial = 'lsd_one_vial', sheet = 'smileyfacesheet', log = 'Made A Smiley Face Sheet'}, + {vial = 'lsd_vial_two', sheet = 'wildcherrysheet', log = 'Made A Wild Cherry Sheet'}, + {vial = 'lsd_vial_three', sheet = 'yinyangsheet', log = 'Made A Yin Yang Sheet'}, + {vial = 'lsd_vial_four', sheet = 'pineapplesheet', log = 'Made A Pine Apple Sheet'}, + {vial = 'lsd_vial_five', sheet = 'bartsheet', log = 'Made A Cluckin Bell Sheet'}, + {vial = 'lsd_vial_six', sheet = 'gratefuldeadsheet', log = 'Made A Maze Sheet'} + } + sortTab(vialdata, 'vial') + for k, v in pairs (vialdata) do + if count >= 1 then return end + if RemoveItem(src, v.vial, 1) and RemoveItem(src, 'tab_paper', 1) then + AddItem(src, v.sheet, 1) + Log(GetName(src) ..' ' .. v.log, 'lsd') + count = count + 1 + end end end) local sheets = { - {item = 'smileyfacesheet', recieve = "Smiley_tabs", }, + {item = 'smileyfacesheet', recieve = "smiley_tabs", }, {item = 'wildcherrysheet', recieve = "wildcherry_tabs", }, {item = 'yinyangsheet', recieve = "yinyang_tabs", }, {item = 'pineapplesheet', recieve = "pineapple_tabs", }, diff --git a/server/mescaline.lua b/server/mescaline.lua index 2ecbe49..63a361f 100644 --- a/server/mescaline.lua +++ b/server/mescaline.lua @@ -1,14 +1,12 @@ local QBCore = exports['qb-core']:GetCoreObject() GlobalState.Mescaline = Config.Mescaline - Citizen.CreateThread(function() for _, v in pairs(Config.Mescaline) do v.taken = false end end) - function MescalineCooldown(loc) CreateThread(function() Wait(Config.respawnTime * 1000) @@ -22,7 +20,7 @@ end RegisterNetEvent("Mescaline:pickupCane", function(loc) - if CheckDist(source, Config.Mescaline[loc].location) then return end + if CheckDist(source, Config.Mescaline[loc].location) then return end if not Config.Mescaline[loc].taken then Config.Mescaline[loc].taken = true GlobalState.Mescaline = Config.Mescaline diff --git a/server/meth.lua b/server/meth.lua index d539aef..d510837 100644 --- a/server/meth.lua +++ b/server/meth.lua @@ -1,14 +1,14 @@ local QBCore = exports['qb-core']:GetCoreObject() RegisterServerEvent('md-drugs:server:startcook', function() - local src = source + local src = source if not GetRecipe(source, 'meth', 'cook', 'heat') then return end Notifys(src, "Adding Things To The Mix", "success") Log(GetName(source) .. ' Started A Meth Batch', 'Meth') end) RegisterServerEvent('md-drugs:server:givemethingridients', function() - local src = source + local src = source local chance = math.random(1,100) local amount = math.random(1,5) if chance <= 50 then @@ -30,18 +30,18 @@ end) RegisterServerEvent('md-drugs:server:geteph', function(num) local src = source - if CheckDist(src, Config.MethEph[num]['loc']) then return end - if AddItem(src, 'ephedrine', 1) then - Notifys(src, 'Got Ephedrine!', "success") - Log(GetName(src) .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth') - end + if CheckDist(src, Config.MethEph[num]['loc']) then return end + if AddItem(src, 'ephedrine', 1) then + Notifys(src, 'Got Ephedrine!', "success") + Log(GetName(src) .. ' Got ' .. 1 .. 'Of Ephedrine', 'Meth') + end end) RegisterServerEvent('md-drugs:server:getace', function(num) local src = source - if CheckDist(src, Config.Methace[num]['loc']) then return end - if AddItem(src, 'acetone', 1) then - Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') - Notifys(src, 'Got Acetone!', "success") - end + if CheckDist(src, Config.Methace[num]['loc']) then return end + if AddItem(src, 'acetone', 1) then + Log(GetName(src) .. ' Got ' .. 1 .. 'Of Acetone', 'Meth') + Notifys(src, 'Got Acetone!', "success") + end end) \ No newline at end of file diff --git a/server/travellingmerchant.lua b/server/travellingmerchant.lua index 0867d9f..51b8f6f 100644 --- a/server/travellingmerchant.lua +++ b/server/travellingmerchant.lua @@ -1,15 +1,84 @@ local QBCore = exports['qb-core']:GetCoreObject() local loc = math.random(1, #Config.Travellingmerchant) -RegisterServerEvent("md-drugs:server:travellingmerchantox", function(amount, money, item, price,table,num) - local src = source local Player = QBCore.Functions.GetPlayer(src) - if not table[num]['name'] == item then return end - if Player.Functions.RemoveMoney(tostring(money), tonumber(price) * tonumber(amount)) then - AddItem(source, item, amount) - Log(GetName(source) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant') - end +local stores = { + travel = { + {name = "tab_paper", price = 50, amount = 50, }, + {name = "bakingsoda", price = 25, amount = 50, }, + {name = "isosafrole", price = 25, amount = 50, }, + {name = "mdp2p", price = 25, amount = 50, }, + {name = "lysergic_acid", price = 25, amount = 50, }, + {name = "diethylamide", price = 25, amount = 50, }, + {name = "lockpick", price = 2, amount = 1000, }, + {name = "emptyvial", price = 2, amount = 1000, }, + {name = "needle", price = 2, amount = 1000, }, + {name = "cokeburner", price = 25, amount = 50, }, + {name = "crackburner", price = 2, amount = 50, }, + {name = "lsdburner", price = 2, amount = 50, }, + {name = "heroinburner", price = 2, amount = 50, }, + {name = "mdlean", price = 50, amount = 50, }, + {name = "weedgrinder", price = 25, amount = 50, }, + {name = "mdbutter", price = 25, amount = 50, }, + {name = "flour", price = 25, amount = 50, }, + {name = "chocolate", price = 25, amount = 50, }, + {name = "butane", price = 25, amount = 50, }, + {name = "butanetorch", price = 2, amount = 1000, }, + {name = "dabrig", price = 2, amount = 1000, }, + {name = "mdwoods", price = 2, amount = 1000, }, + {name = "leancup", price = 25, amount = 50, }, + {name = "xtcburner", price = 25, amount = 50, }, + }, + Weed = { + {name = "weedgrinder", price = 25, amount = 50, }, + {name = "mdbutter", price = 25, amount = 50, }, + {name = "flour", price = 25, amount = 50, }, + {name = "chocolate", price = 25, amount = 50, }, + {name = "butane", price = 25, amount = 50, }, + {name = "butanetorch", price = 2, amount = 1000,}, + {name = "dabrig", price = 2, amount = 1000,}, + {name = "mdwoods", price = 2, amount = 1000}, + }, + Products = { + {name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, + }, + ProductsStupidNameRewrite = { + {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0}, + {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, + } +} +lib.callback.register('md-drugs:server:menu', function(source, data) + local src = source + if data == 'travellingMerchant' then + return {table = stores.travel, des = '$', id = 'travellingMerchant', title = 'travelling Merchant'} + elseif data == 'dealermenu' then + local table + if Config.StupidassNewQbItemName then table = stores.ProductsStupidNameRewrite else table = stores.Products end + return {table = table, id = 'dealermenu', title = "Dealer Menu"} + elseif data == 'WeedShop' then + return {table = stores.Weed, id = 'WeedShop', title = "Weed Shop"} + end +end) + +RegisterServerEvent("md-drugs:server:purchaseGoods", function(amount, money, item, price,table,num) + local src = source local Player = QBCore.Functions.GetPlayer(src) + for i = 1, #table do + if table[i].name == item then + if not table[i].price == price then return end + if Player.Functions.RemoveMoney(tostring(money), tonumber(table[i].price) * tonumber(amount)) then + AddItem(src, item, amount) + Log(GetName(src) .. ' Bought ' .. amount .. ' Of ' .. item .. ' For ' .. tonumber(price) * tonumber(amount) .. '!', 'merchant') + end + end + end end) lib.callback.register('md-drugs:server:GetMerchant', function(source) -return loc + return loc end) \ No newline at end of file diff --git a/shared/config.lua b/shared/config.lua index f1eed7f..18c02d7 100644 --- a/shared/config.lua +++ b/shared/config.lua @@ -158,20 +158,6 @@ Config.WeedDry = { -- where you dry leaves Config.Joblock = false -- if you want weed to be a job Config.weedjob = "" -- what the job name is -Config.Weed = { --- this is the store for the weed ingridients - label = "Weed Shop", - slots = 8, - items = { - {name = "weedgrinder", price = 25, amount = 50, }, - {name = "mdbutter", price = 25, amount = 50, }, - {name = "flour", price = 25, amount = 50, }, - {name = "chocolate", price = 25, amount = 50, }, - {name = "butane", price = 25, amount = 50, }, - {name = "butanetorch", price = 2, amount = 1000,}, - {name = "dabrig", price = 2, amount = 1000,}, - {name = "mdwoods", price = 2, amount = 1000,}, - } -} ----------------- Wholesale Config.SuccessfulChance = 90 --- this is the chance of a Success wholesale 1-100 @@ -191,35 +177,7 @@ Config.Travellingmerchant = { ------------ these are the random locations the me vector4(-1522.93, 1476.01, 111.45, 41.25), vector4(-3278.98, 973.38, 5.35, 101.53), } -Config.Items = { --- this is the store for the travelling merchant - items = { - {name = "tab_paper", price = 50, amount = 50,}, - {name = "bakingsoda", price = 25, amount = 50, }, - {name = "isosafrole", price = 25, amount = 50, }, - {name = "mdp2p", price = 25, amount = 50, }, - {name = "lysergic_acid", price = 25, amount = 50, }, - {name = "diethylamide", price = 25, amount = 50, }, - {name = "lockpick", price = 2, amount = 1000, }, - {name = "emptyvial", price = 2, amount = 1000, }, - {name = "needle", price = 2, amount = 1000, }, - {name = "cokeburner", price = 25, amount = 50, }, - {name = "crackburner", price = 2, amount = 50, }, - {name = "lsdburner", price = 2, amount = 50, }, - {name = "heroinburner", price = 2, amount = 50, }, - {name = "mdlean", price = 50, amount = 50, }, - {name = "weedgrinder", price = 25, amount = 50, }, - {name = "mdbutter", price = 25, amount = 50, }, - {name = "flour", price = 25, amount = 50, }, - {name = "chocolate", price = 25, amount = 50, }, - {name = "butane", price = 25, amount = 50, }, - {name = "butanetorch", price = 2, amount = 1000, }, - {name = "dabrig", price = 2, amount = 1000, }, - {name = "mdwoods", price = 2, amount = 1000, }, - {name = "leancup", price = 25, amount = 50, }, - {name = "xtcburner", price = 25, amount = 50, }, - - } -} + --------------------------------------- oxy runs ---- How oxyruns work. You pay for a truck, you get in it and it gives a route. There is a 20% chance that the car will be "hot" and you have to ditch it. No Routes will spawn if that pops up ----- when you get to the drop off point third eye the truck. You will carry a box to the ped. He will give you cash, some oxy and maybe a random item. Rinse and repeat diff --git a/shared/qbdrugsrewrite.lua b/shared/qbdrugsrewrite.lua index aace4f3..f3b2b6d 100644 --- a/shared/qbdrugsrewrite.lua +++ b/shared/qbdrugsrewrite.lua @@ -140,25 +140,7 @@ QBConfig.DrugsPrice = { ["cupofdextro"] = {min = 18, max = 40}, } - QBConfig.Dealers = {} - - - -- Shop QBConfig -QBConfig.Products = { - [1] = {name = "weed_white-widow_seed", price = 15, amount = 150, minrep = 0}, - [2] = {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, - [3] = {name = "weed_purple-haze_seed", price = 15, amount = 150, minrep = 0}, - [4] = {name = "weed_og-kush_seed", price = 15, amount = 150, minrep = 0}, - [5] = {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, -} - -QBConfig.ProductsStupidNameRewrite = { - [1] = {name = "weed_whitewidow_seed", price = 15, amount = 150, minrep = 0}, - [2] = {name = "weed_skunk_seed", price = 15, amount = 150, minrep = 0}, - [3] = {name = "weed_purplehaze_seed", price = 15, amount = 150, minrep = 0}, - [4] = {name = "weed_ogkush_seed", price = 15, amount = 150, minrep = 0}, - [5] = {name = "weed_amnesia_seed", price = 15, amount = 150, minrep = 0}, -} +QBConfig.Dealers = {} QBConfig.UseMarkedBills = false -- true for marked bills, false for cash QBConfig.DeliveryRepGain = 1 -- amount of rep gained per delivery From 73af37c00a0166d0fbed84eed73c853bb81ce383 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:00:27 -0700 Subject: [PATCH 06/20] tweaks --- client/heroin.lua | 15 +++++------- client/weed.lua | 16 ++++++------- client/xtc.lua | 58 ++++++++++++++--------------------------------- 3 files changed, 31 insertions(+), 58 deletions(-) diff --git a/client/heroin.lua b/client/heroin.lua index 454a52e..ffc354f 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -2,6 +2,11 @@ local QBCore = exports['qb-core']:GetCoreObject() local PoppyPlants = {} local herointable = false +local options = { + { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, + { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, + } + local function pickher(loc) if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end TriggerServerEvent("heroin:pickupCane", loc) @@ -101,13 +106,9 @@ else local location, head = StartRay() if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end - local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z, true, false) + heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z, true, false) SetEntityHeading(heroinlabkit, head) PlaceObjectOnGroundProperly(heroinlabkit) - local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, - } AddMultiModel(heroinlabkit, options, heroinlabkit) end end) @@ -147,10 +148,6 @@ local head = GetEntityHeading(data) local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z-1, true, false) SetEntityHeading(heroinlabkit, head) PlaceObjectOnGroundProperly(heroinlabkit) - local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, - } AddMultiModel(heroinlabkit, options, heroinlabkit) end) diff --git a/client/weed.lua b/client/weed.lua index 121286b..a0d7624 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -140,14 +140,14 @@ AddBoxZoneSingle('makeoil',Config.MakeOil, { 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 = nil - end + 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 = nil + end return end if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makeoil") diff --git a/client/xtc.lua b/client/xtc.lua index 372f272..393a2fe 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -5,8 +5,8 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) if xtcpress then Notify(Lang.xtc.out, 'error') else - local coords, head = StartRay2() - xtcpress = true + local coords, head = StartRay2() + xtcpress = true progressbar('Setting Press On The Ground', 4000, 'uncuff') local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false) PlaceObjectOnGroundProperly(press) @@ -16,8 +16,8 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) icon = "fas fa-eye", label = Lang.targets.xtc.make, distance = 2.0, - action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end, - onSelect = function() TriggerEvent("md-drugs:client:XTCMenu", type)end, + action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end, + onSelect = function()TriggerEvent("md-drugs:client:XTCMenu", type)end, canInteract = function() if xtcpress then return true end end }, @@ -36,39 +36,15 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) end) RegisterNetEvent("md-drugs:client:XTCMenu", function(type) + local event = "md-drugs:client:MakeXTC" lib.registerContext({ id = 'XTCmenu', title = 'XTC Menu', options = { - { - icon = GetImage('white_xtc'), - title = 'White XTC', - description = '1 X Raw XTC', - event = "md-drugs:client:MakeXTC", - args = { data = type, color = 'white'} - }, - { - icon = GetImage('red_xtc'), - title = 'Red XTC', - description = '1 X Raw XTC and 1 X Loose Coke', - event = "md-drugs:client:MakeXTC", - args = { data = type, color = 'red'} - }, - { - icon = GetImage('orange_xtc'), - title = 'Orange XTC', - description = '1 X Raw XTC and 1 X Heroin Vial', - event = "md-drugs:client:MakeXTC", - args = { data = type, color = 'orange'} - }, - { - icon = GetImage('blue_xtc'), - title = 'Blue XTC', - description = '1 X Raw XTC and 1 X Crack Rock', - event = "md-drugs:client:MakeXTC", - args = { data = type, color = 'blue'} - }, - + {icon = GetImage('white_xtc'), title = 'White XTC', description = '1 X Raw XTC', event = event, args = { data = type, color = 'white'}}, + {icon = GetImage('red_xtc'), title = 'Red XTC', description = '1 X Raw XTC and 1 X Loose Coke', event = event, args = { data = type, color = 'red'}}, + {icon = GetImage('orange_xtc'), title = 'Orange XTC', description = '1 X Raw XTC and 1 X Heroin Vial', event = event, args = { data = type, color = 'orange'}}, + {icon = GetImage('blue_xtc'), title = 'Blue XTC', description = '1 X Raw XTC and 1 X Crack Rock', event = event, args = { data = type, color = 'blue'}}, } }) lib.showContext('XTCmenu') @@ -161,14 +137,14 @@ end) RegisterNetEvent("md-drugs:client:buypress", function() local img = GetImage('singlepress') lib.registerContext({ - id = 'buypresses', - title = 'Purchase Presses', - options = { - { title = Lang.xtc.press.title.single, description = Lang.xtc.des.title.single, icon = img, event = 'md-drugs:client:getsinglepress'}, - { title = Lang.xtc.press.title.dual, description = Lang.xtc.des.title.dual, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'dual'}}, - { title = Lang.xtc.press.title.triple, description = Lang.xtc.des.title.triple, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'triple'}}, - { title = Lang.xtc.press.title.quad, description = Lang.xtc.des.title.quad, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'quad'}} - } + id = 'buypresses', + title = 'Purchase Presses', + options = { + {title = Lang.xtc.press.title.single, description = Lang.xtc.des.title.single, icon = img, event = 'md-drugs:client:getsinglepress'}, + {title = Lang.xtc.press.title.dual, description = Lang.xtc.des.title.dual, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'dual'}}, + {title = Lang.xtc.press.title.triple, description = Lang.xtc.des.title.triple, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'triple'}}, + {title = Lang.xtc.press.title.quad, description = Lang.xtc.des.title.quad, icon = img, event = 'md-drugs:client:exchangepresses', args = {data = 'quad'}} + } }) lib.showContext('buypresses') end) From 12241338156f995cadbffbfccbc69f2bd142bca7 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Thu, 24 Oct 2024 20:19:44 -0700 Subject: [PATCH 07/20] rewrote crack --- server/crack.lua | 81 ++++++++++++++++++++++-------------------------- 1 file changed, 37 insertions(+), 44 deletions(-) diff --git a/server/crack.lua b/server/crack.lua index 6652f9c..cd4dc15 100644 --- a/server/crack.lua +++ b/server/crack.lua @@ -1,56 +1,49 @@ local QBCore = exports['qb-core']:GetCoreObject() - RegisterServerEvent('md-drugs:server:makecrackone', function(num) - local src = source + local src = source local Player = QBCore.Functions.GetPlayer(src) + local count,type, tier = 0, 'cookcrack', 'tier1' if CheckDist(src, Config.makecrack[num]['loc']) then return end - if Config.TierSystem then - local locoke = Player.Functions.GetItemByName('loosecoke') - local locoke2 = Player.Functions.GetItemByName('loosecokestagetwo') - local locoke3 = Player.Functions.GetItemByName('loosecokestagethree') - if locoke then - if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end - Log(GetName(src) .. ' Cut Crack', 'crack') - elseif locoke2 then - if not GetRecipe(src, 'crack', 'cookcrack', 'tier2') then return end - Log(GetName(src) .. ' Cut Crack', 'crack') - elseif locoke3 then - if not GetRecipe(src, 'crack', 'cookcrack', 'tier3') then return end - Log(GetName(src) .. ' Cut Crack', 'crack') - else - Notifys(src,Lang.Crack.nocoke, 'error') - end - else - if not GetRecipe(src, 'crack', 'cookcrack', 'tier1') then return end - Log(GetName(src) .. ' Cut Crack', 'crack') - 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'} + } + for _, v in ipairs(crackTiers) do + if count >= 1 then return end + if Player.Functions.GetItemByName(v.item) then + tier = v.tier + count = count + 1 + Log(GetName(src) .. v.log, 'crack') + end + end + end + if not GetRecipe(src, 'crack', type, tier) then return end end) + RegisterServerEvent('md-drugs:server:bagcrack', function(num) - local src = source + local src = source local Player = QBCore.Functions.GetPlayer(src) - if CheckDist(src, Config.bagcrack[num]['loc']) then return end - if Config.TierSystem then - local rock = Player.Functions.GetItemByName('crackrock') - local rock2 = Player.Functions.GetItemByName('crackrockstagetwo') - local rock3 = Player.Functions.GetItemByName('crackrockstagethree') - if rock then - if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end - Log(GetName(src) .. ' Bagged Crack', 'crack') - elseif rock2 then - if not GetRecipe(src, 'crack', 'bagcrack', 'tier2') then return end - Log(GetName(src) .. ' Bagged Crack', 'crack') - elseif rock3 then - if not GetRecipe(src, 'crack', 'bagcrack', 'tier3') then return end - Log(GetName(src) .. ' Bagged Crack', 'crack') - else - Notifys(src, Lang.Crack.nocoke, "error") - end - else - if not GetRecipe(src, 'crack', 'bagcrack', 'tier1') then return end - Log(GetName(src) .. ' Bagged Crack', 'crack') - end + local count,type, tier = 0, 'bagcrack', 'tier1' + 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'} + } + for _, v in ipairs(crackTiers) do + if count >= 1 then return end + if Player.Functions.GetItemByName(v.item) then + tier = v.tier + count = count + 1 + Log(GetName(src) .. v.log, 'crack') + end + end + end + if not GetRecipe(src, 'crack', type, tier) then return end end) local cokecut = {crackrockstagetwo = 2, crackrockstagethree = 3} From 83f27491017369f0d2b27b6ad9cb1374aecb9ff5 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Fri, 25 Oct 2024 01:55:35 -0700 Subject: [PATCH 08/20] remove blips| switch to waypoint. function spawning tables, code condense --- client/cocaine.lua | 13 ++++---- client/cornerselling.lua | 59 ++++++++++++++------------------- client/deliveries.lua | 56 ++++++++++---------------------- client/functions.lua | 24 +++++--------- client/heroin.lua | 70 +++++++++++++++------------------------- client/lsd.lua | 41 +++++++++++------------ client/mescaline.lua | 37 ++++++--------------- client/meth.lua | 5 ++- client/oxyruns.lua | 14 ++------ client/pharma.lua | 4 --- client/shrooms.lua | 5 ++- client/weed.lua | 25 ++++---------- client/wholesale.lua | 63 +++++++++++++++--------------------- 13 files changed, 147 insertions(+), 269 deletions(-) diff --git a/client/cocaine.lua b/client/cocaine.lua index d55dd90..9a2c4fa 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -48,7 +48,7 @@ AddEventHandler('onResourceStart', function(resource) LoadModel('prop_plant_01a') TriggerEvent('coke:init') end) - + AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01a')) @@ -85,20 +85,19 @@ RegisterNetEvent("md-drugs:client:bagcoke", function() BagCoke() else if not progressbar(Lang.Coke.bagging, 5000, 'uncuff') then baggingcoke = nil return end - end + end TriggerServerEvent("md-drugs:server:bagcoke") baggingcoke = nil - end) CreateThread(function() if Config.FancyCokeAnims == false then - AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut}) - AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag}) + AddBoxZoneMulti('cuttcoke', Config.CuttingCoke, { type = "client", event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut}) + AddBoxZoneMulti('baggcoke', Config.BaggingCoke, { type = "client", event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag}) else AddBoxZoneSingle('cutcoke', vector3(1093.17, -3195.74, -39.19), - { type = "client", event = "md-drugs:client:cutcokeone", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.cut, canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:cutcokeone", icon = "fa-solid fa-mortar-pestle", label = Lang.targets.coke.cut, canInteract = function()if cuttingcoke == nil and baggingcoke == nil then return true end end }) AddBoxZoneSingle('bagcokepowder', vector3(1090.29, -3195.66, -39.13), - { type = "client", event = "md-drugs:client:bagcoke", icon = "fas fa-sign-in-alt", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) + { type = "client", event = "md-drugs:client:bagcoke", icon = "fa-solid fa-sack-xmark", label = Lang.targets.coke.bag, canInteract = function() if baggingcoke == nil and cuttingcoke == nil then return true end end }) end end) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index 2414e64..f984d2c 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -3,40 +3,33 @@ local sell = false local sold = false local targbusy = false +local function reset(targ) + FreezeEntityPosition(targ, false) + ClearPedTasks(targ) + Wait(10000) + DeletePed(targ) + targbusy = false + sold = true +end + local function sellDrug(item, amount, price, targ) PoliceCall(20) targbusy = true if IsPedInAnyVehicle(PlayerPedId(), true) then Notify(Lang.Cornerselling.inveh, 'error') - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true - sell = false + reset(targ) return end if not progressbar(string.format(Lang.Cornerselling.selling, GetLabel(item), price), 4000, 'uncuff') then return end TriggerServerEvent('md-drugs:server:sellCornerDrugs', item, amount, price) - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true + reset(targ) end local function deny(targ) PoliceCall(20) targbusy = true if not progressbar(Lang.Cornerselling.deny, 4000, 'argue5') then return end - FreezeEntityPosition(targ, false) - ClearPedTasks(targ) - Wait(10000) - DeletePed(targ) - targbusy = false - sold = true -end + reset(targ) +end function Cornersell() local targ = lib.GetClosestPed(GetEntityCoords(PlayerPedId()), 8) @@ -48,27 +41,24 @@ function Cornersell() until #(GetEntityCoords(PlayerPedId()) - GetEntityCoords(targ)) < 2.0 lib.requestAnimDict("rcmme_tracey1") TaskStartScenarioInPlace(targ, "WORLD_HUMAN_STAND_IMPATIENT_UPRIGHT", 0, false) FreezeEntityPosition(targ, true) - local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { - { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon = "fas fa-eye", - action = function() sellDrug(item, amount, price, targ) end, - onSelect = function() sellDrug(item, amount, price, targ) end, + { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", + action = function() sellDrug(item, amount, price, targ) end, canInteract = function() if not targbusy then return true end end, }, - { label = Lang.targets.CornerSell.deny, icon = "fas fa-eye", - action = function() deny(targ) end, - onSelect = function() deny(targ) end, - canInteract = function() - if not targbusy then return true end end, + { label = Lang.targets.CornerSell.deny, icon = "fa-solid fa-person-harassing", + action = function() deny(targ) end, + canInteract = function() + if not targbusy then return true end end, }, } AddMultiModel(targ, options, nil) repeat Wait(1000) - until sold + until sold if sold then sold = false return true end end @@ -76,7 +66,7 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() if not GetCops(QBConfig.MinimumDrugSalePolice) then return end local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item ~= 'nothing' then - if sell then + if sell then Notify(Lang.Cornerselling.stop, 'error') sell = false else @@ -84,11 +74,10 @@ RegisterNetEvent('md-drugs:client:cornerselling', function() Notify(Lang.Cornerselling.start, 'success') repeat Wait(1000) - if not Cornersell() then end - until sell == false + if not Cornersell() then end + until not sell end else Notify(Lang.Cornerselling.nodrugs, 'error') end -end) - +end) \ No newline at end of file diff --git a/client/deliveries.lua b/client/deliveries.lua index d2d96f9..00f63bc 100644 --- a/client/deliveries.lua +++ b/client/deliveries.lua @@ -17,9 +17,7 @@ CreateThread(function() dealer[k] = CreatePed(0, Ped,loc.x,loc.y, loc.z-1, loc.h, false, false) Freeze(dealer[k], true, loc.h) local options = { - { - icon = 'fas fa-user-secret', - label = string.format(Lang.targets.Delivery.Deliver, v.name), + { 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) if bool then @@ -27,19 +25,9 @@ CreateThread(function() TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) end end, - onSelect = function() - local bool, item, amount, coords = lib.callback.await('md-drugs:server:GetDeliveryItem', false, k) - if item then - TriggerEvent('md-drugs:client:setLocation', {bool = bool, item = item, amount = amount, coords = coords}) - Email(Lang.Delivery.emailn, Lang.Delivery.emailsub, string.format(Lang.Delivery.emailcon, amount, GetLabel(item))) - end - end }, - { - icon = 'fas fa-user-secret', - label = string.format(Lang.targets.Delivery.open, v.name), + { icon = 'fas fa-user-secret', label = string.format(Lang.targets.Delivery.open, v.name), action = function() TriggerEvent('md-drugs:client:opendealermenu') end, - onSelect = function() TriggerEvent('md-drugs:client:opendealermenu') end } } AddMultiModel(dealer[k], options) @@ -48,34 +36,24 @@ end) RegisterNetEvent('md-drugs:client:setLocation', function(data) local coord = json.decode(data.coords) - local deliveryBlip = AddBlipForCoord(coord.x, coord.y, coord.z) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName('Drug Delivery') - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(coord.x, coord.y) if isActive then return end isActive = true local Buyer = CreatePed(0, "g_m_y_famdnf_01",coord.x, coord.y, coord.z-1, 180.0, false, false) Freeze(Buyer, true, 180) - AddSingleModel(Buyer, { - icon = 'fas fa-user-secret', - label = Lang.targets.Delivery.hand, - action = function() - if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end - isActive = false - DeletePed(Buyer) - RemoveBlip(deliveryBlip) - TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) - end, - canInteract = function() - if isActive then - return true - end + AddSingleModel(Buyer, { + icon = 'fas fa-user-secret', + label = Lang.targets.Delivery.hand, + action = function() + if not progressbar(Lang.Delivery.pack, 4000, 'uncuff') then return end + isActive = false + DeletePed(Buyer) + TriggerServerEvent('md-drugs:server:giveDeliveryItems', data.item, data.amount) + end, + canInteract = function() + if isActive then + return true end - }, nil) + end + }, nil) end) \ No newline at end of file diff --git a/client/functions.lua b/client/functions.lua index c88cda4..d8ab2d2 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -368,22 +368,6 @@ function tele(coords) DoScreenFadeIn(500) end -function Blip(entity, text) - local deliveryBlip = AddBlipForCoord(entity) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName(text) - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) -end - -function RemoveBlips() - RemoveBlip(deliveryBlip) -end function AddBoxZoneSingle(name, loc, data) if Config.Target == 'qb' then @@ -476,6 +460,14 @@ function AddSingleModel(model, data, num) end function AddMultiModel(model, data, num) + local data = {} + for k, v in pairs (data) do + table.insert(data,{ + { icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, + onSelect = v.action,data = num,canInteract = v.canInteract or nil, + } + }) + end if Config.Target == 'qb' then exports['qb-target']:AddTargetEntity(model, {options = data, distance = 2.5}) elseif Config.Target == 'ox' then diff --git a/client/heroin.lua b/client/heroin.lua index ffc354f..c326f76 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -2,10 +2,16 @@ local QBCore = exports['qb-core']:GetCoreObject() local PoppyPlants = {} local herointable = false -local options = { - { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, - { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, - } + local function createLabKit(coord, head) + local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) + SetEntityHeading(heroinlabkit, head) + PlaceObjectOnGroundProperly(heroinlabkit) + local options = { + { event = "md-drugs:client:heatliquidheroin", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.cook, data = heroinlabkit}, + { event = "md-drugs:client:getheroinkitback", icon = "fas fa-box-circle-check", label = Lang.targets.heroin.up, data = heroinlabkit, canInteract = function() if herointable then return true end end}, + } + AddMultiModel(heroinlabkit, options, heroinlabkit) +end local function pickher(loc) if not progressbar(Lang.Heroin.pick, 4000, 'uncuff') then return end @@ -21,26 +27,21 @@ local Ped = "g_m_y_famdnf_01" AddSingleModel(heroinkitdealer, { label = Lang.targets.heroin.kit, icon = "fas fa-eye", event = "md-drugs:client:buyheroinlabkit", distance = 2.0}, nil ) end) ----- plant spawns dont edit RegisterNetEvent('heroin:respawnCane', function(loc) local v = GlobalState.PoppyPlants[loc] local hash = GetHashKey(v.model) if not PoppyPlants[loc] then PoppyPlants[loc] = CreateObject(hash, v.location, false, true, true) Freeze(PoppyPlants[loc], true, v.heading) - AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(loc) end}, loc ) + AddSingleModel(PoppyPlants[loc], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(loc) end}, loc ) end end) - - RegisterNetEvent('heroin:removeCane', function(loc) if DoesEntityExist(PoppyPlants[loc]) then DeleteEntity(PoppyPlants[loc]) end PoppyPlants[loc] = nil end) - - RegisterNetEvent("heroin:init", function() for k, v in pairs (GlobalState.PoppyPlants) do local hash = GetHashKey(v.model) @@ -48,7 +49,7 @@ RegisterNetEvent("heroin:init", function() if not v.taken then PoppyPlants[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(PoppyPlants[k], true, v.heading) - AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(k) end}, k ) + AddSingleModel(PoppyPlants[k], {icon = "fas fa-hand", label = Lang.targets.heroin.pick, action = function() pickher(k) end}, k ) end end end) @@ -75,11 +76,7 @@ AddEventHandler('onResourceStart', function(resource) end end end - DeleteObject(heroinlabkit) - DeleteObject(dirtylabkitheroin) end) ----- plant stop end - RegisterNetEvent("md-drugs:client:dryplant", function(data) if not progressbar(Lang.Heroin.dryout, 4000, 'uncuff') then return end @@ -97,26 +94,20 @@ RegisterNetEvent("md-drugs:client:buyheroinlabkit", function() TriggerServerEvent("md-drugs:server:getheroinlabkit") end) - RegisterNetEvent("md-drugs:client:setheroinlabkit", function() -if herointable then - Notify(Lang.Heroin.tableout, 'error') -else - herointable = true - local location, head = StartRay() - if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end - if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end - heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z, true, false) - SetEntityHeading(heroinlabkit, head) - PlaceObjectOnGroundProperly(heroinlabkit) - AddMultiModel(heroinlabkit, options, heroinlabkit) -end + if herointable then + Notify(Lang.Heroin.tableout, 'error') + else + herointable = true + local location, head = StartRay() + if not location then herointable = false TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end + if not progressbar(Lang.Heroin.table, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getheroinlabkitback') return end + createLabKit(location, head) + end end) - RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) - local loc = GetEntityCoords(data.data) - local head = GetEntityHeading(data.data) + local loc, head = GetEntityCoords(data.data), GetEntityHeading(data.data) if not ItemCheck('emptyvial') then return end if not minigame() then TriggerServerEvent("md-drugs:server:failheatingheroin") @@ -130,7 +121,7 @@ RegisterNetEvent("md-drugs:client:heatliquidheroin", function(data) SetPedToRagdoll(PlayerPedId(), 1300, 1300, 0, 0, 0, 0) AddMultiModel(dirtylabkitheroin, {event = "md-drugs:client:cleanheroinlabkit",icon = "fas fa-box-circle-check",label = Lang.target.heroin.clean, data = dirtylabkitheroin}, nil ) return end - if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end + if not progressbar(Lang.Heroin.success, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:heatliquidheroin") end) @@ -142,17 +133,11 @@ RegisterNetEvent("md-drugs:client:cleanheroinlabkit", function(data) end) RegisterNetEvent("md-drugs:client:deletedirtyheroin", function(data) -local location = GetEntityCoords(data) -local head = GetEntityHeading(data) + local location,head = GetEntityCoords(data), GetEntityHeading(data) DeleteObject(data) - local heroinlabkit = CreateObject("v_ret_ml_tablea", location.x, location.y, location.z-1, true, false) - SetEntityHeading(heroinlabkit, head) - PlaceObjectOnGroundProperly(heroinlabkit) - AddMultiModel(heroinlabkit, options, heroinlabkit) + createLabKit(location, head) end) - - RegisterNetEvent("md-drugs:client:getheroinkitback", function(data) if not progressbar(Lang.Heroin.pickup, 4000, 'uncuff') then return end herointable = false @@ -160,11 +145,8 @@ RegisterNetEvent("md-drugs:client:getheroinkitback", function(data) TriggerServerEvent("md-drugs:server:getheroinlabkitback") end) - RegisterNetEvent("md-drugs:client:fillneedle", function(data) if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", data.data) return end if not progressbar(Lang.Heroin.needles, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillneedle", data.data) -end) - - +end) \ No newline at end of file diff --git a/client/lsd.lua b/client/lsd.lua index 63a40ce..8eb550c 100644 --- a/client/lsd.lua +++ b/client/lsd.lua @@ -2,10 +2,21 @@ 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) + PlaceObjectOnGroundProperly(labkit) + local options = { + { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit }, + { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit }, + { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit }, + { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() return tableout end } + } + AddMultiModel(labkit, options, labkit) +end CreateThread(function() -local Ped = "g_m_y_famdnf_01" + local Ped = "g_m_y_famdnf_01" lib.requestModel(Ped, Config.RequestModelTime) local tabdealer = CreatePed(0, Ped,Config.buylsdlabkit.x,Config.buylsdlabkit.y,Config.buylsdlabkit.z-1, Config.buylsdlabkit.w, false, false) Freeze(tabdealer, true, Config.buylsdlabkit.w) @@ -35,16 +46,7 @@ else local loc, head = StartRay() if not loc then tableout = false TriggerServerEvent('md-drugs:server:getlabkitback') return end if not progressbar(Lang.lsd.place, 4000, 'uncuff') then TriggerServerEvent('md-drugs:server:getlabkitback') return end - local labkit = CreateObject("v_ret_ml_tablea", loc.x, loc.y, loc.z-1, true, false) - SetEntityHeading(labkit, head) - PlaceObjectOnGroundProperly(labkit) - local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, - } - AddMultiModel(labkit, options, labkit) + createLabKit(loc, head) end end) @@ -56,7 +58,7 @@ RegisterNetEvent("md-drugs:client:getlabkitback", function(data) end) RegisterNetEvent("md-drugs:client:heatliquid", function(data) - local PedCoords = GetEntityCoords(data.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 @@ -64,6 +66,7 @@ RegisterNetEvent("md-drugs:client:heatliquid", function(data) TriggerServerEvent("md-drugs:server:failheating") DeleteObject(data.data) local dirtylabkit = CreateObject("v_ret_ml_tablea", PedCoords.x, PedCoords.y, PedCoords.z-1, true, false) + SetEntityHeading(dirtylabkit, head) loadParticle(dict) exitPtfx = StartParticleFxLoopedOnEntity("scr_dst_cocaine", dirtylabkit, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, false, false, false) PlaceObjectOnGroundProperly(dirtylabkit) @@ -80,17 +83,9 @@ RegisterNetEvent("md-drugs:client:cleanlabkit", function(data) if not progressbar(Lang.lsd.clean, 4000, 'clean') then return end local check = lib.callback.await('md-drugs:server:removecleaningkit') if check then - local coord = GetEntityCoords(data.data) + local coord, head = GetEntityCoords(data.data), GetEntityHeading(data.data) DeleteObject(data.data) - local labkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z-1, true, false) - PlaceObjectOnGroundProperly(labkit) - local options = { - { event = "md-drugs:client:heatliquid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.heat, data = labkit, }, - { event = "md-drugs:client:refinequalityacid", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.refine, data = labkit, }, - { event = "md-drugs:client:maketabpaper", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.dab, data = labkit, }, - { event = "md-drugs:client:getlabkitback", icon = "fas fa-box-circle-check", label = Lang.targets.lsd.back, data = labkit, canInteract = function() if tableout then return true end end}, - } - AddMultiModel(labkit, options, labkit) + createLabKit(coord, head) end end) diff --git a/client/mescaline.lua b/client/mescaline.lua index a8d3ace..2b6d7f0 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -24,15 +24,11 @@ RegisterNetEvent('Mescaline:respawnCane', function(loc) end end) - - RegisterNetEvent('Mescaline:removeCane', function(loc) if DoesEntityExist(Mescaline[loc]) then DeleteEntity(Mescaline[loc]) end Mescaline[loc] = nil end) - - RegisterNetEvent("Mescaline:init", function() for k, v in pairs (GlobalState.Mescaline) do local hash = GetHashKey(v.model) @@ -69,43 +65,28 @@ AddEventHandler('onResourceStart', function(resource) end end) - - RegisterNetEvent("md-drugs:client:drymescaline", function() if not ItemCheck('cactusbulb') then return end if not progressbar(Lang.mescaline.dry, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:drymescaline") end) - RegisterNetEvent("md-drugs:client:takemescaline", function() -local chance = math.random(1,100) -local chance2 = math.random(1,100) + local chance, chance2 = math.random(1,100), math.random(1,100) + local weapon = '' + if chance2 == 100 then weapon = 'weapon_rpg' else weapon = 'weapon_flaregun' end if not progressbar(Lang.mescaline.eat, 4000, 'uncuff') then return end if chance <= Config.Badtrip then AlienEffect() local clone = ClonePed(PlayerPedId(), false, false, true) SetEntityAsMissionEntity(clone) - SetEntityVisible(clone, true) - SetPedRelationshipGroupHash(clone) - SetPedAccuracy(clone) - SetPedArmour(clone) - SetPedCanSwitchWeapon(clone, true) SetPedFleeAttributes(clone, false) - if chance2 <= 99 then - GiveWeaponToPed(clone, "weapon_flaregun", 1, false, true) - TaskCombatPed(clone, PlayerPedId(), 0, 16) - SetPedCombatAttributes(clone, 46, true) - Wait(1000 * 30) - DeleteEntity(clone) - else - GiveWeaponToPed(clone, "weapon_rpg", 1, false, true) - TaskCombatPed(clone, PlayerPedId(), 0, 16) - SetPedCombatAttributes(clone, 46, true) - Wait(1000 * 30) - DeleteEntity(clone) - end + GiveWeaponToPed(clone, weapon, 1, false, true) + TaskCombatPed(clone, PlayerPedId(), 0, 16) + SetPedCombatAttributes(clone, 46, true) + Wait(1000 * 30) + DeleteEntity(clone) else AlienEffect() - end + end end) diff --git a/client/meth.lua b/client/meth.lua index bf1b0a1..8e382f6 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -83,18 +83,17 @@ CreateThread(function() end) CreateThread(function() - AddBoxZoneSingle("methTeleOut",Config.MethTeleIn, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.enter, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleOut) end} ) AddBoxZoneSingle("methtelein",Config.MethTeleOut, {name = 'teleout', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.exit, action = function() SetEntityCoords(PlayerPedId(), Config.MethTeleIn) end} ) local options = { - { name = 'methcook', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, onSelect = function() startcook() end, + { name = 'methcook', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.cook, distance = 2.5, action = function() startcook() end, canInteract = function() if amonia == nil and active == nil then return true end end, }, - { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, onSelect = function() trayscarry() end, action = function() trayscarry() end, + { name = 'grabtray', icon = "fas fa-sign-in-alt", label = Lang.targets.meth.tray, distance = 2.5, action = function() trayscarry() end, canInteract = function() if heated and amonia and tray == nil then return true end end, diff --git a/client/oxyruns.lua b/client/oxyruns.lua index 391d5b2..9ad39a8 100644 --- a/client/oxyruns.lua +++ b/client/oxyruns.lua @@ -1,5 +1,4 @@ local QBCore = exports['qb-core']:GetCoreObject() -local deliveryBlip = nil local carryPackage = nil RegisterNetEvent("md-drugs:client:GetOxyCar", function() @@ -19,16 +18,7 @@ end) RegisterNetEvent("md-drugs:client:getoxylocationroute", function() local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)] if CurrentLocation ~= nil then - local deliveryBlip = AddBlipForCoord(CurrentLocation) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName('Oxy Buyer') - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(CurrentLocation.x, CurrentLocation.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) @@ -36,7 +26,7 @@ RegisterNetEvent("md-drugs:client:getoxylocationroute", function() repeat Wait(1000) until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x,CurrentLocation.y,CurrentLocation.z)) < 5.0 - RemoveBlip(deliveryBlip) + PoliceCall(Config.PoliceAlertOxy) AddSingleModel(oxybuyer, { type = "client", label = Lang.targets.oxy.talk, icon = "fas fa-eye", action = function() diff --git a/client/pharma.lua b/client/pharma.lua index 95759a0..404cd07 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -19,20 +19,16 @@ else end end) - - RegisterNetEvent("md-drugs:client:writeprescription", function(args) if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end TriggerServerEvent("md-drugs:server:giveprescription", args.item) end) - RegisterNetEvent("md-drugs:client:fillprescription", function(data) if not progressbar(Lang.Pharma.fill, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) - RegisterNetEvent("md-drugs:client:unbottle", function(item) if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end if item.name == 'vicodinbottle' then item = 'vicodin' end diff --git a/client/shrooms.lua b/client/shrooms.lua index c5baefa..29fde38 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,7 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local shrooms = {} - function LoadModel(hash) hash = GetHashKey(hash) RequestModel(hash) @@ -14,6 +13,7 @@ local function pick(loc) if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) end + RegisterNetEvent('shrooms:respawnCane', function(loc) local v = GlobalState.shrooms[loc] local hash = GetHashKey(v.model) @@ -23,6 +23,7 @@ RegisterNetEvent('shrooms:respawnCane', function(loc) AddSingleModel(shrooms[loc],{ icon = "fas fa-hand", label = Lang.targets.shrooms.pick, action = function() pick(loc) end }, loc ) end end) + AddEventHandler('onResourceStart', function(resource) if resource == GetCurrentResourceName() then Wait(3000) @@ -53,7 +54,6 @@ end) TriggerEvent('shrooms:init') end) - RegisterNetEvent("shrooms:init", function() for k, v in pairs (GlobalState.shrooms) do local hash = GetHashKey(v.model) @@ -66,7 +66,6 @@ end) end end) - RegisterNetEvent('md-drugs:client:takeshrooms', function() if not progressbar(Lang.Shrooms.eat, 500, 'eat') then return end TriggerEvent("evidence:client:SetStatus", "widepupils", 300) diff --git a/client/weed.lua b/client/weed.lua index a0d7624..c79ddc1 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -19,7 +19,6 @@ local function hasJob() return true end end - RegisterNetEvent('weed:respawnCane', function(loc) local v = GlobalState.WeedPlant[loc] local hash = GetHashKey(v.model) @@ -27,15 +26,10 @@ 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()if not progressbar(Lang.Weed.pick, 4000, 'uncuff') then return end TriggerServerEvent("weed:pickupCane", loc) end}, + loc) end end) @@ -52,14 +46,9 @@ RegisterNetEvent("weed:init", function() 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) + {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) end end end) diff --git a/client/wholesale.lua b/client/wholesale.lua index 4ccf90c..f4f42eb 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -1,6 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local miss = false -local deliveryBlip = nil + RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) if not GetCops(Config.PoliceCount) then return end @@ -12,16 +12,7 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) local CurrentLocation = Config.oxylocations[math.random(#Config.oxylocations)] local timer = 0 miss = true - deliveryBlip = AddBlipForCoord(CurrentLocation) - SetBlipSprite(deliveryBlip, 1) - SetBlipDisplay(deliveryBlip, 2) - SetBlipScale(deliveryBlip, 1.0) - SetBlipAsShortRange(deliveryBlip, false) - SetBlipColour(deliveryBlip, 27) - BeginTextCommandSetBlipName("STRING") - AddTextComponentSubstringPlayerName("drug Meet") - EndTextCommandSetBlipName(deliveryBlip) - SetBlipRoute(deliveryBlip, true) + SetNewWaypoint(CurrentLocation.x, CurrentLocation.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) @@ -32,25 +23,24 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) label = Lang.Wholesale.talk, icon = "fas fa-eye", action = function() - local luck = math.random(1,100) - if luck >=101 then - TriggerEvent("md-drugs:client:SuccessSale", drug) - Wait(4000) - DeleteEntity(drugdealer) - else - TriggerEvent("md-drugs:client:SetUp") - Wait(3000) - DeleteEntity(drugdealer) - end - miss = false - end, + local luck = math.random(1,100) + if luck >=101 then + TriggerEvent("md-drugs:client:SuccessSale", drug) + Wait(4000) + DeleteEntity(drugdealer) + else + TriggerEvent("md-drugs:client:SetUp") + Wait(3000) + DeleteEntity(drugdealer) + end + miss = false + end, },nil ) repeat Wait(1000) timer = timer + 1 until #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 or timer == Config.WholesaleTimeout + 1 PoliceCall(Config.AlertPoliceWholesale) - RemoveBlip(deliveryBlip) if timer <= Config.WholesaleTimeout or #(GetEntityCoords(PlayerPedId()) - vector3(CurrentLocation.x, CurrentLocation.y, CurrentLocation.z) ) < 4.0 then timer = 0 else @@ -62,21 +52,20 @@ end) RegisterNetEvent("md-drugs:client:SuccessSale", function(drug) - if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end - if drug == 'coke' then - TriggerServerEvent("md-drugs:server:wholesalecoke") - elseif drug == 'crack' then - TriggerServerEvent("md-drugs:server:wholesalecrack") - elseif drug == 'lsd' then - TriggerServerEvent("md-drugs:server:wholesalelsd") - elseif drug == 'heroin' then - TriggerServerEvent("md-drugs:server:wholesaleheroin") - elseif drug == 'xtc' then - TriggerEvent("md-drugs:client:wholesalextc") - end + if not progressbar("Wholesaling Drugs", 4000, 'uncuff') then return end + if drug == 'coke' then + TriggerServerEvent("md-drugs:server:wholesalecoke") + elseif drug == 'crack' then + TriggerServerEvent("md-drugs:server:wholesalecrack") + elseif drug == 'lsd' then + TriggerServerEvent("md-drugs:server:wholesalelsd") + elseif drug == 'heroin' then + TriggerServerEvent("md-drugs:server:wholesaleheroin") + elseif drug == 'xtc' then + TriggerEvent("md-drugs:client:wholesalextc") + end end) - RegisterNetEvent("md-drugs:client:SetUp", function() progressbar("YOU FUCKED NOW", 4000, 'uncuff') SetUpPeds() From 24877e6447373be25cae0edfa0421c6d6e8ff741 Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Fri, 25 Oct 2024 02:00:55 -0700 Subject: [PATCH 09/20] condense target --- client/xtc.lua | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/client/xtc.lua b/client/xtc.lua index 393a2fe..d39e192 100644 --- a/client/xtc.lua +++ b/client/xtc.lua @@ -12,23 +12,11 @@ RegisterNetEvent("md-drugs:client:setpress", function(type) PlaceObjectOnGroundProperly(press) SetEntityHeading(press, head) local options = { - { - icon = "fas fa-eye", - label = Lang.targets.xtc.make, - distance = 2.0, - action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end, - onSelect = function()TriggerEvent("md-drugs:client:XTCMenu", type)end, - canInteract = function() - if xtcpress then return true end end + { icon = "fas fa-eye", label = Lang.targets.xtc.make, distance = 2.0, action = function() TriggerEvent("md-drugs:client:XTCMenu", type) end, + canInteract = function() if xtcpress then return true end end }, - { - icon = "fas fa-eye", - label = Lang.targets.xtc.pick, - action = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, - onSelect = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, - distance = 2.0, - canInteract = function() - if xtcpress then return true end end + {icon = "fas fa-eye", label = Lang.targets.xtc.pick, action = function() TriggerEvent("md-drugs:client:GetPressBack", type, press) end, distance = 2.0, + canInteract = function() if xtcpress then return true end end }, } AddMultiModel(press, options, nil) From 99d0ae58bec56cc52808742e51c8609aafbfd42a Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Fri, 25 Oct 2024 11:41:59 -0700 Subject: [PATCH 10/20] removed OnPlayerLoad and Resource Start from prop drugs to functions file to condense repeatable code --- client/cocaine.lua | 13 --------- client/functions.lua | 69 +++++++++++++++++++++++++++----------------- client/heroin.lua | 15 +--------- client/mescaline.lua | 23 +-------------- client/shrooms.lua | 24 +-------------- client/weed.lua | 19 ------------ 6 files changed, 46 insertions(+), 117 deletions(-) diff --git a/client/cocaine.lua b/client/cocaine.lua index 9a2c4fa..a45c9f4 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -36,19 +36,6 @@ RegisterNetEvent("coke:init", function() end end) -AddEventHandler('onResourceStart', function(resource) - if resource == GetCurrentResourceName() then - LoadModel('prop_plant_01a') - TriggerEvent('coke:init') - end - end) - - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() - Wait(3000) - LoadModel('prop_plant_01a') - TriggerEvent('coke:init') - end) - AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01a')) diff --git a/client/functions.lua b/client/functions.lua index d8ab2d2..49621ac 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -63,6 +63,10 @@ function loadParticle(dict) SetPtfxAssetNextCall(dict) end +function LoadModel(hash) + lib.requestModel(hash, Config.RequestModelTime) +end + function minigame() local time = 0 local game = Config.Minigames @@ -173,30 +177,28 @@ function minigame() end function GetImage(img) - if GetResourceState('ox_inventory') == 'started' then - local Items = exports['ox_inventory']:Items() - if Items[img]['client'] then - if Items[img]['client']['image'] then - return Items[img]['client']['image'] - else - return "nui://ox_inventory/web/images/".. img.. '.png' - end - else - return "nui://ox_inventory/web/images/".. img.. '.png' - end - elseif GetResourceState('ps-inventory') == 'started' then - return "nui://ps-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('lj-inventory') == 'started' then - return "nui://lj-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('qb-inventory') == 'started' then - return "nui://qb-inventory/html/images/".. QBCore.Shared.Items[img].image - elseif GetResourceState('qs-inventory') == 'started' then - return "nui://qs-inventory/html/img/".. QBCore.Shared.Items[img].image - elseif GetResourceState('origen_inventory') == 'started' then - return "nui://origen_inventory/html/img/".. QBCore.Shared.Items[img].image - elseif GetResourceState('core_inventory') == 'started' then - return "nui://core_inventory/html/img/".. QBCore.Shared.Items[img].image - end + if GetResourceState('ox_inventory') == 'started' then + local Items = exports['ox_inventory']:Items() + local itemClient = Items[img] and Items[img]['client'] + if itemClient and itemClient['image'] then + return itemClient['image'] + else + return "nui://ox_inventory/web/images/" .. img .. '.png' + end + end + local invs = { + ['ps-inventory'] = "nui://ps-inventory/html/images/", + ['lj-inventory'] = "nui://lj-inventory/html/images/", + ['qb-inventory'] = "nui://qb-inventory/html/images/", + ['qs-inventory'] = "nui://qs-inventory/html/img/", + ['origen_inventory'] = "nui://origen_inventory/html/img/", + ['core_inventory'] = "nui://core_inventory/html/img/" + } + for k, v in pairs(invs) do + if GetResourceState(k) == 'started' then + return v .. QBCore.Shared.Items[img].image + end + end end function GetLabel(label) @@ -464,7 +466,7 @@ function AddMultiModel(model, data, num) for k, v in pairs (data) do table.insert(data,{ { icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, - onSelect = v.action,data = num,canInteract = v.canInteract or nil, + onSelect = v.action,data = num,canInteract = v.canInteract or nil, distance = 2.0 } }) end @@ -566,9 +568,24 @@ end RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() Wait(3000) + LoadModel('prop_plant_01b') TriggerEvent('heroin:init') + LoadModel('prop_plant_01a') TriggerEvent('coke:init') + LoadModel('prop_cactus_03') TriggerEvent('Mescaline:init') + LoadModel('mushroom') TriggerEvent('shrooms:init') + LoadModel('bkr_prop_weed_lrg_01b') TriggerEvent('weed:init') local check = lib.callback.await('md-drugs:server:GetRep', false) - return + return +end) + +AddEventHandler('onResourceStart', function(resource) + if resource == GetCurrentResourceName() then + LoadModel('prop_plant_01b') TriggerEvent('heroin:init') + LoadModel('prop_plant_01a') TriggerEvent('coke:init') + LoadModel('prop_cactus_03') TriggerEvent('Mescaline:init') + LoadModel('mushroom') TriggerEvent('shrooms:init') + LoadModel('bkr_prop_weed_lrg_01b') TriggerEvent('weed:init') + end end) local active = false RegisterNetEvent('md-drugs:client:minusTier', function(data) diff --git a/client/heroin.lua b/client/heroin.lua index c326f76..7ec37f5 100644 --- a/client/heroin.lua +++ b/client/heroin.lua @@ -3,7 +3,7 @@ local PoppyPlants = {} local herointable = false local function createLabKit(coord, head) - local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false) + local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false) SetEntityHeading(heroinlabkit, head) PlaceObjectOnGroundProperly(heroinlabkit) local options = { @@ -54,19 +54,6 @@ RegisterNetEvent("heroin:init", function() end end) -AddEventHandler('onResourceStart', function(resource) - if resource == GetCurrentResourceName() then - LoadModel('prop_plant_01b') - TriggerEvent('heroin:init') - end - end) - - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() - Wait(3000) - LoadModel('prop_plant_01b') - TriggerEvent('heroin:init') - end) - AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('prop_plant_01b')) diff --git a/client/mescaline.lua b/client/mescaline.lua index 2b6d7f0..c52910c 100644 --- a/client/mescaline.lua +++ b/client/mescaline.lua @@ -1,14 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local Mescaline = {} -function LoadModel(hash) - hash = GetHashKey(hash) - RequestModel(hash) - while not HasModelLoaded(hash) do - Wait(3000) - end -end - local function pick(loc) if not progressbar(Lang.mescaline.pick, 4000, 'uncuff') then return end TriggerServerEvent("Mescaline:pickupCane", loc) @@ -41,20 +33,7 @@ RegisterNetEvent("Mescaline:init", function() end end) -AddEventHandler('onResourceStart', function(resource) - if resource == GetCurrentResourceName() then - LoadModel('prop_cactus_03') - TriggerEvent('Mescaline:init') - end - end) - - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() - Wait(3000) - LoadModel('prop_cactus_03') - TriggerEvent('Mescaline:init') - end) - - AddEventHandler('onResourceStop', function(resourceName) +AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('prop_cactus_03')) for k, v in pairs(Mescaline) do diff --git a/client/shrooms.lua b/client/shrooms.lua index 29fde38..5aff339 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -1,14 +1,6 @@ local QBCore = exports['qb-core']:GetCoreObject() local shrooms = {} -function LoadModel(hash) - hash = GetHashKey(hash) - RequestModel(hash) - while not HasModelLoaded(hash) do - Wait(3000) - end -end - local function pick(loc) if not progressbar(Lang.Shrooms.pick, 4000, 'uncuff') then return end TriggerServerEvent("shrooms:pickupCane", loc) @@ -24,14 +16,6 @@ RegisterNetEvent('shrooms:respawnCane', function(loc) end end) -AddEventHandler('onResourceStart', function(resource) - if resource == GetCurrentResourceName() then - Wait(3000) - LoadModel('mushroom') - TriggerEvent('shrooms:init') - end - end) - AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('mushroom')) @@ -48,13 +32,7 @@ RegisterNetEvent('shrooms:removeCane', function(loc) shrooms[loc] = nil end) - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() - Wait(3000) - LoadModel('mushroom') - TriggerEvent('shrooms:init') - end) - - RegisterNetEvent("shrooms:init", function() +RegisterNetEvent("shrooms:init", function() for k, v in pairs (GlobalState.shrooms) do local hash = GetHashKey(v.model) if not HasModelLoaded(hash) then LoadModel(hash) end diff --git a/client/weed.lua b/client/weed.lua index c79ddc1..25f63d9 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -3,13 +3,6 @@ local WeedPlant = {} local exploded = nil local drying = false -function LoadModel(hash) - hash = GetHashKey(hash) - RequestModel(hash) - while not HasModelLoaded(hash) do - Wait(3000) - end -end local function hasJob() if Config.Joblock then @@ -53,18 +46,6 @@ RegisterNetEvent("weed:init", function() end end) -AddEventHandler('onResourceStart', function(resource) - if resource == GetCurrentResourceName() then - LoadModel('bkr_prop_weed_lrg_01b') - TriggerEvent('weed:init') - end - end) - RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() - Wait(3000) - LoadModel('bkr_prop_weed_lrg_01b') - TriggerEvent('weed:init') - end) - AddEventHandler('onResourceStop', function(resourceName) if GetCurrentResourceName() == resourceName then SetModelAsNoLongerNeeded(GetHashKey('bkr_prop_weed_lrg_01b')) From 70c3d9ae1524ee109562ebef27b9cfc003a96d8b Mon Sep 17 00:00:00 2001 From: Mustache Dom <123716453+Mustachedom@users.noreply.github.com> Date: Mon, 28 Oct 2024 14:11:49 -0700 Subject: [PATCH 11/20] updated a lot --- client/animationsandfunctions.lua | 2 +- client/cocaine.lua | 2 +- client/cornerselling.lua | 2 +- client/functions.lua | 31 ++-- client/meth.lua | 13 +- client/shrooms.lua | 9 +- client/weed.lua | 10 +- client/wholesale.lua | 8 +- readme.md | 244 ++++++++++++++------------- server/cornerselling.lua | 5 +- server/functions.lua | 44 ++++- shared/config.lua | 34 ++-- shared/qbdrugsrewrite.lua | 271 +++++++++++++++--------------- 13 files changed, 358 insertions(+), 317 deletions(-) diff --git a/client/animationsandfunctions.lua b/client/animationsandfunctions.lua index 1c677d7..acbda8b 100644 --- a/client/animationsandfunctions.lua +++ b/client/animationsandfunctions.lua @@ -510,7 +510,6 @@ function SetUpPeds() } for i = 1, #peds do local k = peds[i] - print(GetPedRelationshipGroupHash(i) ) i = CreatePed(0, "g_m_y_famdnf_01", k.x, k.y, k.z, 90.0, true, true) SetPedRelationshipGroupHash(i, 'setups') GiveWeaponToPed(i, "weapon_pistol", 1, false, true) @@ -530,6 +529,7 @@ RegisterCommand('DrugRep', function() {icon = "fa-solid fa-syringe", title = 'Heroin: '..rep.heroin}, {icon = "fa-solid fa-vial", title = 'LSD: '..rep.lsd}, {icon = "fa-solid fa-plug", title = 'Dealer: '..rep.dealerrep}, + {icon = "fa-solid fa-money-bill", title = 'Corner Selling: ' .. rep.cornerselling.rep, description = 'Rank: ' .. rep.cornerselling.label } } }) lib.showContext('DrugRep') diff --git a/client/cocaine.lua b/client/cocaine.lua index a45c9f4..fd1d9b7 100644 --- a/client/cocaine.lua +++ b/client/cocaine.lua @@ -27,7 +27,7 @@ end) RegisterNetEvent("coke:init", function() for k, v in pairs (GlobalState.CocaPlant) do local hash = GetHashKey(v.model) - if not HasModelLoaded(hash) then LoadModel(hash) end + LoadModel(hash) if not v.taken then CocaPlant[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(CocaPlant[k], true, v.heading) diff --git a/client/cornerselling.lua b/client/cornerselling.lua index f984d2c..1d6e8f2 100644 --- a/client/cornerselling.lua +++ b/client/cornerselling.lua @@ -44,7 +44,7 @@ function Cornersell() local item, amount, price = lib.callback.await('md-drugs:server:cornerselling:getAvailableDrugs', false) if item == 'nothing' then Notify(Lang.Cornerselling.nodrugs, 'error') sell = false FreezeEntityPosition(targ, false) ClearPedTasks(targ) return false end local options = { - { label = string.format(Lang.Targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", + { label = string.format(Lang.targets.CornerSell.sell, amount, GetLabel(item), price), icon ="fa-solid fa-money-bill", action = function() sellDrug(item, amount, price, targ) end, canInteract = function() if not targbusy then return true end end, diff --git a/client/functions.lua b/client/functions.lua index 49621ac..a7c6da1 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -64,7 +64,10 @@ function loadParticle(dict) end function LoadModel(hash) - lib.requestModel(hash, Config.RequestModelTime) + RequestModel(hash) + while not HasModelLoaded(hash) do + Wait(0) + end end function minigame() @@ -217,7 +220,7 @@ end function sorter(sorting, value) - table.sort(sorting, function(a, b) print(a[value], b[value]) return a[value] < b[value] end) + table.sort(sorting, function(a, b) return a[value] < b[value] end) end function makeMenu(name, rep) @@ -322,15 +325,7 @@ function PoliceCall(chance) flash = 0, unique_id = data.unique_id, sound = 1, - blip = { - sprite = 431, - scale = 1.2, - colour = 3, - flashes = false, - text = '420-69 Drug Sale', - time = 5, - radius = 0, - } + blip = { sprite = 431, scale = 1.2, colour = 3, flashes = false, text = '420-69 Drug Sale', time = 5, radius = 0,} }) elseif dispatch == 'core' then exports['core_dispatch']:addCall("420-69", "Drugs Are Being Sold", { @@ -441,7 +436,6 @@ function AddBoxZoneMulti(name, table, data) end function AddBoxZoneMultiOptions(name, loc, data) - if Config.Target == 'qb' then exports['qb-target']:AddBoxZone(name , loc, 1.5, 1.75, {name = name, minZ = loc.z-1.50,maxZ = loc.z +1.5}, { options = data, distance = 2.5}) @@ -462,18 +456,17 @@ function AddSingleModel(model, data, num) end function AddMultiModel(model, data, num) - local data = {} + local options = {} for k, v in pairs (data) do - table.insert(data,{ - { icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, - onSelect = v.action,data = num,canInteract = v.canInteract or nil, distance = 2.0 - } + table.insert(options,{ + icon = v.icon, label = v.label, event = v.event or nil, action = v.action or nil, + onSelect = v.action,data = num,canInteract = v.canInteract or nil, distance = 2.0 }) end if Config.Target == 'qb' then - exports['qb-target']:AddTargetEntity(model, {options = data, distance = 2.5}) + exports['qb-target']:AddTargetEntity(model, {options = options, distance = 2.5}) elseif Config.Target == 'ox' then - exports.ox_target:addLocalEntity(model, data) + exports.ox_target:addLocalEntity(model, options) end end diff --git a/client/meth.lua b/client/meth.lua index 8e382f6..0e1a274 100644 --- a/client/meth.lua +++ b/client/meth.lua @@ -3,7 +3,6 @@ local amonia = nil local tray = nil local heated = nil local active = nil - local function startcook() if not ItemCheck('empty_weed_bag') then return end if not ItemCheck('acetone') then return end @@ -42,14 +41,14 @@ if tray then SmashMeth() Wait(100) AddSingleModel(bucket, - {name = 'bucket',icon = 'fa-solid fa-car',label = Lang.targets.meth.bag, + {name = 'bucket',icon = 'fa-solid fa-car',label = Lang.targets.meth.bag, canInteract = function() if active == nil then return false end end, action = function() + active = nil DeleteObject(bucket) - amonia = nil - heated = nil - tray = nil - active = nil - BagMeth() + amonia = nil + heated = nil + tray = nil + BagMeth() TriggerServerEvent('md-drugs:server:getmeth') end,}, bucket) end diff --git a/client/shrooms.lua b/client/shrooms.lua index 5aff339..49054ca 100644 --- a/client/shrooms.lua +++ b/client/shrooms.lua @@ -6,6 +6,13 @@ local function pick(loc) TriggerServerEvent("shrooms:pickupCane", loc) end +function LoadModel(hash) + RequestModel(hash) + while not HasModelLoaded(hash) do + Wait(0) + end +end + RegisterNetEvent('shrooms:respawnCane', function(loc) local v = GlobalState.shrooms[loc] local hash = GetHashKey(v.model) @@ -35,7 +42,7 @@ end) RegisterNetEvent("shrooms:init", function() for k, v in pairs (GlobalState.shrooms) do local hash = GetHashKey(v.model) - if not HasModelLoaded(hash) then LoadModel(hash) end + lib.requestModel(v.model, Config.RequestModelTime) if not v.taken then shrooms[k] = CreateObject(hash, v.location.x, v.location.y, v.location.z, false, true, true) Freeze(shrooms[k], true, v.heading) diff --git a/client/weed.lua b/client/weed.lua index 25f63d9..84de243 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -1,13 +1,11 @@ local QBCore = exports['qb-core']:GetCoreObject() local WeedPlant = {} -local exploded = nil -local drying = false - +local exploded, drying = false, false local function hasJob() if Config.Joblock then if QBCore.Functions.GetPlayerData().job.name == Config.weedjob then - return true else return false end + return true else return false end else return true end end @@ -116,14 +114,14 @@ AddBoxZoneSingle('makeoil',Config.MakeOil, { exploded = true Notify(Lang.Weed.stovehot, "error") Wait(1000 * 30) - exploded = nil + exploded = false end return end if not progressbar(Lang.Weed.shat, 4000, 'uncuff') then return end TriggerServerEvent("md-drugs:server:makeoil") end, canInteract = function() - if hasJob() and exploded == nil then return true end + if hasJob() and exploded == false then return true end end, } ) end) diff --git a/client/wholesale.lua b/client/wholesale.lua index f4f42eb..5a6bc2c 100644 --- a/client/wholesale.lua +++ b/client/wholesale.lua @@ -24,15 +24,13 @@ RegisterNetEvent("md-drugs:client:GetLocation", function(drug, notify) icon = "fas fa-eye", action = function() local luck = math.random(1,100) - if luck >=101 then + if luck >= Config.SuccessfulChance then TriggerEvent("md-drugs:client:SuccessSale", drug) - Wait(4000) - DeleteEntity(drugdealer) else TriggerEvent("md-drugs:client:SetUp") - Wait(3000) - DeleteEntity(drugdealer) end + Wait(3000) + DeleteEntity(drugdealer) miss = false end, },nil ) diff --git a/readme.md b/readme.md index 40b1b2f..4f82244 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -