Hey Im fairly new to LUA and I need help making esx_outlaw and my 911 command that I made display a chat notification (not esx notification) to policejob and ambulance job only. Currently they display to the whole server.
RegisterServerEvent('esx_outlawalert:carJackInProgress')
AddEventHandler('esx_outlawalert:carJackInProgress', function(targetCoords, streetName, vehicleLabel, playerGender)
if playerGender == 0 then
playerGender = _U('male')
else
playerGender = _U('female')
end
TriggerClientEvent('esx_outlawalert:outlawNotify', -1, _U('carjack', playerGender, vehicleLabel, streetName))
TriggerClientEvent('chat:addMessage', police, {
template = '<div class="chat-message emergency"><div class="chat-message-header">[Dispatch]: A {1} has been seen stealing a {2} near {3} </div><div class="chat-message-body"></div></div>',
args = { playerGender, vehicleLabel, streetName }
})
end)
If you only want it to go to specific players, you’ll need to send an event to the server, then allow it to determine which players have which jobs, then send another event back down to those clients specifically, who can then run the chat event locally.
Tried everything I could find, Im still a begginer and this is really hard haha. Could anybody create the function/event I would need to use? Im soo confused
I figured out how to display the notification for police only, but now getting the message to display in the chat box is my issue? Any help would be appreciated
RegisterNetEvent('esx_outlawalert:outlawNotify')
AddEventHandler('esx_outlawalert:outlawNotify', function(alert)
if isPlayerWhitelisted then
TriggerEvent('chat:addMessage', {
template = '<div class="chat-message emergency"><div class="chat-message-header">[Dispatch]:</div><div class="chat-message-body"></div></div>',
})
end
end)
Specifcally I need to somehow include these messages into the chat from locales:
Locales['en'] = {
['male'] = 'male',
['female'] = 'female',
['carjack'] = '~o~Carjack in progress~s~: a ~r~%s~s~ was spotted jacking an ~o~%s~s~ at ~y~%s~s~',
['combat'] = '~o~Fight in progress~s~: a ~r~%s~s~ has been spotted fighting at ~y~%s~s~',
['gunshot'] = '~o~Shootout in progress~s~: a ~r~%s~s~ has been spotted firing a weapon at ~y~%s~s~',
}