diff --git a/server-data/resources/[esx_addons]/esx_rpchat/LICENSE b/server-data/resources/[esx_addons]/esx_rpchat/LICENSE index ad893f36b..30750b2ce 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/LICENSE +++ b/server-data/resources/[esx_addons]/esx_rpchat/LICENSE @@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. esx_rpchat - Copyright (C) 2015-2022 Jérémie N'gadi + Copyright (C) 2015-2024 Jérémie N'gadi This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - esx_rpchat Copyright (C) 2015-2022 Jérémie N'gadi + esx_rpchat Copyright (C) 2015-2024 Jérémie N'gadi This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/server-data/resources/[esx_addons]/esx_rpchat/README.md b/server-data/resources/[esx_addons]/esx_rpchat/README.md index 4a053b936..5f0ec2262 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/README.md +++ b/server-data/resources/[esx_addons]/esx_rpchat/README.md @@ -1,14 +1,12 @@ -
Discord - Website - Documentation +
Discord - Documentation -This Resource adds a proximity chat along with a few cool commands such as `/me` , `/ooc` - -> *Note: Elon Musk Not Included* +This Resource adds a proximity chat along with a few cool commands such as `/me` , `/ooc` and `/twt` # Legal esx_rpchat - Chat closely with your friends. -Copyright (C) 2015-2022 Jérémie N'gadi +Copyright (C) 2015-2024 Jérémie N'gadi This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/server-data/resources/[esx_addons]/esx_rpchat/client/main.lua b/server-data/resources/[esx_addons]/esx_rpchat/client/main.lua index 26fd8f271..022bd1ec0 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/client/main.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/client/main.lua @@ -1,16 +1,31 @@ RegisterNetEvent("esx_rpchat:sendProximityMessage") AddEventHandler("esx_rpchat:sendProximityMessage", function(playerId, title, message, color) - local player = PlayerId() - local target = GetPlayerFromServerId(playerId) + local player = PlayerId() + local target = GetPlayerFromServerId(playerId) - local playerPed = PlayerPedId() - local targetPed = GetPlayerPed(target) - local playerCoords = GetEntityCoords(playerPed) - local targetCoords = GetEntityCoords(targetPed) + local playerPed = PlayerPedId() + local targetPed = GetPlayerPed(target) + local playerCoords = GetEntityCoords(playerPed) + local targetCoords = GetEntityCoords(targetPed) - if target ~= -1 then - if target == player or #(playerCoords - targetCoords) < 20 then - TriggerEvent("chat:addMessage", { args = { title, message }, color = color }) - end - end + if target ~= -1 then + if target == player or #(playerCoords - targetCoords) < 20 then + TriggerEvent("chat:addMessage", { args = { title, message }, color = color }) + end + end +end) + +CreateThread(function() + TriggerEvent("chat:addSuggestion", "/twt", TranslateCap("twt_help"), { { name = TranslateCap("generic_argument_name"), help = TranslateCap("generic_argument_help") } }) + TriggerEvent("chat:addSuggestion", "/anontwt", TranslateCap("twtanon_help"), { { name = TranslateCap("generic_argument_name"), help = TranslateCap("generic_argument_help") } }) + TriggerEvent("chat:addSuggestion", "/me", TranslateCap("me_help"), { { name = TranslateCap("generic_argument_name"), help = TranslateCap("generic_argument_help") } }) + TriggerEvent("chat:addSuggestion", "/do", TranslateCap("do_help"), { { name = TranslateCap("generic_argument_name"), help = TranslateCap("generic_argument_help") } }) +end) + +AddEventHandler("onResourceStop", function(resource) + if resource == GetCurrentResourceName() then + TriggerEvent("chat:removeSuggestion", "/twt") + TriggerEvent("chat:removeSuggestion", "/me") + TriggerEvent("chat:removeSuggestion", "/do") + end end) diff --git a/server-data/resources/[esx_addons]/esx_rpchat/config.lua b/server-data/resources/[esx_addons]/esx_rpchat/config.lua index a9cd56baf..e060675d2 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/config.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/config.lua @@ -1,5 +1,5 @@ Config = {} -Config.Locale = "it" +Config.Locale = GetConvar("esx:locale", "it") Config.OnlyFirstname = false -Config.EnableESXIdentity = true -- RP names +Config.EnableESXIdentity = false -- RP names diff --git a/server-data/resources/[esx_addons]/esx_rpchat/fxmanifest.lua b/server-data/resources/[esx_addons]/esx_rpchat/fxmanifest.lua index 8387cd269..0549f64d8 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/fxmanifest.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/fxmanifest.lua @@ -2,9 +2,10 @@ fx_version("adamant") game("gta5") -description("ESX RP Chat") +description("Adds Command for RP, such as: /me, /do, /OOC and more") +lua54("yes") -version("1.0.0") +version("1.0.1") shared_script("@es_extended/imports.lua") diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/cs.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/cs.lua deleted file mode 100644 index 16a17c710..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/cs.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["cs"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "zpráva", - ["generic_argument_help"] = "zpráva", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/de.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/de.lua deleted file mode 100644 index 1a4ee9763..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/de.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["de"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "Nachricht", - ["generic_argument_help"] = "Die Nachricht", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/el.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/el.lua deleted file mode 100644 index f3d49bd8b..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/el.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["el"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "Μήνυμα", - ["generic_argument_help"] = "Το μήνυμα", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/en.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/en.lua index 96e7fb41e..ac0f00157 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/en.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/locales/en.lua @@ -1,5 +1,11 @@ Locales["en"] = { ["ooc_prefix"] = "OOC | %s", + ["twt_help"] = "send a tweet", + ["twt_prefix"] = "^0[^4Twitter^0] (^5@%s^0)", + ["me_help"] = "personal action", + ["me_prefix"] = "me | %s", + ["do_help"] = "RP information", + ["do_prefix"] = "do | %s", ["generic_argument_name"] = "message", ["generic_argument_help"] = "the message", } diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/es.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/es.lua deleted file mode 100644 index 3a7168022..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/es.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["es"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "mensaje", - ["generic_argument_help"] = "el mensaje", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/fi.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/fi.lua deleted file mode 100644 index e5ede4c4d..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/fi.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["fi"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "viesti", - ["generic_argument_help"] = "viestin sisältö", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/fr.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/fr.lua deleted file mode 100644 index efa156ee0..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/fr.lua +++ /dev/null @@ -1,4 +0,0 @@ -Locales["fr"] = { - ["generic_argument_name"] = "message", - ["generic_argument_help"] = "le message", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/hu.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/hu.lua deleted file mode 100644 index e5d8539fd..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/hu.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["hu"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "üzenet", - ["generic_argument_help"] = "az üzenet", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/it.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/it.lua index 494d53955..ffd1ca654 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/it.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/locales/it.lua @@ -1,5 +1,11 @@ Locales["it"] = { ["ooc_prefix"] = "OOC | %s", + ["twt_help"] = "Invia tweet", + ["twt_prefix"] = "^0[^4Twitter^0] (^5@%s^0)", + ["me_help"] = "Azione Personale", + ["me_prefix"] = "me | %s", + ["do_help"] = "Azione RP", + ["do_prefix"] = "fa | %s", ["generic_argument_name"] = "Messaggio", ["generic_argument_help"] = "il messaggio", } diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/nl.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/nl.lua deleted file mode 100644 index cda2a1a92..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/nl.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["nl"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "bericht", - ["generic_argument_help"] = "het bericht", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/pl.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/pl.lua deleted file mode 100644 index 6f46a55ce..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/pl.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["pl"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "wiadomość", - ["generic_argument_help"] = "wysyłana wiadomość", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/sl.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/sl.lua deleted file mode 100644 index a7101ef7b..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/sl.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["sl"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "sporocilo", - ["generic_argument_help"] = "sporocilo", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/locales/sr.lua b/server-data/resources/[esx_addons]/esx_rpchat/locales/sr.lua deleted file mode 100644 index 00dde5d1f..000000000 --- a/server-data/resources/[esx_addons]/esx_rpchat/locales/sr.lua +++ /dev/null @@ -1,5 +0,0 @@ -Locales["sr"] = { - ["ooc_prefix"] = "OOC | %s", - ["generic_argument_name"] = "poruka", - ["generic_argument_help"] = "poruka", -} diff --git a/server-data/resources/[esx_addons]/esx_rpchat/server/main.lua b/server-data/resources/[esx_addons]/esx_rpchat/server/main.lua index 860aacd6d..8e7e6fcd9 100644 --- a/server-data/resources/[esx_addons]/esx_rpchat/server/main.lua +++ b/server-data/resources/[esx_addons]/esx_rpchat/server/main.lua @@ -1,13 +1,70 @@ -AddEventHandler("chatMessage", function(playerId, _, message) +AddEventHandler("chatMessage", function(playerId, playerName, message) if string.sub(message, 1, string.len("/")) ~= "/" then CancelEvent() - local playerName playerName = GetRealPlayerName(playerId) - TriggerClientEvent("chat:addMessage", -1, { args = { _U("ooc_prefix", playerName), message }, color = { 128, 128, 128 } }) + TriggerClientEvent("chat:addMessage", -1, { args = { TranslateCap("ooc_prefix", playerName), message }, color = { 128, 128, 128 } }) end end) +RegisterCommand("twt", function(playerId, args, rawCommand) + if playerId == 0 then + print("[^1ERROR^7] This Command Cannot Be Used By The Console!") + else + args = table.concat(args, " ") + + local playerName = GetRealPlayerName(playerId) + + TriggerClientEvent("chat:addMessage", -1, { args = { TranslateCap("twt_prefix", playerName), args }, color = { 0, 153, 204 } }) + end +end, false) + +RegisterCommand("anontwt", function(playerId, args, rawCommand) + if playerId == 0 then + print("[^1ERROR^7] This Command Cannot Be Used By The Console!") + else + args = table.concat(args, " ") + + local playerName = GetRealPlayerName(playerId) + + TriggerClientEvent("chat:addMessage", -1, { args = { TranslateCap("twt_prefix", "Anonymous"), args }, color = { 0, 153, 204 } }) + end +end, false) + +RegisterCommand("me", function(playerId, args, rawCommand) + if playerId == 0 then + print("[^1ERROR^7] This Command Cannot Be Used By The Console!") + else + args = table.concat(args, " ") + local playerName = GetRealPlayerName(playerId) + + TriggerClientEvent("esx_rpchat:sendProximityMessage", -1, playerId, TranslateCap("me_prefix", playerName), args, { 255, 0, 0 }) + end +end, false) + +RegisterCommand("do", function(playerId, args, rawCommand) + if playerId == 0 then + print("[^1ERROR^7] This Command Cannot Be Used By The Console!") + else + args = table.concat(args, " ") + local playerName = GetRealPlayerName(playerId) + + TriggerClientEvent("esx_rpchat:sendProximityMessage", -1, playerId, TranslateCap("do_prefix", playerName), args, { 0, 0, 255 }) + 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 = { "^1PM from " .. GetPlayerName(source) .. "[" .. source .. "]: ^7" .. table.concat(args, " ") }, color = { 255, 153, 0 } }) + TriggerClientEvent("chat:addMessage", source, { args = { "^1PM SEND TO " .. GetPlayerName(player) .. "[" .. player .. "]: ^7" .. table.concat(args, " ") }, color = { 255, 153, 0 } }) + else + TriggerClientEvent("chatMessage", source, "SYSTEM", { 255, 0, 0 }, "Specified Player Does Not Exist!") + end +end, false) + function GetRealPlayerName(playerId) local xPlayer = ESX.GetPlayerFromId(playerId) @@ -19,7 +76,7 @@ function GetRealPlayerName(playerId) return xPlayer.getName() end else - return xPlayer.getName() + return GetPlayerName(playerId) end else return GetPlayerName(playerId)