From 75a762f3e8831f3b4d7a6c8099cce6ecb628cbf2 Mon Sep 17 00:00:00 2001 From: Ethan Date: Wed, 13 Apr 2022 19:23:45 +1200 Subject: [PATCH] /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 --- server/commands.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/commands.lua b/server/commands.lua index 67b2c8c..125a1ea 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -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]