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 - Download
Download mst_drugdetector and mst_bridge from Portal.
STEP 2 - Dependencies
The script requires several dependencies to function properly.
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';
DELETE FROM items WHERE name = 'narcan';
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),
('narcan', 'Narcan', 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' },
narcan = { name = 'narcan', label = 'Narcan', weight = 1, type = 'item', image = 'narcan.png', unique = false, useable = true, shouldClose = true, description = 'Narcan spray' },
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,