Here, you'll discover all the handy exports for this asset. Please take the time to read through each step and example carefully to grasp how they function. We advise against using these exports if you're not an experienced developer.
open
This export opens the MDT interface for a specific player.
This export verifies if a player has the job necessary to open the MDT.
exports['redutzu-mdt']:isAllowed(source)
Here's how you can utilize this export:
RegisterCommand('example', function(source)
local allowed = exports['redutzu-mdt']:isAllowed(source)
if allowed then
-- Do something if the player is allowed to open the MDT
end
end, false)
isJobWhitelisted
This export checks if at least one job is whitelisted.
exports['redutzu-mdt']:isJobWhitelisted(jobs) -- table or string
Here's how you can utilize this export:
RegisterNetEvent('dispatchEvent', function(data)
local isWhitelisted = exports['redutzu-mdt']:isJobWhitelisted(data.jobs)
if isWhitelisted then
-- data.jobs includes one of the whitelisted jobs from Config.WhitelistedJobs
end
end)
hasPermission
This export verifies if a player has a specific permission.
RegisterCommand('pin_announcement', function(source)
local hasPerm = exports['redutzu-mdt']:hasPermission(source, 'announcements.pin')
if hasPerm then
print('The player can pin announcements')
end
end, false)
GetOfficerCallsign
This export retrieves the callsign of a player.
exports['redutzu-mdt']:GetOfficerCallsign(source)
Here's how you can utilize this export:
RegisterCommand('callsign', function(source)
local callsign = exports['redutzu-mdt']:GetOfficerCallsign(source)
if callsign then
print('Callsign: ' .. callsign)
else
print('No callsign')
end
end, false)
RegisterCommand('status', function(source)
local status = exports['redutzu-mdt']:GetOfficerStatus(source) -- 0, 1, 2, 3
-- if you are using this code inside the MDT you can do:
local statusName = Config.Statuses[status]?.label
print('Current status: ' .. statusName )
end, false)
RegisterCommand('change_status', function(source, args)
local status = args[1] -- must be 0, 1, 2 or 3
exports['redutzu-mdt']:SetOfficerStatus(source, status)
end, false)
IsDuty
This export indicates whether the player is on duty or not.
exports['redutzu-mdt']:IsDuty(source)
Here's how you can utilize this export:
RegisterCommand('duty', function(source)
local isDuty = exports['redutzu-mdt']:IsDuty(source)
print('Player is ' .. isDuty and 'on duty' or 'off duty')
end, false)
SetDuty
This export modifies the duty state of a player.
exports['redutzu-mdt']:SetDuty(source, state)
Here's how you can utilize this export:
RegisterCommand('toggleDuty', function(source)
local isDuty = exports['redutzu-mdt']:IsDuty(source)
exports['redutzu-mdt']:SetDuty(source, not isDuty)
end, false)