diff --git a/client/functions.lua b/client/functions.lua index 55e380c..252b5a1 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -640,4 +640,9 @@ CreateThread(function() TriggerEvent('Mescaline:init') TriggerEvent('shrooms:init') TriggerEvent('weed:init') +end) + +lib.callback.register('md-drugs:client:uncuff', function() + if not progressbar('Uncuffing', 4000, 'uncuff') then return end + return true end) \ No newline at end of file diff --git a/client/pedspawns.lua b/client/pedspawns.lua index b167c9b..b1a40b8 100644 --- a/client/pedspawns.lua +++ b/client/pedspawns.lua @@ -1,7 +1,7 @@ local QBCore = exports['qb-core']:GetCoreObject() CreateThread(function() local config = lib.callback.await('md-drugs:server:getLocs', false) - local model = {"g_m_y_famdnf_01", 's_m_m_doctor_01', 'u_m_m_jesus_01'} + local model = {"g_m_y_famdnf_01", 's_m_m_doctor_01', 'u_m_m_jesus_01', "prop_cooker_03"} for k, v in pairs (model) do lib.requestModel(v, Config.RequestModelTime) end @@ -20,4 +20,5 @@ CreateThread(function() AddSingleModel(SyrupLocation, { type = "client", label = Lang.targets.lean.git, icon = "fa-solid fa-circle-info", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil ) AddSingleModel(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil) AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fas fa-eye", action = function() Notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil ) + end) \ No newline at end of file diff --git a/client/pharma.lua b/client/pharma.lua index 4a6ca40..1970137 100644 --- a/client/pharma.lua +++ b/client/pharma.lua @@ -1,15 +1,10 @@ local QBCore = exports['qb-core']:GetCoreObject() -lib.callback.register("md-drugs:client:prescriptionpad", function(data) +lib.callback.register("md-drugs:client:prescriptionpad", function(data, op) if not QBCore.Functions.GetPlayerData().job.type == 'ems' then return end local input = lib.inputDialog('Who To Give A Prescription To?',{ {type = 'select', label = 'Player Name', options = data}, - {type = 'select', label = 'Prescription', options = { - {label = 'Vicodin', value = 'vicodin_prescription'}, - {label = 'Adderal', value = 'adderal_prescription'}, - {label = 'Morphine', value = 'morphine_prescription'}, - {label = 'Xanax', value = 'xanax_prescription'} - }}}) + {type = 'select', label = 'Prescription', options = op}}) if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end return {who = input[1], what = input[2]} end) @@ -19,11 +14,7 @@ RegisterNetEvent("md-drugs:client:fillprescription", function(data) TriggerServerEvent("md-drugs:server:fillprescription", data.data) end) -RegisterNetEvent("md-drugs:client:unbottle", function(item) +lib.callback.register("md-drugs:client:unbottle", function() if not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end - if item.name == 'vicodinbottle' then item = 'vicodin' end - if item.name == 'adderalbottle' then item = 'adderal' end - if item.name == 'morphinebottle' then item = 'morphine' end - if item.name == 'xanaxbottle' then item = 'xanax' end - TriggerServerEvent('md-drugs:server:unbottle', item) + return true end) diff --git a/client/weed.lua b/client/weed.lua index 1199399..eb5a0a8 100644 --- a/client/weed.lua +++ b/client/weed.lua @@ -125,6 +125,12 @@ AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, { if hasJob() and exploded == false then return true end end, } ) + local stove = CreateObject("prop_cooker_03",config.singleSpot.MakeButter.x, config.singleSpot.MakeButter.y, config.singleSpot.MakeButter.z-1, true, false) + SetEntityHeading(stove, 270.00) + FreezeEntityPosition(stove, true) + local stove2 = CreateObject("prop_cooker_03",config.singleSpot.MakeOil.x,config.singleSpot.MakeOil.y, config.singleSpot.MakeOil.z-1, true, false) + SetEntityHeading(stove2, 90.00) + FreezeEntityPosition(stove2, true) end) CreateThread(function() @@ -137,12 +143,6 @@ CreateThread(function() 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) - FreezeEntityPosition(stove, true) - local stove2 = CreateObject("prop_cooker_03",vector3(1038.90, -3198.66, -38.17-1), true, false) - SetEntityHeading(stove2, 90.00) - FreezeEntityPosition(stove2, true) end) @@ -155,7 +155,7 @@ RegisterNetEvent("md-drugs:client:grind", function() end) RegisterNetEvent("md-drugs:client:dodabs", function() -if not progressbar('Doing Dabs', 4000, 'bong2') then return end +if not progressbar('Doing Dabs', 4000, 'bong2') then AlienEffect() return end AlienEffect() end) @@ -207,4 +207,4 @@ end) RegisterNetEvent('md-drugs:client:rollBlunt', function(data) lib.showContext('mddrugsblunts') -end) +end) \ No newline at end of file diff --git a/server/locations.lua b/server/locations.lua index ae74aa5..198e33e 100644 --- a/server/locations.lua +++ b/server/locations.lua @@ -50,7 +50,7 @@ local Target = { {loc = vector3(844.71, -900.56, 25.43), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, FillPrescription = { -- where to fill out your prescription - {loc = vector3(2432.89, 4252.2, 36.35), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, + {loc = vector3(2855.62, 4446.73, 48.53), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, }, singleSpot = { cutcoke = vector3(1093.17, -3195.74, -39.19), diff --git a/server/pharma.lua b/server/pharma.lua index 423ec0f..1f29033 100644 --- a/server/pharma.lua +++ b/server/pharma.lua @@ -13,64 +13,64 @@ end QBCore.Functions.CreateUseableItem('prescription_pad', function(source, item) local src = source local near = {} - if GetJob(src) then for k, v in pairs (QBCore.Functions.GetQBPlayers()) do local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid) local tname = GetName(v.PlayerData.source) - table.insert(near, {label = tname, value = targ.PlayerData.citizenid}) + local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source) + local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped)) + if dist < 5.0 then + table.insert(near, {label = tname, value = targ.PlayerData.citizenid}) + end end - local data = lib.callback.await('md-drugs:client:prescriptionpad', src, near) + local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}} + local data = lib.callback.await('md-drugs:client:prescriptionpad', src, near, options) if type(data) == 'table' then local give = QBCore.Functions.GetPlayerByCitizenId(data.who) - AddItem(give.PlayerData.source, data.what, 1) + for i = 1, #options do + if data.what == options[i].value then + AddItem(give.PlayerData.source, data.what, 1) + end + end end - end -end) - -RegisterServerEvent('md-drugs:server:unbottle', function(item) - local src = source - local amount = math.random(10,30) - AddItem(src, item, amount) - Log(GetName(src) .. ' Unbottled '.. amount .. ' Of ' .. item .. '!', 'pharma') + end end) local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'} for m, d in pairs (pharmabottle) do QBCore.Functions.CreateUseableItem(d, function(source, item) local src = source - if RemoveItem(src, d, 1) then - TriggerClientEvent("md-drugs:client:unbottle", src, item) - end + local Player = getPlayer(src) + local check = lib.callback.await("md-drugs:client:unbottle", src) + if check then + local get = { + ['vicodinbottle'] = 'vicodin', + ['adderalbottle'] = 'adderal', + ['morphinebottle'] = 'morphine', + ['xanaxbottle'] = 'xanax' + } + for k, v in pairs (get) do + if d == k then + RemoveItem(src, d, 1) + AddItem(src, v, math.random(10,30)) + Notifys(src,Lang.Pharma.unbottle, "success") + Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma') + end + end + end end) end - RegisterServerEvent('md-drugs:server:fillprescription', function() local src = source local Player = getPlayer(src) - local vic = Player.Functions.GetItemByName('vicodin_prescription') - local add = Player.Functions.GetItemByName('adderal_prescription') - local mor = Player.Functions.GetItemByName('morphine_prescription') - local xan = Player.Functions.GetItemByName('xanax_prescription') - if vic then - RemoveItem(src,'vicodin_prescription', 1 ) - AddItem(src,'vicodinbottle', 1) - Notifys(src,Lang.Pharma.pills, "success") - elseif add then - RemoveItem(src,'adderal_prescription', 1 ) - AddItem(src,'adderalbottle', 1) - Notifys(src,Lang.Pharma.pills, "success") - elseif mor then - RemoveItem(src,'morphine_prescription', 1 ) - AddItem(src,'morphinebottle', 1) - Notifys(src,Lang.Pharma.pills, "success") - elseif xan then - RemoveItem(src,'xanax_prescription', 1 ) - AddItem(src,'xanaxbottle', 1) - Notifys(src,Lang.Pharma.pills, "success") - else - Notifys(src,Lang.Pharma.no, "error") + local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'} + for k, v in pairs (pres) do + if Player.Functions.GetItemByName(k) then + RemoveItem(src, k, 1 ) + AddItem(src,v, 1) + break + end end Log(GetName(src) .. ' Filled A Prescription!', 'pharma') end) diff --git a/server/weed.lua b/server/weed.lua index 7958cb3..9327ff1 100644 --- a/server/weed.lua +++ b/server/weed.lua @@ -115,7 +115,6 @@ local Player = getPlayer(src) if Player.Functions.GetItemByName("butanetorch") then if RemoveItem(src, "shatter", 1) then - Notifys(src, 'test', 'success') TriggerClientEvent("md-drugs:client:dodabs", src) end end @@ -123,9 +122,10 @@ end) QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item) local src = source + local check = lib.callback.await('md-drugs:client:uncuff', src) + if not check then return end if RemoveItem(src, "drycannabis",1 ) then AddItem(src, "grindedweed", 1) - TriggerClientEvent("md-drugs:client:grind", src) else Notifys(src,'You Need Dried Weed', 'error') end @@ -134,12 +134,10 @@ end) QBCore.Functions.CreateUseableItem("mdwoods", function(source, item) local src = source local Player = getPlayer(src) - TriggerClientEvent("md-drugs:client:rollanim", src) - Wait(4000) + local check = lib.callback.await('md-drugs:client:uncuff', src) + if not check then return end if RemoveItem(src, "mdwoods",1 ) then AddItem(src, "bluntwrap", 5) AddItem(src, "tobacco", 5) end -end) - - +end) \ No newline at end of file