From a8cb3cb554f7414aa8e496f9cdba35c8d0c7dc2c Mon Sep 17 00:00:00 2001 From: ENoir420 <70651562+ENoir420@users.noreply.github.com> Date: Sat, 19 Jun 2021 13:49:16 +0200 Subject: [PATCH] Update 19.06.2021 --- README.md | 149 --------------------------- client/client.lua | 2 +- config.lua | 68 ++++++------ fxmanifest.lua | 9 +- plugins/server/NameChange/names.json | 4 +- server/server.lua | 50 +++++---- 6 files changed, 65 insertions(+), 217 deletions(-) delete mode 100644 README.md diff --git a/README.md b/README.md deleted file mode 100644 index 104b82b..0000000 --- a/README.md +++ /dev/null @@ -1,149 +0,0 @@ -

- JOIN THE DISCORD FOR SUPPORT -

- - - -

- Licence - Licence - Discord Status -

- -

-This is a server log script for FiveM, which is used to log certain actions that are being made in the server. -

- -### πŸ›  Requirements -- A Discord Server -- FXServer - -### βœ… Main Features -- Basic logs: - - Chat Logs (Messages typed in chat) - - Join Logs (When i player is connecting to the sever) - - Leave Logs (When a player disconnects from the server) - - Death Logs (When a player dies/get killed) - - Shooting Logs (When a player fires a weapon) - - Resource Logs (When a resouce get started/stopped) -- Plugin Support - - Easy way to add more logs to JD_logs with plugins. (More plugins will be released soon!) -- Optional custom logs - - Easy to add with the export. - -### πŸ”§ Download & Installation - -1. Download the files -2. Put the JD_logs folder in the server resource directory -3. Add this to your `server.cfg` -``` -ensure JD_logs -``` - -### πŸ“ Creating Custom Logs - -1. Add the following code to your function/command.
-*This code needs to be added in the resource of the action you want to log.* -``` -exports.JD_logs:discord('EMBED_MESSAGE', PLAYER_ID, PLAYER_2_ID, 'COLOR', 'WEBHOOK_CHANNEL') -``` -`EMBED_MESSAGE`: This will be the message send in the top of the embed.
-`PLAYER_ID`: This will send the player to the script to get the info. (This needs to be a server id)
-`PLAYER_2_ID`: This will send the second player's to the script to get the info. (This needs to be a server id)
-`COLOR`: This will be the color of the embed. (You can use Decimal colors or Hex colors.)
-`WEBHOOK_CHANNEL`: This will be the webhook channel listed in the config.lua.
- - -2. Create a discord channel with webhook and add this to the webhooks. -``` -local webhooks = { - all = "DISCORD_WEBHOOK", - chat = "DISCORD_WEBHOOK", - joins = "DISCORD_WEBHOOK", - leaving = "DISCORD_WEBHOOK", - deaths = "DISCORD_WEBHOOK", - shooting = "DISCORD_WEBHOOK", - resources = "DISCORD_WEBHOOK", - WEBHOOK_CHANNEL = "DISCORD_WEBHOOK", <------ -} -``` -*This can be found in the `config.lua`* - -### ❓ For more questions you can join the discord here: https://discord.gg/m4BvmkG - -
- πŸ“¦ Change Log -
- -
-V1.3.0 -β€’ Added Plugin Support
-
-V1.1.6 -β€’ Fixed Death logs issue
-
-
-V1.1.5 -β€’ Bug fix/code clean up
-
-
-V1.1.4 -β€’ Bug fixes
-
-
-V1.1.3 -β€’ Bug fixes
-
-
-V1.1.2 -β€’ Added: License Identifier Config.license = true
-β€’ Added: Player IP address Config.IP = true
-
-
-V1.1.1 -β€’ Added hex color code support. (Old decimal color codes will still work.)
-β€’ Added option to hide player info on exports. (Very simple just change the PLAYER_ID to 0 and it wont show any info.) -
-
-V1.1.0 -β€’ Reworked Export function. (Now with identifier support)
-
-
-V1.0.4 -β€’ Added Nearest Postal For This Postal Map
-β€’ Added check if the identifier is available ( Prevents some errors :slight_smile: )
-β€’ Fixed some small bugs
-
-
-V1.0.3 -β€’ Added Discord Identifier
-β€’ Added Steam Profile URL
-β€’ Fixed Death Reason
-β€’ Player commited suicide
-β€’ Player was murdered
-β€’ Player Died (Other reasons like getting run over or random explosions)
-
-
-V1.0.2 -β€’ Added more Customizations
-  β€’ Bot's Username
-  β€’ Bot's Avatar
-  β€’ Embed Community Name
-  β€’ Embed Community Logo
-β€’ Color settings for default Events
-β€’ Added Player ID to default Events
-β€’ Added Option to enable/disable Player ID
-β€’ Added option to enable/disable Steam ID
-
-
-V1.0.1 -β€’ Added option to disable Shooting Logs
-
-
-V1.0.0 -β€’ All log channel
-β€’ Log to seperate channels
-β€’ Log from server or client side
-β€’ Easy changeble Avatar and Username
-
- diff --git a/client/client.lua b/client/client.lua index 4743920..61123ac 100644 --- a/client/client.lua +++ b/client/client.lua @@ -370,6 +370,6 @@ end function ShowDebug(text) SetNotificationTextEntry("STRING") - AddTextComponentSubstringPlayerName("~b~JD_logs Debug:~s~\n"..text) + AddTextComponentSubstringPlayerName("~bENoir_logs Debug:~s~\n"..text) DrawNotification(true, true) end diff --git a/config.lua b/config.lua index fd11dcc..b4be9a9 100644 --- a/config.lua +++ b/config.lua @@ -1,53 +1,53 @@ Config = {} -Config.AllLogs = true -- Attiva/Disattiva tutti i Log -Config.postal = false -- Attiva/Disattiva il civico nei Log -Config.username = "Bot Username Here" -- Bot Username -Config.avatar = "https://via.placeholder.com/30x30" -- Bot Avatar -Config.communtiyName = "Community Name Here" -- Icon top of the embed -Config.communtiyLogo = "https://via.placeholder.com/30x30" -- Icon top of the embed -Config.FooterText = "2021 ENoir" -- Footer text for the embed -Config.FooterIcon = "https://via.placeholder.com/30x30" -- Footer icon for the embed +Config.AllLogs = true -- Attiva/Disattiva i logs +Config.postal = false -- se lo setti False, non apparirΓ  il civico di spawn +Config.username = "Bot Log" -- Bot Username +Config.avatar = "https://placeholder.com/" -- Bot Avatar +Config.communtiyName = "" -- Nome al top embed +Config.communtiyLogo = "https://placeholder.com/" -- Icona al top embed +Config.FooterText = "2021 ENoir_420" -- Testo Footer per l' embed +Config.FooterIcon = "https://placeholder.com/" -- Icona Footer per l' embed -Config.weaponLog = true -- set to false to disable the shooting weapon logs -Config.InlineFields = true -- set to false if you don't want the player details next to each other +Config.weaponLog = true -- setta False per disabilitare i colpi d'arma da fuoco log +Config.InlineFields = true -- setta False per disabilitare i dettagli dei player -Config.playerID = true -- set to false to disable Player ID in the logs -Config.steamID = true -- set to false to disable Steam ID in the logs -Config.steamURL = true -- set to false to disable Steam URL in the logs -Config.discordID = true -- set to false to disable Discord ID in the logs -Config.license = true -- set to false to disable license in the logs -Config.IP = true -- set to false to disable IP in the logs +Config.playerID = false -- setta False per disabilitare il Player ID nei Log +Config.steamID = true -- setta False per disabilitare lo Steam ID nei Log +Config.steamURL = false -- setta False per disabilitare lo URL Steam nei Log +Config.discordID = true -- setta False per disabilitare il Discord ID nei Log +Config.license = false -- setta False per disabilitare il numero di licenza nei Log +Config.IP = false -- setta False per disabilitare l'indirizzo IP nei Log Config.BaseColors ={ chat = "#A1A1A1", -- Chat Message - joins = "#3AF241", -- Player Connecting - leaving = "#F23A3A", -- Player Disconnected - deaths = "#000000", -- Shooting a weapon - shooting = "#2E66F2", -- Player Died - resources = "#EBEE3F", -- Resource Stopped/Started + joins = "#3AF241", -- Log-in Player + leaving = "#F23A3A", -- Log-out Player + deaths = "#000000", -- Player che spara + shooting = "#2E66F2", -- Player Morto + resources = "#EBEE3F", -- Risorsa Startata/Stoppata } Config.webhooks = { - all = "DISCORD_WEBHOOK", -- All logs will be send to this channel + all = "DISCORD_WEBHOOK", -- Tutti i log in un unico canale chat = "https://discord.com/api/webhooks/855611974058377228/xeXRIc7eexnm9Ys7lAdtsWdpANQ9Usg-6hloMK_8w92gTDjBY1T_ezjAnc4ydgdGcppc", -- Chat Message - joins = "https://discord.com/api/webhooks/855611628946456586/LoZmJUH3QzPjc-e_URfsFCLiS2NxTEr9M1A36dFPABSc2_5pPd7FD4NQnYoC0Xj1HLNA", -- Player Connecting - leaving = "https://discord.com/api/webhooks/855611628946456586/LoZmJUH3QzPjc-e_URfsFCLiS2NxTEr9M1A36dFPABSc2_5pPd7FD4NQnYoC0Xj1HLNA", -- Player Disconnected - deaths = "https://discord.com/api/webhooks/855611853043793930/oCLMu6xZgbZ8O6vRoJ-SZYcCgB1fTbk8-34UNyf1rd-T2NenNxQC8Dw136TLykLIMW2I", -- Shooting a weapon - shooting = "DISCORD_WEBHOOK", -- Player Died - resources = "https://discord.com/api/webhooks/855615988141391882/jHIpJptNwCMagtjvg2_txtjby535vhBygLj2DwCgxAdAfQlF0fQlPnTAcG9MULqG4dJf", -- Resource Stopped/Started + joins = "https://discord.com/api/webhooks/855611628946456586/LoZmJUH3QzPjc-e_URfsFCLiS2NxTEr9M1A36dFPABSc2_5pPd7FD4NQnYoC0Xj1HLNA", -- Log-in Player + leaving = "https://discord.com/api/webhooks/855611628946456586/LoZmJUH3QzPjc-e_URfsFCLiS2NxTEr9M1A36dFPABSc2_5pPd7FD4NQnYoC0Xj1HLNA", -- Log-out Player + deaths = "https://discord.com/api/webhooks/855611853043793930/oCLMu6xZgbZ8O6vRoJ-SZYcCgB1fTbk8-34UNyf1rd-T2NenNxQC8Dw136TLykLIMW2I", -- Player che spara + shooting = "DISCORD_WEBHOOK", -- Player Morto + resources = "https://discord.com/api/webhooks/855615988141391882/jHIpJptNwCMagtjvg2_txtjby535vhBygLj2DwCgxAdAfQlF0fQlPnTAcG9MULqG4dJf", -- Risorsa Startata/Stoppata } Config.TitleIcon = { chat = "πŸ’¬", -- Chat Message - joins = "πŸ“₯", -- Player Connecting - leaving = "πŸ“€", -- Player Disconnected - deaths = "πŸ’€", -- Shooting a weapon - shooting = "πŸ”«", -- Player Died - resources = "πŸ”§", -- Resource Stopped/Started + joins = "πŸ“₯", -- Log-in Player + leaving = "πŸ“€", -- Log-out Player + deaths = "πŸ’€", -- Player che spara + shooting = "πŸ”«", -- Player Morto + resources = "πŸ”§", -- Risorsa Startata/Stoppata } Config.Plugins = { @@ -56,6 +56,6 @@ Config.Plugins = { } - + Config.debug = false -Config.versionCheck = "1.3.0" +Config.versionCheck = "1.0.0" diff --git a/fxmanifest.lua b/fxmanifest.lua index a69e3b8..d9b24ce 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,17 +1,18 @@ -author 'ENoir_420' +author 'ENoir' description 'FXServer logs to Discord' version '1.0.0' --- Config + + server_script 'config.lua' --- Server Scripts + server_scripts { 'server/server.lua', 'plugins/server/**/*.lua' } ---Client Scripts + client_scripts { 'client/client.lua', 'plugins/client/**/*.lua' diff --git a/plugins/server/NameChange/names.json b/plugins/server/NameChange/names.json index 37bf999..da54778 100644 --- a/plugins/server/NameChange/names.json +++ b/plugins/server/NameChange/names.json @@ -1,3 +1 @@ -{ - "steam:123456789123456": "JokeDevil" -} \ No newline at end of file +{"steam:1100001112ce4d0":"BanHammer"} \ No newline at end of file diff --git a/server/server.lua b/server/server.lua index d5f264b..4b20b5d 100644 --- a/server/server.lua +++ b/server/server.lua @@ -24,11 +24,11 @@ exports('discord', function(message, id, id2, color, channel) local _message = message - if message == nil then print("^1Error: Enoir Export. Invalid message.^0") return end - if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir Export. Invalid player id.^0") return end - if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir Export. Invalid second player id.^0") return end - if color == nil then print("^1Error: ENoir Export. Invalid color.^0") return end - if channel == nil or channel == "" then print("^1Error: ENoir Export. Invalid channel.^0") return end + if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end + if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir_Logs Export. Invalid player id.^0") return end + if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir_Logs Export. Invalid second player id.^0") return end + if color == nil then print("^1Error: ENoir_Logs Export. Invalid color.^0") return end + if channel == nil or channel == "" then print("^1Error: ENoir_Logs Export. Invalid channel.^0") return end if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end @@ -390,31 +390,30 @@ end - AddEventHandler("playerConnecting", function(name, setReason, deferrals) - SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta collegando al server.', Config.BaseColors['Connessione'], source, 'Connessione') + SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta connettendo al server.', Config.BaseColors['Connessione'], source, 'Connessione') end) AddEventHandler('playerDropped', function(reason) - SinglePlayerLogs('**' ..GetPlayerName(source).. '** Γ¨ uscito dal server. (Reason: ' .. reason .. ')', Config.BaseColors['Uscita'], source, 'Uscita') + SinglePlayerLogs('**' ..GetPlayerName(source).. '** ha quittato il server. (Reason: ' .. reason .. ')', Config.BaseColors['Disconnesso'], source, 'Disconnesso') end) --- Send message when Player creates a chat message (Does not show commands) + AddEventHandler('chatMessage', function(source, name, msg) - SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '**: `' .. msg..'`', Config.BaseColors['chat'], source, 'chat') + SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** ha scritto in chat `' .. msg..'`', Config.BaseColors['chat'], source, 'chat') end) --- Send message when Player died (including reason/killer check) (Not always working) + RegisterServerEvent('playerDied') AddEventHandler('playerDied',function(id,player,killer,DeathReason, Weapon) if Weapon == nil then _Weapon = "" else _Weapon = "`"..Weapon.."`" end - if id == 1 then -- Suicide/died - SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** `'..DeathReason..'` '.._Weapon, Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel - elseif id == 2 then -- Killed by other player - DualPlayerLogs('**' .. GetPlayerName(killer) .. '** Γ¨ stato ucciso da'..DeathReason..' ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['deaths'], killer, source, 'deaths') - else -- When gets killed by something else - SinglePlayerLogs('**' .. GetPlayerName(source) .. '** `died`', Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel + if id == 1 then + SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** si Γ¨ suicidato per colpa di '.._Weapon, Config.BaseColors['morte/suicidio'], source, 'morte/suicidio') + elseif id == 2 then + DualPlayerLogs('**' .. GetPlayerName(killer) .. '** Γ¨ stato ucciso da ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['morte/suicidio'], killer, source, 'morte/suicidio') + else + SinglePlayerLogs('**' .. GetPlayerName(source) .. '** `Γ¨ morto per colpa di`', Config.BaseColors['morte/suicidio'], source, 'morte/suicidio') end end) @@ -423,7 +422,7 @@ RegisterServerEvent('playerShotWeapon') AddEventHandler('playerShotWeapon', function(weapon) local info = GetPlayerDetails(source) if Config.weaponLog then - SinglePlayerLogs('**' .. GetPlayerName(source) .. '** a sparato con `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting') + SinglePlayerLogs('**' .. GetPlayerName(source) .. '** ha sparato con `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting') end end) @@ -432,11 +431,11 @@ RegisterServerEvent('ClientDiscord') AddEventHandler('ClientDiscord', function(message, id, id2, color, channel) local _message = message - if message == nil then print("^1Error: ENoir Export. Invalid message.^0") return end - if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir Export. Invalid player id.^0") return end - if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir Export. Invalid second player id.^0") return end - if color == nil then print("^1Error: ENoir Export. Invalid color.^0") return end - if channel == nil or channel == "" then print("^1Error: ENoir Export. Invalid channel.^0") return end + if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end + if id == nil or id == "PLAYER_ID" or not tonumber(id) then print("^1Error: ENoir_Logs Export. Invalid player id.^0") return end + if id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: ENoir_Logs Export. Invalid second player id.^0") return end + if color == nil then print("^1Error: ENoir_Logs Export. Invalid color.^0") return end + if channel == nil or channel == "" then print("^1Error: Enoir_Logs Export. Invalid channel.^0") return end if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end @@ -454,13 +453,13 @@ end) AddEventHandler('onResourceStop', function (resourceName) - HidePlayerDetails('** Γ¨ stata stoppata la seguente risorsa' '**' .. resourceName .. , Config.BaseColors['risorse server'], 'risorse server') + HidePlayerDetails('**' .. resourceName .. '** Γ¨ stata stoppata.', Config.BaseColors['resources'], 'resources') end) AddEventHandler('onResourceStart', function (resourceName) Wait(100) - HidePlayerDetails('** Γ¨ stata startata la seguente risorsa' '**' .. resourceName .. , Config.BaseColors['risorse server'], 'risorse server') + HidePlayerDetails('**' .. resourceName .. '** Γ¨ stata startata.', Config.BaseColors['resources'], 'resources') end) function GetPlayerDetails(src) @@ -549,4 +548,3 @@ end function firstToUpper(str) return (str:gsub("^%l", string.upper)) end -