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)