[How-to] Integrate Nearest Postal Within Your 911 Script

The methods I use may not be the best performance wise, if you have anything better then please feel free to let me know.

Scripts used:
Nearest Postal
Any 911 Script, I use my own therefore I can’t suggest one.

As far as I’ve tested, this doesn’t change based on the postal codes you use. This should work with any of them.

1- Install Nearest Postal and ensure it fully works on your server before doing this.
2- In the Nearest Postal folder, Open “cl.sv” with an editor of your choice.
3- Add the following code around line 61 (After the thread)

exports("npostal", function()
	return postals[nearest.i].code
end)

4- In your 911 script, add this where you define your variables.
local postal = exports.npostal:npostal();

Done!

Now to get this to actually show up, you’ll want your chat message to look something like this… DO NOT COPY THE BELOW CODE, IT IS MADE FOR MY SCRIPT. IT WILL PROBABLY BREAK YOUR SCRIPT. IT IS JUST AN EXAMPLE.

TriggerClientEvent('chatMessage', -1, '', {255,255,0}, '^*^1911 Caller: ^r' .. playername .. '^*^4 | Location: ^r' .. location .. '^*^4 | Postal: ^r' .. postal .. '^*^4 | Report: ^r' .. msg)

If you have any issues, I’ll try my best to help you out.

2 Likes

Can i have help setting it up in my 911 resource

Awesome, thank you took me a bit to work it around with my 911 script. Great release!

:star_struck::star_struck::star_struck::star_struck::star_struck::star_struck: