Forum Posts

CritteR
Standalone Dev
Standalone Dev
Jun 17, 2021
In FiveM Resources
You can use the following server-side code if you want to automatically send an "Unknown command" message if a user types a command that does not exist. AddEventHandler('chatMessage', function(Source, Name, Msg) args = stringsplit(Msg, " ") if string.find(args[1], "/") then CancelEvent() local cmd = args[1] table.remove(args, 1) local _message = "Unknown command." local _notif = {r = 255, g = 255, b = 0, author = "[Server]", text = _message} TriggerClientEvent("core.message", Source, _notif) end end) This will check for any message that starts with "/" and if that message is not a valid command, the user will receive a "Unknown command" message.
0
0
31

CritteR

Admin
Standalone Dev
From Day One
+4
More actions
  • GitHub-Mark-Light-32px
  • Twitter