Files
md-drugs/client/lean.lua
T

52 lines
1.8 KiB
Lua
Raw Normal View History

2024-01-13 22:23:17 -08:00
local QBCore = exports['qb-core']:GetCoreObject()
CreateThread(function()
local current = "s_m_m_doctor_01"
2024-05-02 18:34:14 -07:00
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)
2024-07-11 17:39:58 -07:00
Freeze(SyrupLocation, true, Config.SyrupVendor.w)
2024-10-23 17:44:46 -07:00
AddSingleModel(SyrupLocation, { type = "client", label = Lang.targets.lean.git, icon = "fas fa-eye", event = "md-drugs:client:getsyruplocationtobuy", distance = 2.0}, nil )
2024-01-13 22:23:17 -08:00
end)
2024-05-02 18:34:14 -07:00
RegisterNetEvent("md-drugs:client:getsyruplocationtobuy", function()
Notify(Lang.Lean.marked, "success")
SpawnCarPedChase()
2024-07-11 17:42:05 -07:00
end)
RegisterNetEvent('md-drugs:client:leancraft', function()
local store = {}
local label = {}
local items = lib.callback.await('md-drugs:server:GetRecipe', false,'lean', 'cups')
for k, v in pairs (items) do
label = {}
local item = ''
2024-10-23 17:44:46 -07:00
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, ", "),
title = GetLabel(item),
event = 'md-drugs:client:stirlean',
args = {
item = item,
2024-10-23 17:44:46 -07:00
recipe = 'lean',
num = k,
label = 'Cooking Up ' .. GetLabel(item),
2024-10-23 17:44:46 -07:00
table = 'cups'
}
}
lib.registerContext({id = 'leanCraft',title = "Make Lean", options = store})
end
2024-10-23 17:44:46 -07:00
sorter(store, 'title')
lib.showContext('leanCraft')
end)
2024-10-23 17:44:46 -07:00
local busy = false
RegisterNetEvent('md-drugs:client:stirlean', function(data)
2024-10-23 17:44:46 -07:00
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)