Wert Med System
You can access the setup information you need about this product
INSTALLATION
1 - Upload the script folder to the location of your resources
2 - Check config and editable file settings. Don’t forget to configure the core settings (like the framework) through the config file to match your setup.
3 - Make sure that the ox_lib resource is installed and running. (https://github.com/overextended/ox_lib)
4 - If u want to use default items u need complete Items section. U can access item codes from below. Also u can find item images folder below.
5 - You are ready. Restart ur server and use it. For more options, don’t forget to check the configuration files.
6 - Installation successful, have a good funs
Note : Sql tables automaticly will be install in ur database.
INFORMATION
The script comes with default settings. There are many settings in the configuration file, and you can customize all of them to your personal preferences. Below are the configuration files, feel free to check them out.
ITEMS
Ox Inventory Item Codes
['bandage'] = {
label = 'Bandage',
weight = 115,
rate = { id = "common", background = "#2d703b5c" }
},
['painkillers'] = {
label = 'Painkillers',
weight = 400,
},
['antibiotics'] = {
label = 'Antibiotics',
weight = 400,
},
['adrenaline'] = {
label = 'Adrenaline Shot',
weight = 400,
},
['antiseptic'] = {
label = 'Antiseptic Spray',
weight = 400,
},
['vitamins'] = {
label = 'Vitamins',
weight = 400,
},
['insulin'] = {
label = 'Insulin Injection',
weight = 400,
},
['morphine'] = {
label = 'Morphine',
weight = 400,
},
['oxygenmask'] = {
label = 'Oxygen Mask',
weight = 400,
},
['ivfluid'] = {
label = 'IV Fluid',
weight = 400,
},QB Inventory item codes ;
bandage = {
name = 'bandage',
label = 'Bandage',
weight = 115,
type = 'item',
image = 'bandage.png',
},
painkillers = {
name = 'painkillers',
label = 'Painkillers',
weight = 400,
type = 'item',
image = 'painkillers.png',
},
antibiotics = {
name = 'antibiotics',
label = 'Antibiotics',
weight = 400,
type = 'item',
image = 'antibiotics.png',
},
adrenaline = {
name = 'adrenaline',
label = 'Adrenaline Shot',
weight = 400,
type = 'item',
image = 'adrenaline.png',
},
antiseptic = {
name = 'antiseptic',
label = 'Antiseptic Spray',
weight = 400,
type = 'item',
image = 'antiseptic.png',
},
vitamins = {
name = 'vitamins',
label = 'Vitamins',
weight = 400,
type = 'item',
image = 'vitamins.png',
unique = false, useable = true, shouldClose = true, combinable = nil, description = ''
},
insulin = {
name = 'insulin',
label = 'Insulin Injection',
weight = 400,
type = 'item',
image = 'insulin.png',
unique = false, useable = true, shouldClose = true, combinable = nil, description = ''
},
morphine = {
name = 'morphine',
label = 'Morphine',
weight = 400,
type = 'item',
image = 'morphine.png',
unique = false, useable = true, shouldClose = true, combinable = nil, description = ''
},
oxygenmask = {
name = 'oxygenmask',
label = 'Oxygen Mask',
weight = 400,
type = 'item',
image = 'oxygenmask.png',
unique = false, useable = true, shouldClose = true, combinable = nil, description = ''
},
ivfluid = {
name = 'ivfluid',
label = 'IV Fluid',
weight = 400,
type = 'item',
image = 'ivfluid.png',
unique = false, useable = true, shouldClose = true, combinable = nil, description = ''
},ITEM IMAGES
OPEN FILES
config.lua
-- # General Settings
Config = {
Framework = 'qb', -- 'qb' or 'esx' or 'qbox'
}
Config.MedsSystem = {
Jobs = { ['ambulance'] = 0 },
Keys = {
OpenMyPrescriptions = 'F9'
},
CanWriteSelf = false,
Adherence = {
OverdueToleranceMin = 1,
DamageEveryMinutes = 5,
DamageAmount = 5,
BannerIcon = 'fa-solid fa-pills',
},
WhitelistMeds = {
{ value = 'bandage', label = 'Bandage', icon = 'nui://ox_inventory/web/images/bandage.png' },
{ value = 'painkillers', label = 'Painkillers', icon = 'nui://ox_inventory/web/images/painkillers.png' },
{ value = 'antibiotics', label = 'Antibiotics', icon = 'nui://ox_inventory/web/images/antibiotics.png' },
{ value = 'adrenaline', label = 'Adrenaline Shot', icon = 'nui://ox_inventory/web/images/adrenaline.png' },
{ value = 'antiseptic', label = 'Antiseptic Spray',icon = 'nui://ox_inventory/web/images/antiseptic.png' },
{ value = 'vitamins', label = 'Vitamins', icon = 'nui://ox_inventory/web/images/vitamins.png' },
{ value = 'insulin', label = 'Insulin Injection', icon = 'nui://ox_inventory/web/images/insulin.png' },
{ value = 'morphine', label = 'Morphine', icon = 'nui://ox_inventory/web/images/morphine.png' },
{ value = 'oxygenmask', label = 'Oxygen Mask', icon = 'nui://ox_inventory/web/images/oxygenmask.png' },
{ value = 'ivfluid', label = 'IV Fluid', icon = 'nui://ox_inventory/web/images/ivfluid.png' },
},
Consume = {
Default = {
duration = 3000,
label = 'Taking medicine ...',
canCancel = false,
disable = { move = true, car = true, combat = true },
anim = { dict = 'amb@world_human_clipboard@male@base', clip = 'base', flag = 49 },
},
Overrides = {
bandage = {
duration = 4000,
label = 'Applying bandage ...',
anim = { dict = 'missheistdockssetup1clipboard@base', clip = 'base', flag = 49 },
},
painkillers = {
duration = 3500,
label = 'Taking painkillers ...',
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle', flag = 49 },
},
antibiotics = {
duration = 4000,
label = 'Taking antibiotics ...',
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle', flag = 49 },
},
adrenaline = {
duration = 4500,
label = 'Injecting adrenaline ...',
anim = { dict = 'amb@world_human_clipboard@male@idle_a', clip = 'idle_a', flag = 49 },
prop = { model = 'prop_syringe_01', bone = 57005, pos = vec3(0.14, 0.03, -0.02), rot = vec3(90.0, 0.0, 0.0) },
},
antiseptic = {
duration = 3000,
label = 'Spraying antiseptic ...',
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle', flag = 49 },
},
vitamins = {
duration = 3000,
label = 'Taking vitamins ...',
anim = { dict = 'mp_player_intdrink', clip = 'loop_bottle', flag = 49 },
},
insulin = {
duration = 4000,
label = 'Injecting insulin ...',
anim = { dict = 'amb@world_human_clipboard@male@idle_a', clip = 'idle_a', flag = 49 },
prop = { model = 'prop_syringe_01', bone = 57005, pos = vec3(0.12, 0.03, -0.03), rot = vec3(90.0, 0.0, 0.0) },
},
morphine = {
duration = 5000,
label = 'Injecting morphine ...',
anim = { dict = 'amb@world_human_clipboard@male@idle_a', clip = 'idle_a', flag = 49 },
prop = { model = 'prop_syringe_01', bone = 57005, pos = vec3(0.12, 0.03, -0.03), rot = vec3(90.0, 0.0, 0.0) },
},
oxygenmask = {
duration = 4500,
label = 'Applying oxygen mask ...',
anim = { dict = 'missheistdocksprep1hold_cellphone', clip = 'static', flag = 49 },
prop = { model = 'prop_mask_ballistic', bone = 12844, pos = vec3(0.0, 0.0, 0.0), rot = vec3(0.0, 0.0, 0.0) },
},
ivfluid = {
duration = 6000,
label = 'Setting up IV fluid ...',
anim = { dict = 'amb@world_human_clipboard@male@idle_a', clip = 'idle_a', flag = 49 },
},
},
Sound = {
enabled = true,
default = {
enabled = true,
file = 'default_medsound.ogg',
volume = 0.6,
},
overrides = {
bandage = { enabled = true, file = 'bandage.ogg', volume = 0.6 },
painkillers = { enabled = true, file = 'painkillers.ogg', volume = 0.6 },
antibiotics = { enabled = true, file = 'painkillers.ogg', volume = 0.6 },
adrenaline = { enabled = true, file = 'injection.ogg', volume = 0.7 },
antiseptic = { enabled = true, file = 'spray.ogg', volume = 0.6 },
vitamins = { enabled = true, file = 'painkillers.ogg', volume = 0.6 },
insulin = { enabled = true, file = 'injection.ogg', volume = 0.6 },
morphine = { enabled = true, file = 'painkillers.ogg', volume = 0.6 },
oxygenmask = { enabled = true, file = 'oxygen.ogg', volume = 0.6 },
ivfluid = { enabled = true, file = 'fluid.ogg', volume = 0.6 },
}
}
},
}
config_tablet.lua
Config.Tablet = {
Enabled = true,
Jobs = { ['ambulance'] = 0 },
OpenKey = 'F10',
Command = 'recipetablet',
}
lang.lua
LANG = {
MedsSystem = {
notify_title = 'Medication',
notify_only_doctor = 'Only doctors can write prescriptions.',
notify_created = 'Prescription created for %s.',
notify_taken = 'You have taken %s.',
notify_not_due = 'This medicine is not due yet.',
notify_no_prescriptions = 'You have no active prescriptions.',
ui_doctor_title = 'Write Prescription',
ui_doctor_sub = 'Create a new prescription for a patient',
ui_patient = 'Patient',
ui_add_med = 'Add Medicine',
ui_med_name = 'Name',
ui_med_interval = 'Interval (min)',
ui_med_units = 'Units per dose',
ui_med_total = 'Total doses',
ui_notes = 'Notes (optional)',
ui_submit = 'Create',
ui_cancel = 'Cancel',
ui_patient_title = 'My Prescriptions',
ui_patient_sub = 'Your active treatments and schedule',
ui_take_now = 'Take Now',
ui_due_in = 'due in %sm',
ui_due_now = 'due now',
ui_banner_take_meds = 'You must take your medicine',
menu_open_prescriptions = 'My Prescriptions',
menu_open_presc = 'Open',
progress_take = 'Taking medicine ...',
notify_item_enough_error = 'You are not has this med! Please go pharmacy and take it!',
progress_take = 'Taking medicine ...',
ui_clear_eraser = 'Clear',
ui_signature = 'Signature',
ui_med_inf_name = 'Name',
ui_med_info_int = 'Interval (Min)',
ui_med_info_per = 'Units Per Dose',
ui_med_info_total = 'Total Doses',
ui_med_info_note = 'Note',
Prescription_title_new = 'Prescription #%s',
Doses_Description_new = '%s / %s doses',
Completed_Treatment = 'Treatment successfully completed!',
},
Tablet = {
title = 'EMS Tablet',
subtitle = 'Prescription dashboard',
search_placeholder = 'Search Patient / CID / Doctor',
filter_all = 'All',
filter_active = 'Active',
filter_completed = 'Completed',
col_patient = 'Patient',
col_doctor = 'Doctor',
col_status = 'Status',
col_created = 'Created',
col_progress = 'Progress',
status_active = 'Active',
status_completed = 'Completed',
open_details = 'Open',
empty_list = 'No prescriptions found.',
details_title = 'Prescription Details',
details_patient = 'Patient',
details_doctor = 'Doctor',
details_created = 'Created at',
details_notes = 'Notes',
details_items = 'Items',
item_interval = 'Interval',
item_units = 'Units',
item_total = 'Total',
item_taken = 'Taken',
close = 'Close',
header_opened_by = 'Opened by',
cancel = 'Cancel',
cancel_confirm = 'Are you sure you want to cancel this prescription?',
canceled_ok = 'Prescription has been canceled.',
canceled_fail = 'Failed to cancel the prescription.',
status_canceled = 'Canceled',
confirm_title = 'Cancel Prescription?',
confirm_body = 'This action will mark the prescription as canceled. The patient will no longer see it as active.',
confirm_yes = 'Cancel',
confirm_no = 'Keep',
filter_canceled = 'Canceled',
perm_error = 'You are not authorized to open EMS Tablet.',
},
}editable_server.lua
hasDonePreloading = {}
local discordWebhook = ''
function GiveStarterItems(src)
local Player = Bridge.GetPlayer(src)
if not Player then return end
for _, v in pairs(Config.StarterItems) do
local info = {}
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
if v.item == "id_card" then
info.citizenid = Player.PlayerData.citizenid
info.firstname = Player.PlayerData.charinfo.firstname
info.lastname = Player.PlayerData.charinfo.lastname
info.birthdate = Player.PlayerData.charinfo.birthdate
info.gender = Player.PlayerData.charinfo.gender
info.nationality = Player.PlayerData.charinfo.nationality
elseif v.item == "driver_license" then
info.firstname = Player.PlayerData.charinfo.firstname
info.lastname = Player.PlayerData.charinfo.lastname
info.birthdate = Player.PlayerData.charinfo.birthdate
info.type = "Class C Driver License"
end
else
-- About the esx if u want manage item metadatas
end
Bridge.AddItem(src, { name = v.item, amount = v.amount, slot = false, info = info })
end
end
function loadHouseData(src)
if not Config.LoadQBHouses then return end
local HouseGarages = {}
local Houses = {}
local result = MySQL.query.await('SELECT * FROM houselocations', {})
if result[1] ~= nil then
for _, v in pairs(result) do
local owned = false
if tonumber(v.owned) == 1 then
owned = true
end
local garage = v.garage ~= nil and json.decode(v.garage) or {}
Houses[v.name] = {
coords = json.decode(v.coords),
owned = owned,
price = v.price,
locked = true,
adress = v.label,
tier = v.tier,
garage = garage,
decorations = {},
}
HouseGarages[v.name] = {
label = v.label,
takeVehicle = garage,
}
end
end
TriggerClientEvent("qb-garages:client:houseGarageConfig", src, HouseGarages)
TriggerClientEvent("qb-houses:client:setHouseConfig", src, Houses)
end
function DeleteCharacter(src, identifier)
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
Bridge.framework.Player.DeleteCharacter(src, identifier)
else
-- ESX
local DB_TABLES = { users = "identifier" }
local query = "DELETE FROM `%s` WHERE %s = ?"
local queries = {}
local count = 0
for table, column in pairs(DB_TABLES) do
count = count + 1
queries[count] = { query = query:format(table, column), values = { identifier } }
end
MySQL.transaction(queries, function(result)
if result then
print(("[^2INFO^7] Player ^5%s %s^7 has deleted a character ^5(%s)^7"):format(GetPlayerName(src), src, identifier))
Wait(50)
else
error("\n^1Transaction failed while trying to delete " .. identifier .. "^0")
end
end)
end
TriggerClientEvent('ox_lib:notify', src, { title = 'Character Deleted!', type = 'success' })
end
function DiscordLog(src, new, identifier)
local title = nil
local message = nil
if new then
message = "**".. GetPlayerName(src) .. "** (<@"..(Bridge.GetIdentifier(src, 'discord') and Bridge.GetIdentifier(src, 'discord'):gsub("discord:", "") or "unknown").."> | ||" ..(Bridge.GetIdentifier(src, 'ip') or 'undefined') .. "|| | " ..(Bridge.GetIdentifier(src, 'license') or 'undefined') .." | "..src..") Created new character : .. \n " .. json.encode(new, {indent=true})
else
title = 'Player Loaded ( Joined )'
message = "**".. GetPlayerName(src) .. "** (<@"..(Bridge.GetIdentifier(src, 'discord') and Bridge.GetIdentifier(src, 'discord'):gsub("discord:", "") or "unknown").."> | ||" ..(Bridge.GetIdentifier(src, 'ip') or 'undefined') .. "|| | " ..(Bridge.GetIdentifier(src, 'license') or 'undefined') .." | " ..identifier.." | "..src..") loaded.."
end
local embedData = {
{
['title'] = title,
['color'] = '65280',
['footer'] = { ['text'] = os.date('%c') },
['description'] = message,
['author'] = { ['name'] = "Multicharacter" },
}
}
PerformHttpRequest(discordWebhook, function() end, 'POST', json.encode({ username = 'Multicharacter', embeds = embedData}), { ['Content-Type'] = 'application/json' })
end
local function extractCharNumber(str)
local num = string.match(str, "^char(%d+):")
return tonumber(num)
end
local function containsCharKeyword(str)
return string.find(str, "char") ~= nil
end
local function GetPlayerCitizenIDDatas(src)
local data = {}
local license2, license = GetPlayerIdentifierByType(src, 'license2'), GetPlayerIdentifierByType(src, 'license')
local promise = promise.new()
if Config.Framework ~= 'esx' then
local result = MySQL.query.await('SELECT citizenid, cid, UNIX_TIMESTAMP(last_logged_out) AS lastLoggedOutUnix FROM players WHERE license = ? OR license = ? ORDER BY cid', {license, license2})
for i = 1, #result do
data[#data + 1] = { citizenid = result[i].citizenid, cid = result[i].cid }
end
else
-- Esx
local PREFIX = Config.Prefix or "char"
local identifier = GetIdentifier(src)
local pattern = PREFIX .. "%:" .. identifier
local result = MySQL.query.await([[
SELECT identifier, skin
FROM users
WHERE identifier = ?
OR identifier LIKE ?
]], { identifier, pattern })
for i = 1, #result do
if extractCharNumber(result[i].identifier) then
data[#data + 1] = { citizenid = result[i].identifier, cid = extractCharNumber(result[i].identifier), skin = result[i].skin and json.decode(result[i].skin) or {} }
end
end
end
return data
end
AddEventHandler('QBCore:Server:PlayerLoaded', function(Player)
Wait(1000) -- 1 second should be enough to do the preloading in other resources
hasDonePreloading[Player.PlayerData.source] = true
end)
AddEventHandler('QBCore:Server:OnPlayerUnload', function(src)
hasDonePreloading[src] = false
end)
-- # Callbacks
lib.callback.register('wert-multicharacter:server:get-player-ui-data', function(source)
local src = source
local license2, license = GetPlayerIdentifierByType(src, 'license2'), GetPlayerIdentifierByType(src, 'license')
local plyChars = {}
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
local result = MySQL.query.await('SELECT citizenid, charinfo, money, job, gang, position, cid, UNIX_TIMESTAMP(last_logged_out) AS lastLoggedOutUnix FROM players WHERE license = ? OR license = ? ORDER BY cid', {license, license2})
for i = 1, #result do
local cid = tostring(result[i].cid)
result[i].charinfo = json.decode(result[i].charinfo)
result[i].money = json.decode(result[i].money)
result[i].job = json.decode(result[i].job)
plyChars[cid] = result[i]
end
else
-- ESX
local function ESXGetJobLabel(name, grade)
local isLabel = MySQL.scalar.await('SELECT `label` FROM `job_grades` WHERE `job_name` = ? AND `grade` = ? LIMIT 1', { name, tonumber(grade) })
if not isLabel then isLabel = 'Unemployed' end
return { grade = { name = isLabel } }
end
local PREFIX = Config.Prefix or "char"
local identifier = GetIdentifier(src)
local pattern = PREFIX .. "%:" .. identifier
local result = MySQL.query.await([[
SELECT identifier, accounts, job, job_grade, firstname, lastname, dateofbirth, sex, nationality
FROM users
WHERE identifier = ?
OR identifier LIKE ?
]], { identifier, pattern })
for i = 1, #result do
if extractCharNumber(result[i].identifier) then
local cid = extractCharNumber(result[i].identifier)
cid = tostring(cid)
local accounts = result[i].accounts and json.decode(result[i].accounts) or {}
plyChars[cid] = {
citizenid = result[i].identifier,
cid = tonumber(cid),
job = ESXGetJobLabel(result[i].job, result[i].job_grade),
money = { cash = accounts.money or 0, bank = accounts.bank or 0 },
charinfo = {
gender = result[i].sex == 'f' and 1 or 0,
birthdate = result[i].dateofbirth,
firstname = result[i].firstname,
lastname = result[i].lastname,
nationality = result[i].nationality or Config.DefaultNationality
}
}
end
end
end
return plyChars
end)
lib.callback.register('wert-multicharacter:server:get-spawn-peds', function(source)
local src = source
if Config.Framework == 'esx' then
Bridge.framework.Players[GetIdentifier(src)] = true
end
local plyChars = GetPlayerCitizenIDDatas(src)
if #plyChars > 0 then
local skins = {}
local citizenTable = {}
local queryTable = {}
for i=1, #plyChars do
queryTable[#queryTable+1] = plyChars[i].citizenid
citizenTable[plyChars[i].citizenid] = plyChars[i].cid
if Config.ClothingSystem == 'skinchanger' then
local selectCid = tostring(plyChars[i].cid)
local model = `mp_m_freemode_01`
if plyChars[i].skin and plyChars[i].skin == 1 then model = `mp_f_freemode_01` end
skins[selectCid] = { model = model, skin = plyChars[i].skin }
end
end
if Config.ClothingSystem ~= 'skinchanger' then
local result = MySQL.query.await('SELECT * FROM playerskins WHERE citizenid IN (?) AND active = 1', { queryTable })
if result then
for _, row in ipairs(result) do
local selectCid = citizenTable[row.citizenid]
selectCid = tostring(selectCid)
if Config.ClothingSystem == 'illenium-appearance' then
local mySkinData = json.decode(row.skin)
skins[selectCid] = {model = mySkinData.model, skin = mySkinData}
else
skins[selectCid] = {model = row.model, skin = json.decode(row.skin)}
end
end
end
end
return skins
else
return {}
end
end)
-- # Logout command
if Config.Logout.active then
lib.addCommand(Config.Logout.name, {
help = Config.Logout.description,
restricted = 'group.' .. Config.Logout.group
}, function(source, args, raw)
local src = source
local ply = Bridge.GetPlayer(src)
if not ply then
TriggerClientEvent('ox_lib:notify', src, { title = LANG.target_not_online, type = 'error' })
return
end
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
Bridge.framework.Player.Logout(src)
else
TriggerEvent("esx:playerLogout", src)
end
TriggerClientEvent('wert-multicharacter:client:chooseChar', src)
end)
end
if Config.Framework == 'esx' then
local PREFIX = Config.Prefix or "char"
local PRIMARY_IDENTIFIER = Bridge.framework.GetConfig().Identifier or GetConvar("sv_lan", "") == "true" and "ip" or "license"
local oneSyncState = GetConvar("onesync", "off")
CreateThread(function()
Wait(1000)
if next(Bridge.framework.Players) then
local players = table.clone(Bridge.framework.Players)
table.wipe(Bridge.framework.Players)
for _, v in pairs(players) do
Bridge.framework.Players[GetIdentifier(v.source)] = true
end
else
Bridge.framework.Players = {}
end
end)
AddEventHandler("playerConnecting", function(_, _, deferrals)
deferrals.defer()
local identifier = GetIdentifier(source)
if oneSyncState == "off" or oneSyncState == "legacy" then
return deferrals.done(("[ESX] ESX Requires Onesync Infinity to work. This server currently has Onesync set to: %s"):format(oneSyncState))
end
if identifier then
if not Bridge.framework.GetConfig().EnableDebug then
if Bridge.framework.Players[identifier] then
deferrals.done(("[Wert Multicharacter] A player is already connected to the server with this identifier.\nYour identifier: %s:%s"):format(PRIMARY_IDENTIFIER, identifier))
else
deferrals.done()
end
else
deferrals.done()
end
else
deferrals.done(("Unable to retrieve player identifier.\nIdentifier type: %s"):format(PRIMARY_IDENTIFIER))
end
end)
MySQL.ready(function()
Wait(1000)
while not next(Bridge.framework.Jobs) do
Wait(500)
Bridge.framework.Jobs = Bridge.framework.GetJobs()
end
end)
AddEventHandler("playerDropped", function()
hasDonePreloading[source] = false
Bridge.framework.Players[GetIdentifier(source)] = nil
end)
function GetIdentifier(source)
local fxDk = GetConvarInt("sv_fxdkMode", 0)
if fxDk == 1 then return "ESX-DEBUG-LICENCE" end
local identifier = GetPlayerIdentifierByType(source, PRIMARY_IDENTIFIER)
return identifier and identifier:gsub(PRIMARY_IDENTIFIER .. ":", "")
end
endbridge/client.lua
Bridge = {}
-- # Get core
if Config.Framework == 'qb' then
Bridge.framework = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'qbox' then
Bridge.framework = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'esx' then
Bridge.framework = exports["es_extended"]:getSharedObject()
endbridge/server.lua
Bridge = {}
-- # Get core
if Config.Framework == 'qb' then
Bridge.framework = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'qbox' then
Bridge.framework = exports['qb-core']:GetCoreObject()
elseif Config.Framework == 'esx' then
Bridge.framework = exports["es_extended"]:getSharedObject()
end
function Bridge.GetPlayer(src)
if not src then return nil end
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
return Bridge.framework.Functions.GetPlayer(src)
else
return Bridge.framework.GetPlayerFromId(src)
end
end
function Bridge.GetIdentifier(src, idtype)
if GetConvarInt('sv_fxdkMode', 0) == 1 then return 'license:fxdk' end
return GetPlayerIdentifierByType(src, idtype or 'license')
end
function Bridge.AddItem(src, data)
if not src then return false end
local ply = Bridge.GetPlayer(src)
if not ply then return end
if GetResourceState('ox_inventory') == 'started' then
exports.ox_inventory:AddItem(src, data.name, data.amount, data.info, data.slot)
return
end
if Config.Framework == 'qb' or Config.Framework == 'qbox' then
ply.Functions.AddItem(data.name, data.amount, data.slot, data.info)
else
ply.addInventoryItem(data.name, data.amount)
end
endLast updated