What framework are you using?
If ESX Legacy, I can help you as I have done exactly this before.
I am at work, so I don’t have the exact code, but it wouldn’t matter anyway, as I use a highly modified version of ESX that I did myself. So here is something I just whipped up to at least show the concept.
RegisterCommand("repair", function(source, args, rawCommand)
if employeesOnDuty then
ESX.ShowNotification("Call someone, you lazy shit")
-- Call repair function from ai_mechanic, etc.
ESX.RegisterServerCallback("checkForWhitelistedEmployees", function(source, cb)
local employeesOnDuty = false
local xPlayers = ESX.GetPlayers()
for i = 1, #xPlayers, 1 do
local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
if xPlayer.job.name == "mechanic" or xPlayer.job.name == "police" or xPlayer.job.name == "ambulance" then
employeesOnDuty = true