/me command - Use regex to replace formatting text

Uses regex to replace strings that match `<*>` and `~*~` in the `/me` command.
Regex: https://regex101.com/r/rrNMnx/1
This commit is contained in:
Ethan
2022-04-13 19:23:45 +12:00
parent d5280f32f2
commit 75a762f3e8
+1 -2
View File
@@ -256,8 +256,7 @@ QBCore.Commands.Add('me', 'Show local message', {{name = 'message', help = 'Mess
if #args < 1 then TriggerClientEvent('QBCore:Notify', source, Lang:t('error.missing_args2'), 'error') return end
local ped = GetPlayerPed(source)
local pCoords = GetEntityCoords(ped)
local msg = table.concat(args, ' ')
if string.match(msg, "<") then TriggerClientEvent('QBCore:Notify', source, Lang:t('error.wrong_format'), 'error') return end
local msg = table.concat(args, ' '):gsub('[~<].-[>~]', '')
local Players = QBCore.Functions.GetPlayers()
for i=1, #Players do
local Player = Players[i]