[RELEASE]Setro-Announce: Announcements system with visuals that stand out and sound! (Fixed bug)

Critical: Fixed a bug that could allow non-admins to use the command. Please download the new version!
Introducing Setro-announce, allowing you to make a pretty announcement that stands out to everyone instead of traditional announcements being hidden in a tiny chat message, along with a cool little sound to get everyone’s attention.

The command is restricted to users with “command” ace permissions.
(to give your admins this permission, add add_ace group.admin command allow to your server.cfg).

You can configure how long the message stays for by editing line 3 of client.lua, lastfor, to equal whatever time you want it to display for, in seconds.

Usage: /announce message

That’s all. I hope you like it! :slight_smile:

Notice: This resource is provided as-is. Do not ask me to make custom edits for your server. Only ask questions if they are problems with the resource.

setroannounce.zip (1.2 KB)

19 Likes

Looks awesome, going to have to try it out!

2 Likes

Why does it require EssentialMode if it uses ace for permissions?

:thinking:


It’s how the commands are scripted, using es:addcommand. I prefer using Essentialmode’s way of adding commands than the default “check chat message for /” method.
You only need the base, nothing else.

1 Like

Use RegisterCommand

Using EssentialModes Base just to add a command is really not necessary.

I knew about that, I still prefer essentialmode’s. Personal preference. Unless RegisterCommand also shows the tooltip under the command as you’re typing it.
Most servers already have it anyways, it’s required for a lot of resources.

I mean, I guess it really is up to you, but it would be better practice to have it rely on as little resources as possible and use the built-in functions instead.

Also, just some advice, and it really should apply to all people creating resources, why write at the top of the code in the client script “Do not touch below” etc, etc?
Instead, why not use comments to explain what the code does? I think people who view it will learn how it actually works instead of thinking they can’t touch it.
If they fuck up, its part of learning, but just straight telling them that they can’t touch it isn’t the right way to go about it IMO.

And a suggestion, why not add in the command the ability to set the time the message lasts for instead of it being a variable?
That way when someone uses the command, they can decide how long it lasts.
And you could use the lastfor variable as a hard cap instead (say 20 seconds max?), so that someone using the command doesn’t let it stay visible for hours.

You’re right, I misused comments in the code. It’s probably from my prejudice in being in the FiveM discord- I’ve seen people tamper with stuff and then be completely clueless why it’s broken.

As for the built-in function, I’ll try and port it over. I just hope it has the same functionality. I’m really against checking for commands by scanning for a slash in a chat message, it seems inefficient.

As for the command setting the variable, I’m not that great at Lua yet and don’t know how I would make that variable persistent, i.e saving its value after server restart. Creating/editing files from scripts, if that’s the way to do it, is a bit challenging for me but I’m up for anything.

I am new to this stuff, so how do I add an admin to my server cfg file?

add system admins

add_ace group.admin command allow # allow all commands
add_ace group.admin command.quit deny # but don’t allow quit
add_principal identifier.steam:110000112345678 group.admin # add the admin to the group

1 Like

If that’s your steam ID in there, looks good.

seems to still not be working for me, idk what I am doing wrong.

The built-in function doesn’t require scanning.

I suggest reading this and taking a look at the code examples, that should help understand it better.
https://docs.fivem.net/scripting/#expanding-on-this

Feel free to DM me if you need some help.

Done, file is now standalone. Thank you.

1 Like

RegisterCommand can have the text under when you type it, you just have to add it :wink:

I fixed a bug that could allow non-admins to use the command. Please download the new edition!

the code is still the same… what did you change??

2 parentheses were screwing up the admin check. I removed them.

Can you make a custom sound i mean that you can convert a music or something in ogg ?

No, that is not supported by this resource.