Files
md-drugs/client/heroin.lua
T

157 lines
5.9 KiB
Lua
Raw Normal View History

2025-07-15 02:21:34 -07:00
local herointable = false
2024-12-16 03:22:44 -08:00
local dirty = false
2025-08-06 02:25:06 -06:00
local locations = ps.callback('md-drugs:server:GetHeroinLocations')
2025-08-09 23:58:38 -06:00
2024-12-16 03:22:44 -08:00
local function createLabKit(coord, head)
local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false)
SetEntityHeading(heroinlabkit, head)
PlaceObjectOnGroundProperly(heroinlabkit)
2025-07-14 01:34:58 -07:00
ps.entityTarget(heroinlabkit, {
{
icon = "fa-solid fa-temperature-high",
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetCook'),
2025-07-14 01:34:58 -07:00
action = function()
2025-08-09 23:58:38 -06:00
if not ps.hasItem('emptyvial') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('emptyvial')), 'error')
return
end
2025-07-14 01:34:58 -07:00
if not minigame() then
dirty = true
TriggerServerEvent("md-drugs:server:failheatingheroin")
ps.requestPTFX("core")
local heroinkit = StartParticleFxLoopedOnEntity("exp_air_molotov", heroinlabkit, 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)
return end
2025-08-09 23:58:38 -06:00
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbCook'), 4000, 'uncuff') then return end
2025-07-14 01:34:58 -07:00
TriggerServerEvent("md-drugs:server:heatliquidheroin")
end,
canInteract = function()
2025-07-15 02:21:34 -07:00
if not dirty then return true end
end
2025-07-14 01:34:58 -07:00
},
{
icon = "fas fa-box-circle-check",
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetPickup'),
2025-07-14 01:34:58 -07:00
action = function()
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbPickup'), 4000, 'uncuff') then return end
2025-07-14 01:34:58 -07:00
herointable = false
DeleteObject(heroinlabkit)
TriggerServerEvent("md-drugs:server:getheroinlabkitback")
end,
canInteract = function()
if not dirty then return true end
return false
end
},
{
icon = "fa-solid fa-hand-sparkles",
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetClean'),
2025-07-14 01:34:58 -07:00
action = function()
2025-08-09 23:58:38 -06:00
if not ps.hasItem('cleaningkit') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('cleaningkit')), 'error')
return
end
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbClean'), 4000, 'clean') then return end
2025-07-14 01:34:58 -07:00
local done = ps.callback('removeCleaningkit', false)
if done then dirty = false end
end,
canInteract = function()
if dirty then return true end
return false
end
}})
end
2024-10-24 20:00:27 -07:00
2025-08-06 02:25:06 -06:00
for k, v in pairs (locations.dryplant) do
2025-07-14 01:34:58 -07:00
ps.boxTarget('dryHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
{
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetDry'),
2025-07-14 01:34:58 -07:00
icon = 'fa-solid fa-temperature-high',
action = function()
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbDry'), 4000, 'uncuff') then return end
2025-07-14 01:34:58 -07:00
TriggerServerEvent("md-drugs:server:dryplant", k)
end,
canInteract = function()
return handleGang(v.gang)
end
}
})
end
2024-01-13 22:23:17 -08:00
2025-08-06 02:25:06 -06:00
for k, v in pairs (locations.cutheroinone) do
2025-07-14 01:34:58 -07:00
ps.boxTarget('cutHeroin'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
{
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetCutHeroin'),
2025-07-14 01:34:58 -07:00
icon = 'fa-solid fa-seedling',
action = function()
2025-09-11 21:44:26 -06:00
if not ps.hasItem('bakingsoda') then
ps.notify(ps.lang('Catches.itemMissings', ps.getLabel('bakingsoda')), 'error')
return
end
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbCutHeroin'), 4000, 'uncuff') then return end
2025-07-14 01:34:58 -07:00
TriggerServerEvent("md-drugs:server:cutheroin", k)
end,
canInteract = function()
return handleGang(v.gang)
end
}
})
end
2025-08-06 02:25:06 -06:00
local peds = {}
for k, v in pairs (locations.buyKit) do
ps.requestModel(v.ped, 1000)
peds[k] = CreatePed(4, v.ped, v.loc.x, v.loc.y, v.loc.z, v.loc.w, false, false)
Freeze(peds[k], true, v.loc.w)
SetBlockingOfNonTemporaryEvents(peds[k], true)
SetEntityInvincible(peds[k], true)
ps.entityTarget(peds[k], {
{
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetBuyKit'),
2025-08-06 02:25:06 -06:00
icon = 'fa-solid fa-box-open',
action = function()
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbBuyKit'), 4000, 'uncuff') then return end
2025-08-06 02:25:06 -06:00
TriggerServerEvent("md-drugs:server:getheroinlabkit", k)
end,
canInteract = function()
2025-08-09 03:10:00 -06:00
if not handleGang(v.gang) then return false end
return true
end
2025-08-06 02:25:06 -06:00
}
})
end
2024-01-13 22:23:17 -08:00
2025-07-01 03:09:46 -07:00
ps.registerCallback("md-drugs:client:setheroinlabkit", function()
2025-07-14 01:34:58 -07:00
if herointable then
2025-08-09 03:10:00 -06:00
ps.notify(ps.lang('heroin.tableout'), 'error')
2024-11-22 12:26:27 -08:00
return false
else
herointable = true
local location, head = StartRay()
2024-11-22 12:26:27 -08:00
if not location then herointable = false return end
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.placing'), 4000, 'uncuff') then return end
createLabKit(location, head)
2024-11-22 12:26:27 -08:00
return true, location
end
2024-01-13 22:23:17 -08:00
end)
2025-08-06 02:25:06 -06:00
for k, v in pairs (locations.fillneedle) do
2025-07-14 01:34:58 -07:00
ps.boxTarget('fillNeedle'..k, v.loc, {length = v.l, width = v.w, height = 1.0, rotation = v.rot}, {
{
2025-08-09 03:10:00 -06:00
label = ps.lang('heroin.targetFill'),
2025-07-14 01:34:58 -07:00
icon = 'fa-solid fa-syringe',
action = function()
if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end
2025-08-09 03:10:00 -06:00
if not ps.progressbar(ps.lang('heroin.pbFill'), 4000, 'uncuff') then return end
2025-07-14 01:34:58 -07:00
TriggerServerEvent("md-drugs:server:fillneedle", k)
end,
canInteract = function()
return handleGang(v.gang)
end
}
})
end