This script is a logger for all commands executed from your server to your Discord :)
How create Discord Webook here
cd resources
git clone https://github.com/lucianfialhobp/discord_command_logger.git discord_command_logger
- Add this to your
server.cfg
:
ensure discord_command_logger
- Set discord settings in config.lua
Config.discordWebHookUrl = 'YOUR_WEBHOOK_YOU_SET_HERE'
Config.discordWebHookImage = 'YOUR_WEBHOOK_IMAGE_YOU_SET_HERE'
- Trigger
commandLoggerDiscord:commandWasExecuted
in resources/chat/cl_chat.lua:112 like this
RegisterNUICallback('chatResult', function(data, cb)
chatInputActive = false
SetNuiFocus(false)
if not data.canceled then
local id = PlayerId()
--deprecated
local r, g, b = 0, 0x99, 255
if data.message:sub(1, 1) == '/' then
ExecuteCommand(data.message:sub(2))
-- Trigger Event 'commandLoggerDiscord:commandWasExecuted' below like this
TriggerServerEvent('commandLoggerDiscord:commandWasExecuted', id, data)
else
TriggerServerEvent('_chat:messageEntered', GetPlayerName(id), { r, g, b }, data.message)
end
end
cb('ok')
end)