[Release] [ESX] Job and Emergency Chat

esx_jobChat

Job/Emergency chat for fivem using ESX

Commands

/jobc Messages to people who have the same job
/311 Non emergency number, goes to pd and ems
/911 Emergency number, goes to pd and ems

Important
Messages to 311 and 911 will not show for the sender unless their job is police or ambulance.
311 and 911 will also generate markers on the map for the ease of finding where the call came from.
The script checks your job once per minute, so if yyou change jobs just wait a bit for it too check what your job is.

Setup

Just add the mod to your mods.cfg or server.cfg
This mod uses ESX and the basic Fivem Chat to run

GitHub

5 Likes

can’t you share file HTML chat ?

Not sure what you mean, this uses the default chat. What I made doesn’t have any HTML files

When you send an emergency, does it also make a blips of the position where you sent the call?

Yes, the police and ambulance job players will get a blip on their map saying 911 Call / 311 Call

Do you give me permission to modify the script to my liking? if you want when I modify it I can send it to you in case you like to put it also in your script

Of course, yeah sure interested to see what you want to change

I am trying to put this notice, instead of the chat, but when I send a / 911 I get this :frowning:

I have changed the code to this

RegisterNetEvent('esx_jobChat:EmergencySend')
AddEventHandler('esx_jobChat:EmergencySend', function(messageFull)
    if PlayerData.job.name == 'police' or PlayerData.job.name == 'ambulance' then
SetNotificationTextEntry("STRING");
AddTextComponentString(messageFull);
SetNotificationMessage("CHAR_CALL911", "CHAR_CALL911", true, 1, "~y~911 Dispatcher~s~", "");
DrawNotification(false, true);
    end
end)

Yeah the value for messageFull is a table. That’s how the chat function takes it. You will have to change full message to be a normal string

You mean modify this code, right? what’s in server.lua

RegisterServerEvent('esx_jobChat:911')
AddEventHandler('esx_jobChat:911', function(targetCoords, msg, streetName, emergency)
    local _source = source
    local xPlayers = ESX.GetPlayers()
	local pName= getIdentity(source)
	local messageFull
	fal = pName.firstname .. " " .. pName.lastname
	if emergency == '911' then
		messageFull = {args = {fal, streetName, msg}
		}
	else
		messageFull = {args = {fal, streetName, msg}
		}
	end
	TriggerClientEvent('esx_rpchat:sendProximityMessage', -1, '', '^2[OOC] Has enviado una llamada de rol de entorno' )
	TriggerClientEvent('esx_jobChat:911Marker', -1, targetCoords, emergency)
    TriggerClientEvent('esx_jobChat:EmergencySend', -1, messageFull)
end)

Ready, I already did it, it’s already the way I wanted it, thanks :blush:

Can you share this edit or make a PR?

could you share it

This command / jobc can only be seen by those who have the same job or can everyone see it?

what is PR?

Amazing resource, chat looks amazing with it.

1 Like

Pull Request on github

I understand, but if the author does not give permission I can not publish anything

share it please

Your more than welcome to share it somewhere. Would appreciate if you give credit to the original but you don’t have to.