API
Set Admin Duty by Player ID
AddEventHandler('rcore_report:server_setAdminDutyOn', function(playerId)
if hasAdminPermissions(playerId) then
local isSuperAdmin = hasSuperAdminPermissions(playerId)
setAdminDutyOn(playerId, isSuperAdmin)
end
end)
AddEventHandler('rcore_report:server_setAdminDutyOff', function(playerId)
setAdminDutyOff(playerId)
end)RegisterCommand('COMMAND_TO_TOGGLE_DUTY_FOR_ADMIN_ON', function(source, args)
local playerId = tonumber(args[1])
-- Check for the permissions required to use this command here.
if not hasAdminPermissions(source) then
sendNotification(source, 'You don\'t have permissions to use this command.')
return
end
-- Checks if playerId is used
if not playerId then
sendNotification(source, 'You need to specify the player\'s ID for this command.')
return
end
-- Checks if player exist
if not GetPlayerName(playerId) then
sendNotification(source, 'The player with the specified ID is not online.')
return
end
-- Check for the permissions of the selected player.
if not hasAdminPermissions(playerId) then
sendNotification(source, 'The player with the specified ID does not have admin permissions.')
return
end
TriggerEvent('rcore_report:server_setAdminDutyOn', playerId)
end)
RegisterCommand('COMMAND_TO_TOGGLE_DUTY_FOR_ADMIN_OFF', function(source, args)
local playerId = tonumber(args[1])
-- Check for the permissions required to use this command here.
if not hasAdminPermissions(source) then
sendNotification(source, 'You don\'t have permissions to use this command.')
return
end
-- Checks if playerId is used
if not playerId then
sendNotification(source, 'You need to specify the player\'s ID for this command.')
return
end
-- Checks if player exist
if not GetPlayerName(playerId) then
sendNotification(source, 'The player with the specified ID is not online.')
return
end
-- Check for the permissions of the selected player.
if not hasAdminPermissions(playerId) then
sendNotification(source, 'The player with the specified ID does not have admin permissions.')
return
end
TriggerEvent('rcore_report:server_setAdminDutyOff', playerId)
end)Last updated