mirror of
https://github.com/ENoir420/FIveM_Discord_Log.git
synced 2026-03-31 06:33:58 -04:00
Update Finale
This commit is contained in:
@@ -4,7 +4,7 @@ Config.AllLogs = true -- Attiva/Disattiva i logs
|
|||||||
Config.postal = false -- se lo setti False, non apparirà il civico di spawn
|
Config.postal = false -- se lo setti False, non apparirà il civico di spawn
|
||||||
Config.username = "Bot Log" -- Bot Username
|
Config.username = "Bot Log" -- Bot Username
|
||||||
Config.avatar = "https://placeholder.com/" -- Bot Avatar
|
Config.avatar = "https://placeholder.com/" -- Bot Avatar
|
||||||
Config.communtiyName = "" -- Nome al top embed
|
Config.communtiyName = "Phoenix RP" -- Nome al top embed
|
||||||
Config.communtiyLogo = "https://placeholder.com/" -- Icona al top embed
|
Config.communtiyLogo = "https://placeholder.com/" -- Icona al top embed
|
||||||
Config.FooterText = "2021 ENoir_420" -- Testo Footer per l' embed
|
Config.FooterText = "2021 ENoir_420" -- Testo Footer per l' embed
|
||||||
Config.FooterIcon = "https://placeholder.com/" -- Icona Footer per l' embed
|
Config.FooterIcon = "https://placeholder.com/" -- Icona Footer per l' embed
|
||||||
@@ -37,7 +37,7 @@ Config.webhooks = {
|
|||||||
joins = "https://discord.com/api/webhooks/855611628946456586/LoZmJUH3QzPjc-e_URfsFCLiS2NxTEr9M1A36dFPABSc2_5pPd7FD4NQnYoC0Xj1HLNA", -- Log-in Player
|
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
|
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
|
deaths = "https://discord.com/api/webhooks/855611853043793930/oCLMu6xZgbZ8O6vRoJ-SZYcCgB1fTbk8-34UNyf1rd-T2NenNxQC8Dw136TLykLIMW2I", -- Player che spara
|
||||||
shooting = "https://discord.com/api/webhooks/855611853043793930/oCLMu6xZgbZ8O6vRoJ-SZYcCgB1fTbk8-34UNyf1rd-T2NenNxQC8Dw136TLykLIMW2I", -- Player Morto
|
shooting = "DISCORD_WEBHOOK", -- Player Morto
|
||||||
resources = "https://discord.com/api/webhooks/855615988141391882/jHIpJptNwCMagtjvg2_txtjby535vhBygLj2DwCgxAdAfQlF0fQlPnTAcG9MULqG4dJf", -- Risorsa Startata/Stoppata
|
resources = "https://discord.com/api/webhooks/855615988141391882/jHIpJptNwCMagtjvg2_txtjby535vhBygLj2DwCgxAdAfQlF0fQlPnTAcG9MULqG4dJf", -- Risorsa Startata/Stoppata
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,16 +21,16 @@ end
|
|||||||
|
|
||||||
|
|
||||||
exports('discord', function(message, id, id2, color, channel)
|
exports('discord', function(message, id, id2, color, channel)
|
||||||
|
-- checking if export is used correctly
|
||||||
local _message = message
|
local _message = message
|
||||||
|
|
||||||
if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end
|
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_Logs Export. Invalid player id.^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_Logs Export. Invalid second 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_Logs Export. Invalid color.^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_Logs Export. Invalid channel.^0") return end
|
if channel == nil or channel == "" then print("^1Error: ENoir Export. Invalid channel.^0") return end
|
||||||
|
|
||||||
|
-- Check if hex or decimal color is used
|
||||||
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
|
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
|
||||||
|
|
||||||
if id2 ~= 0 then
|
if id2 ~= 0 then
|
||||||
@@ -388,56 +388,57 @@ function PluginDualPlayerLogs(message, color, field1, field2, channel)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Event Handlers
|
||||||
|
|
||||||
|
-- Send message when Player connects to the server.
|
||||||
AddEventHandler("playerConnecting", function(name, setReason, deferrals)
|
AddEventHandler("playerConnecting", function(name, setReason, deferrals)
|
||||||
SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta connettendo al server.', Config.BaseColors['Connessione'], source, 'Connessione')
|
SinglePlayerLogs('**' ..GetPlayerName(source).. '** si sta connettendo al server.', Config.BaseColors['log-in'], source, 'log-in')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when Player disconnects from the server
|
||||||
AddEventHandler('playerDropped', function(reason)
|
AddEventHandler('playerDropped', function(reason)
|
||||||
SinglePlayerLogs('**' ..GetPlayerName(source).. '** ha quittato il server. (Reason: ' .. reason .. ')', Config.BaseColors['Disconnesso'], source, 'Disconnesso')
|
SinglePlayerLogs('**' ..GetPlayerName(source).. '** si è disconnesso. (Reason: ' .. reason .. ')', Config.BaseColors['log-out'], source, 'log-out')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when Player creates a chat message (Does not show commands)
|
||||||
AddEventHandler('chatMessage', function(source, name, msg)
|
AddEventHandler('chatMessage', function(source, name, msg)
|
||||||
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** ha scritto in chat `' .. msg..'`', Config.BaseColors['chat'], source, 'chat')
|
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** ha scritto: `' .. msg..'`', Config.BaseColors['chat'], source, 'chat')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when Player died (including reason/killer check) (Not always working)
|
||||||
RegisterServerEvent('playerDied')
|
RegisterServerEvent('playerDied')
|
||||||
AddEventHandler('playerDied',function(id,player,killer,DeathReason, Weapon)
|
AddEventHandler('playerDied',function(id,player,killer,DeathReason, Weapon)
|
||||||
if Weapon == nil then _Weapon = "" else _Weapon = "`"..Weapon.."`" end
|
if Weapon == nil then _Weapon = "" else _Weapon = "`"..Weapon.."`" end
|
||||||
if id == 1 then
|
if id == 1 then -- Suicide/died
|
||||||
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** si è suicidato per colpa di '.._Weapon, Config.BaseColors['morte/suicidio'], source, 'morte/suicidio')
|
SinglePlayerLogs('**' .. sanitize(GetPlayerName(source)) .. '** si è suicidato con '.._Weapon, Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel
|
||||||
elseif id == 2 then
|
elseif id == 2 then -- Killed by other player
|
||||||
DualPlayerLogs('**' .. GetPlayerName(killer) .. '** è stato ucciso da ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['morte/suicidio'], killer, source, 'morte/suicidio')
|
DualPlayerLogs('**' .. GetPlayerName(killer) .. '** è stato ucciso da ' .. GetPlayerName(source).. ' `('.._Weapon..')`', Config.BaseColors['deaths'], killer, source, 'deaths') -- sending to deaths channel
|
||||||
else
|
else -- When gets killed by something else
|
||||||
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** `è morto per colpa di`', Config.BaseColors['morte/suicidio'], source, 'morte/suicidio')
|
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** è morto', Config.BaseColors['deaths'], source, 'deaths') -- sending to deaths channel
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when Player fires a weapon
|
||||||
RegisterServerEvent('playerShotWeapon')
|
RegisterServerEvent('playerShotWeapon')
|
||||||
AddEventHandler('playerShotWeapon', function(weapon)
|
AddEventHandler('playerShotWeapon', function(weapon)
|
||||||
local info = GetPlayerDetails(source)
|
local info = GetPlayerDetails(source)
|
||||||
if Config.weaponLog then
|
if Config.weaponLog then
|
||||||
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** ha sparato con `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting')
|
SinglePlayerLogs('**' .. GetPlayerName(source) .. '** ha sparato con la seguente arma `' .. weapon .. '`', Config.BaseColors['shooting'], source, 'shooting')
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Getting exports from clientside
|
||||||
RegisterServerEvent('ClientDiscord')
|
RegisterServerEvent('ClientDiscord')
|
||||||
AddEventHandler('ClientDiscord', function(message, id, id2, color, channel)
|
AddEventHandler('ClientDiscord', function(message, id, id2, color, channel)
|
||||||
local _message = message
|
local _message = message
|
||||||
|
|
||||||
if message == nil then print("^1Error: ENoir_Logs Export. Invalid message.^0") return end
|
if message == nil then print("^1Error: JD_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 id == "PLAYER_ID" or not tonumber(id) then print("^1Error: JD_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 id == nil or id2 == "PLAYER_2_ID" or not tonumber(id2) then print("^1Error: JD_Logs Export. Invalid second player id.^0") return end
|
||||||
if color == nil then print("^1Error: ENoir_Logs Export. Invalid color.^0") return end
|
if color == nil then print("^1Error: JD_Logs Export. Invalid color.^0") return end
|
||||||
if channel == nil or channel == "" then print("^1Error: Enoir_Logs Export. Invalid channel.^0") return end
|
if channel == nil or channel == "" then print("^1Error: JD_Logs Export. Invalid channel.^0") return end
|
||||||
|
|
||||||
|
-- Check if hex or decimal color is used
|
||||||
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
|
if string.find(color,"#") then _color = tonumber(color:gsub("#",""),16) else _color = color end
|
||||||
|
|
||||||
if id2 ~= 0 then
|
if id2 ~= 0 then
|
||||||
@@ -451,15 +452,15 @@ AddEventHandler('ClientDiscord', function(message, id, id2, color, channel)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when a resource is being stopped
|
||||||
AddEventHandler('onResourceStop', function (resourceName)
|
AddEventHandler('onResourceStop', function (resourceName)
|
||||||
HidePlayerDetails('**' .. resourceName .. '** è stata stoppata.', Config.BaseColors['resources'], 'resources')
|
HidePlayerDetails('** è stata stoppata la seguente risorsa ' .. resourceName .. '**', Config.BaseColors['resources'], 'resources')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
-- Send message when a resource is being started
|
||||||
AddEventHandler('onResourceStart', function (resourceName)
|
AddEventHandler('onResourceStart', function (resourceName)
|
||||||
Wait(100)
|
Wait(100)
|
||||||
HidePlayerDetails('**' .. resourceName .. '** è stata startata.', Config.BaseColors['resources'], 'resources')
|
HidePlayerDetails('** è stata startata la seguente risorsa ' .. resourceName .. '**', Config.BaseColors['resources'], 'resources')
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function GetPlayerDetails(src)
|
function GetPlayerDetails(src)
|
||||||
|
|||||||
Reference in New Issue
Block a user