[FREE] ShotSpotter - Gunshot Detection System

:bookmark_tabs: Description

This is a simple standalone ShotSpotter script made for FiveM.

The script will detect when gunshots are fired and will put out a sound and text alert to all of the Law Enforcement patrol vehicles with an approximate location.
No permissions are being used, you just have to be inside a police car to receive the gunshot alert.

To be realistic, the ShotSpotter has a default delay of 20 seconds to put out an alert after gunshots are detected.
Throwables, melees, fire extinguishers, stunguns, flareguns, and suppressed weapons won’t be detected by the ShotSpotter.
These last two parameters can be configured in the config.lua as well as a couple of other options (see config options).

:bulb: Features

  • Simple and clean
  • Highly customizable
  • Sound effect
  • Animated map blip
  • Suppressed weapons won’t be detected
  • Ability to blacklist weapons

:eyes: Preview

Video demo

Gunshot alerts

gunshot alert 1
gunshot alert 2

Map blip

map blip

Config options

config options

:bar_chart: Resmon

Context CPU
Idle 0.03 ms
Peak 0.04 ms

:inbox_tray: Installation

  • Rename the folder from ShotSpotter-main to ShotSpotter
  • Drag the folder to your server resource folder
  • Add start ShotSpotter or ensure ShotSpotter to your server.cfg

:white_check_mark: Changelog

v1.4

  • Added version checker

v1.3

  • Removed useless AddEventHandler
  • Used pre-hashed string to remove GetHashKey
    (Thanks to Ekinoxx0)

v1.2

  • Reduced resource impact on performance (0.26ms to 0.08ms)

v1.1

  • Updated InvokeNative to the actual Get StreetNameAtCoord native
  • Replaced outdated GetPlayerPed with PlayerPedId
    (Thanks to MichaelCoding25)

v1.0

  • Initial Release

:arrow_down: Download

23 Likes

Nice release! Thank you for making this free.

5 Likes

So everyone will be able to see the calls?

@Crypto_boy Not everyone, only to the players who are inside a police car.

How did you get your walking style to stay on when you got in/out of the car, are you using DP Emotes?

@CJRP_Civil_Justice_R Yeah I use dp. I haven’t done anything, I never had that problem to be honest

resmon?

Is there a way to configure the list of police cars for those who use addon cars? Or is it just police, police2 etc. From vanilla files?

The script works also with addon police cars by default.
Basically, it works with all the vehicles that have the flag FLAG_LAW_ENFORCEMENT in the vehicles.meta

1 Like

As of v1.0.1, it’s 0.27 ms, which is not that great.
I’m gonna actually release v1.0.2 in a bit, which is 0.08 ms, as you can see from the picture.

So yeah props to you for pointing that.

1 Like

Is there a way this can be reconfigered to use a command for example /leoonduty instead of using just emergency vehicles as Fire & EMS would get the notifications aswell and also is there a way to make it so LEO don’t have their shots picked up by it another example of a on duty command or something like that maybe?

For your second point, think about it in IRL terms, the shot spotter does not know who shot, it does not care if it is a police officer or not, it will still put out a notification.

does this work on infinity?

Didn’t test it but I think so

Awesome script! Thank you for sharing this for free!

1 Like

I can’t get working on my server. Will it work with the real gun sounds mod?

Yeah sounds won’t affect anyhting, it works perfectly on my server.

Tell me more about the problem. Are you sure you’re using a police car? Notification will only be sent out to players who are inside of a police car.

I spawned a police car. first I stood outside the car, fired and then got in, no notification. I then fired from inside the car, still no notification. there are no errors showing on any screens.
I made sure that I was on duty but still the same. I don’t see that it is based on a job type as I am listed as sheriff and not police.

What car was it? If it’s addon, make sure it has the flags FLAG_LAW_ENFORCEMENT and FLAG_EMERGENCY_SERVICE in the vehicles.meta.

Try with a vanilla police car, if it still doesn’t work, then we are sure the problem is in the script. In that case let me know, so I can try give you a fix.

Also, if you fire a single shot sometimes it won’t detect it, so try to like fire a long burst if you haven’t done that already.

no add on, just the first police car, called police. I had not thought about shooting a bunch. so I just logged in and emptied an AK mag… still nothing