Merge pull request #632 from Asaayu/main

Updates to the /me command
This commit is contained in:
Kakarot
2022-04-13 05:16:35 -07:00
committed by GitHub
+8 -7
View File
@@ -253,16 +253,17 @@ end, 'user')
-- Me command
QBCore.Commands.Add('me', 'Show local message', {{name = 'message', help = 'Message to respond with'}}, false, function(source, args)
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 msg == '' then return end
if string.match(msg, "<") then TriggerClientEvent('QBCore:Notify', source, Lang:t('error.wrong_format'), 'error') return end
for k,v in pairs(QBCore.Functions.GetPlayers()) do
local target = GetPlayerPed(v)
local msg = table.concat(args, ' '):gsub('[~<].-[>~]', '')
local Players = QBCore.Functions.GetPlayers()
for i=1, #Players do
local Player = Players[i]
local target = GetPlayerPed(Player)
local tCoords = GetEntityCoords(target)
if #(pCoords - tCoords) < 20 then
TriggerClientEvent('QBCore:Command:ShowMe3D', v, source, msg)
if target == ped or #(pCoords - tCoords) < 20 then
TriggerClientEvent('QBCore:Command:ShowMe3D', Player, source, msg)
end
end
end, 'user')