diff --git a/server/commands.lua b/server/commands.lua index 3200e7a..67b2c8c 100644 --- a/server/commands.lua +++ b/server/commands.lua @@ -258,11 +258,13 @@ QBCore.Commands.Add('me', 'Show local message', {{name = 'message', help = 'Mess 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 - for k,v in pairs(QBCore.Functions.GetPlayers()) do - local target = GetPlayerPed(v) + 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')