Simple Non ES 911 Script


#1

I am looking for the old 911 chat script, I have been through the forums for 2 days looking with no luck, I have even tried to piece it together with the FiveM- Core and I cant get it working. If anybody knows where about it might be hiding or knows how to implement it into the chat we would be greatly appreciated… Thanks


#2

Did you ever find that script?


#3
AddEventHandler('chatMessage', function(source, name, msg)
	sm = stringsplit(msg, " ");
	if sm[1] == "/911" then
		CancelEvent()
		TriggerClientEvent('chatMessage', -1, "[911] " .. name, { 255, 0, 0 }, string.sub(msg,5))
	end
end)

function stringsplit(self, delimiter)
	local a = self:Split(delimiter)
	local t = {}
	
	for i = 0, #a - 1 do
		table.insert(t, a[i])
	end
	
	return t
end

#4

Ok, So this is the server.lua? and then just create a resource.lua for the script? Sorry, I haven’t payed too much attention to coding as I am primarily just the server computer host.


#5

It worked! Thank you!!


#6

yeah just throw it in a file call it whatever e.g. “server.lua” then make a file called “__resource.lua” and put server_script ‘server.lua’ in there.


#7

Works great, Thanks :slight_smile:


#8

@Modo Just an after-thought… Is there any way to only make this display to particular IP’s?


#9

Yeah there would be a way but you would have to have a database setup and then add code in the 911 script to check if user identifier (ip or steam id) is in table if so then display. I personally don’t want it and don’t have time to do it myself but I’m sure someone here could do it


#10

Thats perfect… No worries it helps alot, I’m sure ill figure it out… Thanks much