fuckin christ
This commit is contained in:
1 parent
314f7381d1
commit
daa1a4f8a3
12 files changed
+425
-384
No files matched your search
+45
-53
@@ -1,75 +1,67 @@
|
||||
local QBCore = exports['qb-core']:GetCoreObject()
|
||||
|
||||
local function GetJob(source)
|
||||
local function GetJob(source)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
if Player.PlayerData.job.type == 'ems' then
|
||||
return true
|
||||
else
|
||||
ps.notify(src, 'You Must Be EMS To Do This', 'error')
|
||||
return false
|
||||
end
|
||||
return ps.getJobType(src) == 'ems'
|
||||
end
|
||||
|
||||
CUI('prescription_pad', function(source, item)
|
||||
ps.createUseable('prescription_pad', function(source, item)
|
||||
local src = source
|
||||
local near = {}
|
||||
if GetJob(src) then
|
||||
for k, v in pairs (QBCore.Functions.GetQBPlayers()) do
|
||||
local targ = QBCore.Functions.GetPlayerByCitizenId(v.PlayerData.citizenid)
|
||||
local tname = GetName(v.PlayerData.source)
|
||||
local ped, tped = GetPlayerPed(src), GetPlayerPed(v.PlayerData.source)
|
||||
local dist = #(GetEntityCoords(ped) - GetEntityCoords(tped))
|
||||
if dist < 5.0 then
|
||||
table.insert(near, {label = tname, value = targ.PlayerData.citizenid})
|
||||
end
|
||||
end
|
||||
local options = { {label = 'Vicodin', value = 'vicodin_prescription'}, {label = 'Adderal', value = 'adderal_prescription'}, {label = 'Morphine', value = 'morphine_prescription'},{label = 'Xanax', value = 'xanax_prescription'}}
|
||||
if GetJob(src) then
|
||||
local near = ps.getNearbyPlayers(src, 5.0)
|
||||
|
||||
local options = {
|
||||
{label = 'Vicodin', value = 'vicodin_prescription'},
|
||||
{label = 'Adderal', value = 'adderal_prescription'},
|
||||
{label = 'Morphine', value = 'morphine_prescription'},
|
||||
{label = 'Xanax', value = 'xanax_prescription'}
|
||||
}
|
||||
local data = ps.callback('md-drugs:client:prescriptionpad', src, near, options)
|
||||
if type(data) == 'table' then
|
||||
local give = QBCore.Functions.GetPlayerByCitizenId(data.who)
|
||||
for i = 1, #options do
|
||||
if data.what == options[i].value then
|
||||
AddItem(give.PlayerData.source, data.what, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
if not data then return ps.notify(src, ps.lang('Pharma.cancel'), "error") end
|
||||
ps.addItem(ps.getSource(data.who), data.what, 1)
|
||||
end
|
||||
end)
|
||||
|
||||
local pharmabottle = {'vicodinbottle', 'adderalbottle','morphinebottle','xanaxbottle'}
|
||||
for m, d in pairs (pharmabottle) do
|
||||
CUI(d, function(source, item)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
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
|
||||
RemoveItem(src, d, 1)
|
||||
AddItem(src, v, math.random(10,30))
|
||||
ps.notify(src,Lang.Pharma.unbottle, "success")
|
||||
--Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma')
|
||||
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
|
||||
ps.removeItem(src, d, 1)
|
||||
ps.addItem(src, v, math.random(10,30))
|
||||
ps.notify(src,ps.lang('Pharma.unbottle'), "success")
|
||||
--Log(GetName(src) .. ' Unbottled 30 Of ' .. v .. '!', 'pharma')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('md-drugs:server:fillprescription', function()
|
||||
RegisterServerEvent('md-drugs:server:fillprescription', function(num)
|
||||
local src = source
|
||||
local Player = getPlayer(src)
|
||||
local pres = {vicodin_prescription = 'vicodinbottle', adderal_prescription = 'adderalbottle', morphine_prescription = 'morphinebottle', xanax_prescription = 'xanaxbottle'}
|
||||
if not ps.checkDistance(src, GlobalState.MDDrugsLocs.FillPrescription[num].loc, 3.5) then
|
||||
return ps.notify(src, ps.lang('Pharma.toofar'), "error")
|
||||
end
|
||||
local pres = {
|
||||
vicodin_prescription = 'vicodinbottle',
|
||||
adderal_prescription = 'adderalbottle',
|
||||
morphine_prescription = 'morphinebottle',
|
||||
xanax_prescription = 'xanaxbottle'
|
||||
}
|
||||
for k, v in pairs (pres) do
|
||||
if Player.Functions.GetItemByName(k) then
|
||||
RemoveItem(src, k, 1 )
|
||||
AddItem(src,v, 1)
|
||||
if ps.hasItem(src, k, 1) then
|
||||
ps.removeItem(src, k, 1)
|
||||
ps.addItem(src, v, 1)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user