2025-07-15 02:21:34 -07:00
|
|
|
|
2024-03-17 20:05:09 -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')
|
2024-12-16 03:22:44 -08:00
|
|
|
local function createLabKit(coord, head)
|
2024-10-25 11:41:59 -07:00
|
|
|
local heroinlabkit = CreateObject("v_ret_ml_tablea", coord.x, coord.y, coord.z - 1, true, false,false)
|
2024-10-25 01:55:35 -07:00
|
|
|
SetEntityHeading(heroinlabkit, head)
|
|
|
|
|
PlaceObjectOnGroundProperly(heroinlabkit)
|
2025-07-14 01:34:58 -07:00
|
|
|
ps.entityTarget(heroinlabkit, {
|
|
|
|
|
{
|
|
|
|
|
icon = "fa-solid fa-temperature-high",
|
|
|
|
|
label = ps.lang('Heroin.cook'),
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.hasItem('emptyvial') then return end
|
|
|
|
|
if not minigame() then
|
|
|
|
|
dirty = true
|
|
|
|
|
TriggerServerEvent("md-drugs:server:failheatingheroin")
|
|
|
|
|
ps.requestPTFX("core")
|
2025-07-15 02:21:34 -07:00
|
|
|
lib.requestNamedPtfxAsset("core")
|
2025-07-14 01:34:58 -07:00
|
|
|
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
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.success'), 4000, 'uncuff') then return end
|
|
|
|
|
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",
|
|
|
|
|
label = ps.lang('Heroin.up'),
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.pickup'), 4000, 'uncuff') then return end
|
|
|
|
|
herointable = false
|
|
|
|
|
DeleteObject(heroinlabkit)
|
|
|
|
|
TriggerServerEvent("md-drugs:server:getheroinlabkitback")
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
if not dirty then return true end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
event = "md-drugs:client:cleanheroinlabkit",
|
|
|
|
|
icon = "fa-solid fa-hand-sparkles",
|
|
|
|
|
label = ps.lang('Heroin.clean'),
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.hasItem('cleaningkit') then return end
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.clean'), 4000, 'clean') then return end
|
|
|
|
|
local done = ps.callback('removeCleaningkit', false)
|
|
|
|
|
if done then dirty = false end
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
if dirty then return true end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
}})
|
2024-10-25 01:55:35 -07:00
|
|
|
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}, {
|
|
|
|
|
{
|
|
|
|
|
label = ps.lang('targets.heroin.dry'),
|
|
|
|
|
icon = 'fa-solid fa-temperature-high',
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.dryout'), 4000, 'uncuff') then return end
|
|
|
|
|
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}, {
|
|
|
|
|
{
|
|
|
|
|
label = ps.lang('targets.heroin.cut'),
|
|
|
|
|
icon = 'fa-solid fa-seedling',
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.hasItem('bakingsoda') then return end
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.cutting'), 4000, 'uncuff') then return end
|
|
|
|
|
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], {
|
|
|
|
|
{
|
|
|
|
|
label = ps.lang('targets.heroin.buykit'),
|
|
|
|
|
icon = 'fa-solid fa-box-open',
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.secret'), 4000, 'uncuff') then return end
|
|
|
|
|
TriggerServerEvent("md-drugs:server:getheroinlabkit", k)
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
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
|
|
|
|
|
ps.notify(ps.lang('Heroin.tableout'), 'error')
|
2024-11-22 12:26:27 -08:00
|
|
|
return false
|
2024-10-25 01:55:35 -07:00
|
|
|
else
|
|
|
|
|
herointable = true
|
|
|
|
|
local location, head = StartRay()
|
2024-11-22 12:26:27 -08:00
|
|
|
if not location then herointable = false return end
|
2025-07-14 01:34:58 -07:00
|
|
|
if not ps.progressbar(ps.lang('Heroin.table'), 4000, 'uncuff') then return end
|
2024-10-25 01:55:35 -07:00
|
|
|
createLabKit(location, head)
|
2024-11-22 12:26:27 -08:00
|
|
|
return true, location
|
2024-10-25 01:55:35 -07:00
|
|
|
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}, {
|
|
|
|
|
{
|
|
|
|
|
label = ps.lang('targets.heroin.fill'),
|
|
|
|
|
icon = 'fa-solid fa-syringe',
|
|
|
|
|
action = function()
|
|
|
|
|
if not minigame() then TriggerServerEvent("md-drugs:server:failheroin", k) return end
|
|
|
|
|
if not ps.progressbar(ps.lang('Heroin.needles'), 4000, 'uncuff') then return end
|
|
|
|
|
TriggerServerEvent("md-drugs:server:fillneedle", k)
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
return handleGang(v.gang)
|
|
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
end
|