[HELP] Police and EMS rpchat restriction

Hello,

Anyone know how to make rpchat /poli /ems template chats to be restricted to their jobs? When they’re not EMS or Police the cannot use /poli /ems chat template…

I found a script that has no error on Console and CMD side, but the chat doesn’t show at all. (I set my job as Police or Ems)

RegisterCommand('pol', function(source, args, rawCommand)
    local playerName = GetPlayerName(source)
    local msg = rawCommand:sub(6)
    local name = getIdentity(source)
    local xPlayer  = ESX.GetPlayerFromId(source)
    fal = name.firstname .. " " .. name.lastname
    if xPlayer.job.name == 'police' then
    TriggerClientEvent('chat:addMessage', -1, {
        template = '<div style="padding: 0.5vw; margin: 0.5vw; background-color: rgba(0, 155, 255, 1); border-radius: 3px;"><i class="fas fa-globe"></i> Police:<br> {1}</div>',
        args = { fal, msg }
    })
else
TriggerClientEvent('esx:showNotification', source, '~r~You are not an officer!')
         end
end, false)