2024-03-17 20:05:09 -07:00
|
|
|
local xtcpress = false
|
2025-08-06 02:25:06 -06:00
|
|
|
local locations = ps.callback('md-drugs:server:GetXtcLocs')
|
2024-01-13 22:23:17 -08:00
|
|
|
|
2025-08-06 02:25:06 -06:00
|
|
|
local function getRecipeList(tbl)
|
|
|
|
|
local rec = {}
|
|
|
|
|
for m, d in pairs(tbl) do table.insert(rec, ps.getLabel(m) .. ' X ' .. d) end
|
|
|
|
|
return table.concat(rec, ', ')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ps.registerCallback('md-drugs:client:setpress', function(xtcData)
|
|
|
|
|
if xtcpress then
|
2025-08-09 03:10:00 -06:00
|
|
|
ps.notify(ps.lang('xtc.alreadyOut'), 'error')
|
2025-08-06 02:25:06 -06:00
|
|
|
return
|
2024-05-02 18:34:14 -07:00
|
|
|
end
|
2024-11-25 19:57:26 -08:00
|
|
|
local coords, head = StartRay2()
|
|
|
|
|
xtcpress = true
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.settingDown'), 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
local press = CreateObject("bkr_prop_coke_press_01aa", coords.x, coords.y, coords.z, true, false, false)
|
|
|
|
|
PlaceObjectOnGroundProperly(press)
|
2024-11-25 19:57:26 -08:00
|
|
|
Freeze(press, true, head)
|
2025-08-06 02:25:06 -06:00
|
|
|
local options = {
|
|
|
|
|
{
|
|
|
|
|
icon = "fas fa-eye",
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetMake'),
|
2025-08-06 02:25:06 -06:00
|
|
|
distance = 2.0,
|
|
|
|
|
action = function()
|
|
|
|
|
local options = {}
|
|
|
|
|
for k, v in pairs(xtcData.recipes) do
|
|
|
|
|
local descript = getRecipeList(v.take)
|
|
|
|
|
options[#options + 1] = {
|
|
|
|
|
icon = ps.getImage(k),
|
|
|
|
|
title = ps.getLabel(k),
|
|
|
|
|
description = descript,
|
|
|
|
|
action = function()
|
|
|
|
|
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.making', ps.getLabel(k)), 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
TriggerServerEvent("md-drugs:server:makextc", k)
|
|
|
|
|
end,
|
|
|
|
|
distance = 2.0
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
ps.menu('XTC Recipes', 'XTC Recipes', options)
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
if xtcpress then return true end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
icon = "fas fa-eye",
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetPickup'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.picking'), 5000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
DeleteObject(press)
|
|
|
|
|
xtcpress = false
|
|
|
|
|
TriggerServerEvent("md-drugs:server:getpressback")
|
|
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
if xtcpress then return true end
|
|
|
|
|
end
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
ps.entityTarget(press, options)
|
|
|
|
|
return true
|
2024-11-22 01:35:25 -08:00
|
|
|
end)
|
|
|
|
|
|
2025-08-06 02:25:06 -06:00
|
|
|
for k, v in pairs(locations.mdp2p) do
|
|
|
|
|
ps.boxTarget('mdp2p'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
|
|
|
|
{
|
|
|
|
|
icon = 'fa-solid fa-flask',
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetStealMDP2P'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.stealingMDP2P'), 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
TriggerServerEvent("md-drugs:server:stealmdp2p", k)
|
2025-08-09 03:10:00 -06:00
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
return handleGang(v.gang)
|
2025-08-06 02:25:06 -06:00
|
|
|
end
|
2024-05-02 18:34:14 -07:00
|
|
|
}
|
2025-08-06 02:25:06 -06:00
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
for k, v in pairs(locations.isosafrole) do
|
|
|
|
|
ps.boxTarget('isosafrole'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
|
|
|
|
{
|
|
|
|
|
icon = 'fa-solid fa-flask',
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetStealIsosafrole'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.stealingIsosafrole'), 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
TriggerServerEvent("md-drugs:server:stealisosafrole", k)
|
2025-08-09 03:10:00 -06:00
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
return handleGang(v.gang)
|
2025-08-06 02:25:06 -06:00
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
end
|
2024-01-13 22:23:17 -08:00
|
|
|
|
2025-08-06 02:25:06 -06:00
|
|
|
for k, v in pairs(locations.rawxtcloc) do
|
2025-08-11 16:49:24 -06:00
|
|
|
ps.boxTarget('xtcraw'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
2025-08-06 02:25:06 -06:00
|
|
|
{
|
|
|
|
|
icon = 'fa-solid fa-flask',
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetRaw'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.makingRaw'), 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
TriggerServerEvent("md-drugs:server:makingrawxtc", k)
|
2025-08-09 03:10:00 -06:00
|
|
|
end,
|
|
|
|
|
canInteract = function()
|
|
|
|
|
return handleGang(v.gang)
|
2025-08-06 02:25:06 -06:00
|
|
|
end
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
end
|
2024-01-13 22:23:17 -08:00
|
|
|
|
2025-08-06 02:25:06 -06:00
|
|
|
for k, v in pairs(locations.xtcpress) do
|
|
|
|
|
ps.requestModel(v.ped)
|
|
|
|
|
local ped = CreatePed(0, v.ped, v.loc, false, false)
|
|
|
|
|
Freeze(ped, true, v.loc.w)
|
|
|
|
|
ps.entityTarget(ped, {
|
|
|
|
|
{
|
|
|
|
|
icon = 'fa-solid fa-flask',
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.getPress'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
local options = {}
|
|
|
|
|
local recipeList = ps.callback('md-drugs:server:getpressrecipes')
|
|
|
|
|
for m, d in pairs(recipeList) do
|
|
|
|
|
if m == 'singlepress' then
|
|
|
|
|
options[#options + 1] = {
|
|
|
|
|
icon = ps.getImage(m),
|
|
|
|
|
title = ps.getLabel(m),
|
2025-08-09 03:10:00 -06:00
|
|
|
description = ps.lang('xtc.buySingle', d.cash),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end
|
|
|
|
|
TriggerServerEvent('md-drugs:server:buypress', m)
|
|
|
|
|
end,
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
local descript = getRecipeList(d.take)
|
|
|
|
|
options[#options + 1] = {
|
|
|
|
|
icon = ps.getImage(m),
|
|
|
|
|
title = ps.getLabel(m),
|
|
|
|
|
description = descript,
|
|
|
|
|
action = function()
|
|
|
|
|
if not ps.progressbar(ps.lang('xtc.buyp'), 4000, 'uncuff') then return end
|
|
|
|
|
TriggerServerEvent("md-drugs:server:upgradepress", k, m)
|
|
|
|
|
end,
|
|
|
|
|
distance = 2.0
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
ps.menu('XTC Presses', 'XTC Presses', options)
|
2025-08-09 03:10:00 -06:00
|
|
|
end,
|
|
|
|
|
canInteract = function() return handleGang(v.gang) end
|
2025-08-06 02:25:06 -06:00
|
|
|
}
|
2024-01-13 22:23:17 -08:00
|
|
|
})
|
2025-08-06 02:25:06 -06:00
|
|
|
end
|
2024-01-13 22:23:17 -08:00
|
|
|
|
2025-08-06 02:25:06 -06:00
|
|
|
for k, v in pairs (locations.stamp) do
|
2025-08-11 16:49:24 -06:00
|
|
|
ps.boxTarget('xtcstamp'..k, v.loc, {length = v.l, width = v.w, heading = v.rot}, {
|
2025-08-06 02:25:06 -06:00
|
|
|
{
|
|
|
|
|
icon = 'fa-solid fa-flask',
|
2025-08-09 03:10:00 -06:00
|
|
|
label = ps.lang('xtc.targetStamp'),
|
2025-08-06 02:25:06 -06:00
|
|
|
action = function()
|
|
|
|
|
local item = {
|
|
|
|
|
{item = 'white_xtc', label = ps.getLabel('white_xtc'), color = 'white'},
|
|
|
|
|
{item = 'red_xtc', label = ps.getLabel('red_xtc'), color = 'red'},
|
|
|
|
|
{item = 'orange_xtc', label = ps.getLabel('orange_xtc'), color = 'orange'},
|
|
|
|
|
{item = 'blue_xtc', label = ps.getLabel('blue_xtc'), color = 'blue'},
|
|
|
|
|
}
|
|
|
|
|
local options = {}
|
|
|
|
|
for m, d in pairs (item) do
|
|
|
|
|
options[#options + 1] = {
|
|
|
|
|
icon = ps.getImage(d.item),
|
|
|
|
|
title = d.label,
|
|
|
|
|
description = ps.lang('xtc.stamp_desc', d.color),
|
|
|
|
|
action = function()
|
|
|
|
|
if not minigame() then ps.notify(ps.lang('xtc.fail'), "error") return end
|
2025-08-09 03:10:00 -06:00
|
|
|
if not ps.progressbar(ps.lang('xtc.stamping'), d.label, 4000, 'uncuff') then return end
|
2025-08-06 02:25:06 -06:00
|
|
|
TriggerServerEvent("md-drugs:server:stamp", k, d.color)
|
|
|
|
|
end,
|
|
|
|
|
distance = 2.0
|
|
|
|
|
}
|
|
|
|
|
end
|
|
|
|
|
ps.menu('Stamp Pills', 'Stamp Pills', options)
|
2025-08-09 03:10:00 -06:00
|
|
|
end,
|
|
|
|
|
canInteract = function() return handleGang(v.gang) end
|
2025-08-06 02:25:06 -06:00
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
end
|