Files

76 lines
2.4 KiB
Lua
Raw Permalink Normal View History

2025-08-06 02:25:06 -06:00
local pharmaLocations = {
FillPrescription = { -- where to fill out your prescription
{loc = vector3(2855.62, 4446.73, 48.53), l = 1.0, w = 1.0, rot = 45.0, gang = ""},
},
}
2023-12-07 15:45:48 -08:00
2025-08-06 02:25:06 -06:00
ps.registerCallback('md-drugs:server:GetPharmaLocs', function()
return pharmaLocations
end)
2025-08-09 03:10:00 -06:00
2025-07-18 01:19:12 -07:00
local function GetJob(source)
local src = source
2025-07-18 01:19:12 -07:00
return ps.getJobType(src) == 'ems'
end
2025-07-18 01:19:12 -07:00
ps.createUseable('prescription_pad', function(source, item)
2023-12-07 15:45:48 -08:00
local src = source
local near = {}
2025-07-18 01:19:12 -07:00
if GetJob(src) then
2025-08-06 02:25:06 -06:00
near = ps.getNearbyPlayers(src, 5.0)
2025-07-18 01:19:12 -07:00
local options = {
2025-08-09 03:10:00 -06:00
{label = ps.getItemLabel('vicodin_prescription'), value = 'vicodin_prescription'},
{label = ps.getItemLabel('adderal_prescription'), value = 'adderal_prescription'},
{label = ps.getItemLabel('morphine_prescription'), value = 'morphine_prescription'},
{label = ps.getItemLabel('xanax_prescription'), value = 'xanax_prescription'}
2025-07-18 01:19:12 -07:00
}
2025-07-01 03:09:46 -07:00
local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options)
2025-08-09 03:10:00 -06:00
if not data then return ps.notify(src, ps.lang('pharma.canceled'), "error") end
2025-07-18 01:19:12 -07:00
ps.addItem(ps.getSource(data.who), data.what, 1)
end
2023-12-07 15:45:48 -08:00
end)
2024-05-02 18:34:49 -07:00
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
for m, d in pairs (pharmabottle) do
2025-07-18 01:19:12 -07:00
ps.createUseable(d, function(source, item)
local src = source
local check = ps.callback("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
2025-08-06 02:25:06 -06:00
if ps.removeItem(src, d, 1) then
ps.addItem(src, v, math.random(10,30))
2025-08-09 03:10:00 -06:00
ps.notify(src,ps.lang('pharma.unbottle'), "success")
2025-08-06 02:25:06 -06:00
end
2025-07-18 01:19:12 -07:00
end
end
end
2025-07-18 01:19:12 -07:00
end)
2024-05-02 18:34:49 -07:00
end
2023-12-07 15:45:48 -08:00
2025-07-18 01:19:12 -07:00
RegisterServerEvent('md-drugs:server:fillprescription', function(num)
2024-05-02 18:34:49 -07:00
local src = source
if timeOut(src, 'md-drugs:server:fillprescription') then return end
2025-08-06 02:25:06 -06:00
if not ps.checkDistance(src, pharmaLocations.FillPrescription[num].loc, 3.5) then
2025-08-09 03:10:00 -06:00
return ps.notify(src, ps.lang('Catches.notIn'), "error")
2025-07-18 01:19:12 -07:00
end
local pres = {
vicodin_prescription = 'vicodinbottle',
adderal_prescription = 'adderalbottle',
morphine_prescription = 'morphinebottle',
xanax_prescription = 'xanaxbottle'
}
for k, v in pairs (pres) do
2025-07-18 01:19:12 -07:00
if ps.hasItem(src, k, 1) then
ps.removeItem(src, k, 1)
ps.addItem(src, v, 1)
break
end
2024-05-02 18:34:49 -07:00
end
2024-05-17 18:27:56 -07:00
end)