[Release] Silent Alarm (for robberies) (Posts to Discord!)

Silent Alarm FiveM Script (LUA)

Installation:

  1. Add the resource and start it in your server.cfg
  2. Go to your Discord server, make a channel (text) for the silent alarms
  3. Click the “configure” button for the channel, go to “Webhooks” and “Create New”
  4. Configure as you wish, and copy the “Webhook URL”
  5. Paste it into the appropriate place in client.lua
  6. Restart the server and enjoy!

Features:

  • Configurable cooldown
  • Silent alarm posts to Discord
  • Preconfigured locations
  • Adding locations is easy
  • Simple, easy to use.

Download + More

Download (GitHub)
Please also review the README.md!

Usage

Go to any of the green dollar sign icons on the map. Get close enough and it should prompt you saying something like “Press E to activate silent alarm”. When is it activated, it will send a message in Discord stating the name of the establishment and the location (including postal [configurable]).

After this, the person will not be allowed to rob any more places for a 15 minute (default) time period.

Events

Trigger alarm (from client):

TriggerServerEvent("salarm:alertDispatch", "PUT_WEBHOOK_ADDRESS_HERE", "Name of Store", "Location of Store")

This is similar for triggering it from a server script, just do TriggerEvent instead of TriggerServerEvent

3 Likes

Nice release :slight_smile:

Maybe it could be made so if someone enters a bank with a weapon then it will trigger? :wink:

Just an idea, ahaha, thanks for the release tho

1 Like

Can I reccomend storing the webhook server sided? Prevents scriptkitties from using cache decryptors and then getting access to my discord.

What do you mean server sided? As in, putting it in the server script?

That’s relatively simple to do, just remove it from client.lua and put it in the function in client.lua in place of the variable.

He’s recommending you, not asking how to.
If you store the webhook in the client.lua, it gets sent to the client, to where anyone with minimal computer skills can use a cache decryptor to gain access to the contents of the script, thus getting bot tokens, links, etc. and allowing them to send messages to the Discord server through it.

Awesome script, @iceybeta! Could you help me to get working mentioning the whole police department (specific role) on Discord? Can’t get it work :confused:

RegisterServerEvent("salarm:alertDispatch");

AddEventHandler('salarm:alertDispatch', function(webhook, title, location)
    PerformHttpRequest(webhook, process, "POST", "mention = Police Department" "content= Silent Alarm 
    Activated at " .. title .. " (LOCATION: ".. location ..")&tts=true")
end)

function process(statusCode, text, headers)
 	--done
end

I’ve done some digging and the only method I found seems to be broken. I’ll play with it some more and keep you posted.

1 Like

I was searching too, but only possible way, it seems, is to connect server and Discord via IFTTT service. But I am just too non-tech to do that on my own :expressionless:

https://ifttt.com/discover

One guy said that one forum (link below)

“hey kinda late to this but there is a way for webhooks to mention Roles, I use IFTTT for webhooks in my server and all you have to do is copy the role id of the role you want the webhook to mention and put that id where it says content with the ingredients”

https://feedback.discordapp.com/forums/326712-discord-dream-land/suggestions/16708219-allow-webhook-to-mention-users-and-roles

The method I found was to get the role’s ID and format it like this

<@roleidhere>

But that comes back to “deleted role” for whatever reason.

I’ve come up with another idea. Would be awesome, if your script would have been working with car thefts as well! On our server, we use esx_outlaw and esx_carthief, so you could adjust your code from there, maybe.

:slight_smile:

Well you can add it to really any script. There’s an event in the data/server.lua file.

Usage (from client):

TriggerServerEvent("salarm:alertDispatch", "PUT_WEBHOOK_ADDRESS_HERE", "Name of Store", "Location of Store")
1 Like

I really like the idea for this, but (as others have mentioned) it is really unsecure. The cooldown and webhook should be server-side and not client-side. As it is now, not only can anyone obtain the webhook address and post malicious content to Discord but they can also edit the cooldown timer to last any length of their choosing which is going to cause problems on servers with payment systems as cheaters are just going to set the timer to “1” and rob places over and over…

I am cleaning this script up for my own purposes but I would heavily suggest you heed what others have said and please make your code more secure as it’s really unprofessional to not only leave blatant security flaws in your code but to then also tell the end user to “fix it yourself” is just plain ignorant from a developer standpoint.

Can I turn off TTS??

Yes… Just change where ever in the script it is posting to Discord. Should be “/tts message” so just remove the /tts

Could you make so you coulæd get items when pressing E?

is there a way to make this notify users with the police job like as with the outlaw alert please feel free to message me on discord DirectorHappy#0082 i am messing around with the coding to figure this out till you message me back