patch for pharma, new callback to do animations and progressbar checks

This commit is contained in:
Mustache Dom committed 2024-11-23 14:38:23 -08:00
1 parent f1ed2c0860
commit cf5cfba909
7 files changed
+59 -64

No files matched your search

+5
View File
@@ -641,3 +641,8 @@ CreateThread(function()
TriggerEvent('shrooms:init') TriggerEvent('shrooms:init')
TriggerEvent('weed:init') TriggerEvent('weed:init')
end) end)
lib.callback.register('md-drugs:client:uncuff', function()
if not progressbar('Uncuffing', 4000, 'uncuff') then return end
return true
end)
+2 -1
View File
@@ -1,7 +1,7 @@
local QBCore = exports['qb-core']:GetCoreObject() local QBCore = exports['qb-core']:GetCoreObject()
CreateThread(function() CreateThread(function()
local config = lib.callback.await('md-drugs:server:getLocs', false) 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 for k, v in pairs (model) do
lib.requestModel(v, Config.RequestModelTime) lib.requestModel(v, Config.RequestModelTime)
end 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(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(WeedGuy, {label = "Weed Shop",icon = "fas fa-eye", action = function() makeMenu('WeedShop') lib.showContext('WeedShop')end}, nil)
AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fas fa-eye", action = function() Notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil ) AddSingleModel(methdealer,{label = Lang.targets.meth.mission, icon = "fas fa-eye", action = function() Notify(Lang.meth.mission, "success") SpawnMethCarPedChase() end,},nil )
end) end)
+4 -13
View File
@@ -1,15 +1,10 @@
local QBCore = exports['qb-core']:GetCoreObject() 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 if not QBCore.Functions.GetPlayerData().job.type == 'ems' then return end
local input = lib.inputDialog('Who To Give A Prescription To?',{ local input = lib.inputDialog('Who To Give A Prescription To?',{
{type = 'select', label = 'Player Name', options = data}, {type = 'select', label = 'Player Name', options = data},
{type = 'select', label = 'Prescription', options = { {type = 'select', label = 'Prescription', options = op}})
{label = 'Vicodin', value = 'vicodin_prescription'},
{label = 'Adderal', value = 'adderal_prescription'},
{label = 'Morphine', value = 'morphine_prescription'},
{label = 'Xanax', value = 'xanax_prescription'}
}}})
if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end if not progressbar(Lang.Pharma.write, 4000, 'notepad') then return end
return {who = input[1], what = input[2]} return {who = input[1], what = input[2]}
end) end)
@@ -19,11 +14,7 @@ RegisterNetEvent("md-drugs:client:fillprescription", function(data)
TriggerServerEvent("md-drugs:server:fillprescription", data.data) TriggerServerEvent("md-drugs:server:fillprescription", data.data)
end) 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 not progressbar(Lang.Pharma.open, 4000, 'uncuff') then return end
if item.name == 'vicodinbottle' then item = 'vicodin' end return true
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)
end) end)
+7 -7
View File
@@ -125,6 +125,12 @@ AddBoxZoneSingle('makeoil',config.singleSpot.MakeOil, {
if hasJob() and exploded == false then return true end if hasJob() and exploded == false then return true end
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) end)
CreateThread(function() CreateThread(function()
@@ -137,12 +143,6 @@ CreateThread(function()
BikerWeedFarm.Plant4.Clear(false) BikerWeedFarm.Plant5.Clear(false) BikerWeedFarm.Plant6.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.Plant7.Clear(false) BikerWeedFarm.Plant8.Clear(false) BikerWeedFarm.Plant9.Clear(false)
RefreshInterior(BikerWeedFarm.interiorId) 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) end)
@@ -155,7 +155,7 @@ RegisterNetEvent("md-drugs:client:grind", function()
end) end)
RegisterNetEvent("md-drugs:client:dodabs", function() 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() AlienEffect()
end) end)
+1 -1
View File
@@ -50,7 +50,7 @@ local Target = {
{loc = vector3(844.71, -900.56, 25.43), l = 1.0, w = 1.0, rot = 45.0, gang = ""}, {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 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 = { singleSpot = {
cutcoke = vector3(1093.17, -3195.74, -39.19), cutcoke = vector3(1093.17, -3195.74, -39.19),
+36 -36
View File
@@ -13,64 +13,64 @@ end
QBCore.Functions.CreateUseableItem('prescription_pad', function(source, item) QBCore.Functions.CreateUseableItem('prescription_pad', function(source, item)
local src = source local src = source
local near = {} local near = {}
if GetJob(src) then if GetJob(src) then
for k, v in pairs (QBCore.Functions.GetQBPlayers()) do for k, v in pairs (QBCore.Functions.GetQBPlayers()) do
local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid) local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid)
local tname = GetName(v.PlayerData.source) 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 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 if type(data) == 'table' then
local give = QBCore.Functions.GetPlayerByCitizenId(data.who) 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 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)
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'} local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
for m, d in pairs (pharmabottle) do for m, d in pairs (pharmabottle) do
QBCore.Functions.CreateUseableItem(d, function(source, item) QBCore.Functions.CreateUseableItem(d, function(source, item)
local src = source local src = source
if RemoveItem(src, d, 1) then local Player = getPlayer(src)
TriggerClientEvent("md-drugs:client:unbottle", src, item) 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) end)
end end
RegisterServerEvent('md-drugs:server:fillprescription', function() RegisterServerEvent('md-drugs:server:fillprescription', function()
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
local vic = Player.Functions.GetItemByName('vicodin_prescription') local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'}
local add = Player.Functions.GetItemByName('adderal_prescription') for k, v in pairs (pres) do
local mor = Player.Functions.GetItemByName('morphine_prescription') if Player.Functions.GetItemByName(k) then
local xan = Player.Functions.GetItemByName('xanax_prescription') RemoveItem(src, k, 1 )
if vic then AddItem(src,v, 1)
RemoveItem(src,'vicodin_prescription', 1 ) break
AddItem(src,'vicodinbottle', 1) end
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")
end end
Log(GetName(src) .. ' Filled A Prescription!', 'pharma') Log(GetName(src) .. ' Filled A Prescription!', 'pharma')
end) end)
+4 -6
View File
@@ -115,7 +115,6 @@ local Player = getPlayer(src)
if Player.Functions.GetItemByName("butanetorch") then if Player.Functions.GetItemByName("butanetorch") then
if RemoveItem(src, "shatter", 1) then if RemoveItem(src, "shatter", 1) then
Notifys(src, 'test', 'success')
TriggerClientEvent("md-drugs:client:dodabs", src) TriggerClientEvent("md-drugs:client:dodabs", src)
end end
end end
@@ -123,9 +122,10 @@ end)
QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item) QBCore.Functions.CreateUseableItem("weedgrinder", function(source, item)
local src = source 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 if RemoveItem(src, "drycannabis",1 ) then
AddItem(src, "grindedweed", 1) AddItem(src, "grindedweed", 1)
TriggerClientEvent("md-drugs:client:grind", src)
else else
Notifys(src,'You Need Dried Weed', 'error') Notifys(src,'You Need Dried Weed', 'error')
end end
@@ -134,12 +134,10 @@ end)
QBCore.Functions.CreateUseableItem("mdwoods", function(source, item) QBCore.Functions.CreateUseableItem("mdwoods", function(source, item)
local src = source local src = source
local Player = getPlayer(src) local Player = getPlayer(src)
TriggerClientEvent("md-drugs:client:rollanim", src) local check = lib.callback.await('md-drugs:client:uncuff', src)
Wait(4000) if not check then return end
if RemoveItem(src, "mdwoods",1 ) then if RemoveItem(src, "mdwoods",1 ) then
AddItem(src, "bluntwrap", 5) AddItem(src, "bluntwrap", 5)
AddItem(src, "tobacco", 5) AddItem(src, "tobacco", 5)
end end
end) end)