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)localallowed=exports['redutzu-mdt']:isAllowed(source)ifallowedthen -- Do something if the player is allowed to open the MDTendend, false)
isJobWhitelisted
This export checks if at least one job is whitelisted.
Here's how you can utilize this export:
hasPermission
This export verifies if a player has a specific permission.
Here's how you can utilize this export:
GetOfficerCallsign
This export retrieves the callsign of a player.
Here's how you can utilize this export:
SetOfficerCallsign
This export modifies the callsign of a player.
Here's how you can utilize this export:
GetOfficerStatus
This export retrieves the status of a player.
Here's how you can utilize this export:
SetOfficerStatus
This export updates the status of a player.
Here's how you can utilize this export:
IsDuty
This export indicates whether the player is on duty or not.
exports['redutzu-mdt']:isJobWhitelisted(jobs) -- table or string
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)
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)
exports['redutzu-mdt']:GetOfficerCallsign(source)
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)
exports['redutzu-mdt']:IsDuty(source)
RegisterCommand('duty', function(source)
local isDuty = exports['redutzu-mdt']:IsDuty(source)
print('Player is ' .. isDuty and 'on duty' or 'off duty')
end, false)
exports['redutzu-mdt']:SetDuty(source, state)
RegisterCommand('toggleDuty', function(source)
local isDuty = exports['redutzu-mdt']:IsDuty(source)
exports['redutzu-mdt']:SetDuty(source, not isDuty)
end, false)