Installation
If you aren't familiar with programming or just you don't know how to set up the script, we present our installation guide which is as comprehensive as possible so you don't have any difficulties.
STEP 1 - Dependencies
es_extended or qb-core or qbx_core
STEP 2 - Resource order
start es_extended/qb-core/qbx_core
start mst_drugdetectorSTEP 3 - Database
Without adding these items to the database, the script will not work!
DELETE FROM items WHERE name = 'drugdetector';
DELETE FROM items WHERE name = 'drugdetector_used';
DELETE FROM items WHERE name = 'joint';
DELETE FROM items WHERE name = 'cocaine';
DELETE FROM items WHERE name = 'ecstasy';
DELETE FROM items WHERE name = 'meth';
DELETE FROM items WHERE name = 'heroin';
DELETE FROM items WHERE name = 'morphine';
DELETE FROM items WHERE name = 'xanax';
INSERT INTO `items` (`name`, `label`, `weight`) VALUES
('drugdetector', 'Drug Detector', 1),
('drugdetector_used', 'Used Drug Detector', 1),
('joint', 'Joint', 1),
('cocaine', 'Cocaine', 1),
('ecstasy', 'Ecstasy', 1),
('meth', 'Methamphetamine', 1),
('heroin', 'Heroin', 1),
('morphine', 'Morphine', 1),
('xanax', 'Xanax', 1)
;drugdetector = { name = 'drugdetector', label = 'Drug Detector', weight = 1, type = 'item', image = 'drugdetector.png', unique = false, useable = true, shouldClose = true, description = 'A device used to test for drugs in a person\'s system' },
drugdetector_used = { name = 'drugdetector_used', label = 'Used Drug Detector', weight = 1, type = 'item', image = 'drugdetector_used.png', unique = true, useable = false, shouldClose = true, description = 'A drug detector that has been used and contains test results' },
joint = { name = 'joint', label = 'Joint', weight = 1, type = 'item', image = 'joint.png', unique = false, useable = true, shouldClose = true, description = 'A cannabis joint' },
cocaine = { name = 'cocaine', label = 'Cocaine', weight = 1, type = 'item', image = 'cocaine.png', unique = false, useable = true, shouldClose = true, description = 'Cocaine powder' },
ecstasy = { name = 'ecstasy', label = 'Ecstasy', weight = 1, type = 'item', image = 'ecstasy.png', unique = false, useable = true, shouldClose = true, description = 'Ecstasy pill' },
meth = { name = 'meth', label = 'Methamphetamine', weight = 1, type = 'item', image = 'meth.png', unique = false, useable = true, shouldClose = true, description = 'Methamphetamine crystal' },
heroin = { name = 'heroin', label = 'Heroin', weight = 1, type = 'item', image = 'heroin.png', unique = false, useable = true, shouldClose = true, description = 'Heroin powder' },
morphine = { name = 'morphine', label = 'Morphine', weight = 1, type = 'item', image = 'morphine.png', unique = false, useable = true, shouldClose = true, description = 'Morphine injection' },
xanax = { name = 'xanax', label = 'Xanax', weight = 1, type = 'item', image = 'xanax.png', unique = false, useable = true, shouldClose = true, description = 'Xanax pill' },['drugdetector'] = {
label = 'Drug Detector',
weight = 1000,
stack = true,
close = true,
description = 'A device used to test for drugs in a person\'s system',
client = {
image = 'drugdetector.png'
}
},
['drugdetector_used'] = {
label = 'Used Drug Detector',
weight = 1000,
stack = false,
close = true,
description = 'A drug detector that has been used and contains test results',
client = {
image = 'drugdetector_used.png'
}
},
['joint'] = {
label = 'Joint',
weight = 50,
stack = true,
close = true,
description = 'A cannabis joint',
client = {
image = 'joint.png'
}
},
['cocaine'] = {
label = 'Cocaine',
weight = 100,
stack = true,
close = true,
description = 'Cocaine powder',
client = {
image = 'cocaine.png'
}
},
['ecstasy'] = {
label = 'Ecstasy',
weight = 50,
stack = true,
close = true,
description = 'Ecstasy pill',
client = {
image = 'ecstasy.png'
}
},
['meth'] = {
label = 'Methamphetamine',
weight = 100,
stack = true,
close = true,
description = 'Methamphetamine crystal',
client = {
image = 'meth.png'
}
},
['heroin'] = {
label = 'Heroin',
weight = 100,
stack = true,
close = true,
description = 'Heroin powder',
client = {
image = 'heroin.png'
}
},
['morphine'] = {
label = 'Morphine',
weight = 50,
stack = true,
close = true,
description = 'Morphine injection',
client = {
image = 'morphine.png'
}
},
['xanax'] = {
label = 'Xanax',
weight = 10,
stack = true,
close = true,
description = 'Xanax pill',
client = {
image = 'xanax.png'
}
}drugdetector = { label = "Drug Detector", weight = 1, type = "item", image = "drugdetector.png", unique = false, useable = true, shouldClose = true, description = "A device used to test for drugs in a person's system" },
drugdetector_used = { label = "Used Drug Detector", weight = 1, type = "item", image = "drugdetector_used.png", unique = true, useable = false, shouldClose = true, description = "A drug detector that has been used and contains test results" },
joint = { label = "Joint", weight = 1, type = "item", image = "joint.png", unique = false, useable = true, shouldClose = true, description = "A cannabis joint" },
cocaine = { label = "Cocaine", weight = 1, type = "item", image = "cocaine.png", unique = false, useable = true, shouldClose = true, description = "Cocaine powder" },
ecstasy = { label = "Ecstasy", weight = 1, type = "item", image = "ecstasy.png", unique = false, useable = true, shouldClose = true, description = "Ecstasy pill" },
meth = { label = "Methamphetamine", weight = 1, type = "item", image = "meth.png", unique = false, useable = true, shouldClose = true, description = "Methamphetamine crystal" },
heroin = { label = "Heroin", weight = 1, type = "item", image = "heroin.png", unique = false, useable = true, shouldClose = true, description = "Heroin powder" },
morphine = { label = "Morphine", weight = 1, type = "item", image = "morphine.png", unique = false, useable = true, shouldClose = true, description = "Morphine injection" },
xanax = { label = "Xanax", weight = 1, type = "item", image = "xanax.png", unique = false, useable = true, shouldClose = true, description = "Xanax pill" },STEP 4 - Inventory Metadata
Insert this block of code in tgiann-inventory/configs/configMetadataAdvance.lua
drugdetector_used = function(metadata, currentLang)
local L
do
local ok, labels = pcall(function()
return exports['mst_drugdetector']:GetDrugDetectorLocaleLabels()
end)
if ok and type(labels) == 'table' then
L = {
officer = labels.officer or "",
tested = labels.tested or "",
result = labels.result or "",
date_time = labels.date_time or "",
}
else
L = { officer = "", tested = "", result = "", date_time = "" }
end
end
local row = [[
<div class="item_info_row">
<div class="item_info_row_left">%s</div>
<div class="item_info_row_right">%s</div>
</div>
]]
local rows = {}
table.insert(rows, row:format(L.officer, metadata and (metadata.officer or "-") or "-"))
table.insert(rows, row:format(L.tested, metadata and (metadata.tested or "-") or "-"))
table.insert(rows, row:format(L.result, metadata and (metadata.testResult or "-") or "-"))
table.insert(rows, row:format(L.date_time, metadata and (metadata.dateTime or "-") or "-"))
local html = [[ <div class="item_info_container">%s</div> ]]
return html:format(table.concat(rows, "\n"))
end,STEP 5 - Not working?
We hope you won’t need this step, but if you do, feel free to join our Discord and open a support ticket. :)
Last updated