From ac2193dc0a8020371202b88d374f85f6217842d5 Mon Sep 17 00:00:00 2001 From: Lincon <59184093+ItsLincon@users.noreply.github.com> Date: Tue, 29 Sep 2020 02:18:07 +0200 Subject: [PATCH] Updated private messages to ESX 1.2 --- server/main.lua | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/server/main.lua b/server/main.lua index 6671e76d..21236cc1 100644 --- a/server/main.lua +++ b/server/main.lua @@ -44,6 +44,21 @@ RegisterCommand('do', function(playerId, args, rawCommand) end end, false) +RegisterCommand('msg', function(source, args, user) + + if GetPlayerName(tonumber(args[1])) then + local player = tonumber(args[1]) + table.remove(args, 1) + + TriggerClientEvent('chat:addMessage', player, {args = {"^1MSG de "..GetPlayerName(source).. "[" .. source .. "]: ^7" ..table.concat(args, " ")}, color = {255, 153, 0}}) + TriggerClientEvent('chat:addMessage', source, {args = {"^1MSG enviado a "..GetPlayerName(player).. "[" .. player .. "]: ^7" ..table.concat(args, " ")}, color = {255, 153, 0}}) + + else + TriggerClientEvent('chatMessage', source, "SYSTEM", {255, 0, 0}, "ID de jugador incorrecta!") + end + +end,false) + function GetRealPlayerName(playerId) local xPlayer = ESX.GetPlayerFromId(playerId)