[RELEASE] [abandoned] zetta64_discordlogs - Easy Discord logs using WebHooks!

ZETTA64 - DISCORD LOGGER

LOG EVERYTHING!


Script made for FiveM. It uses Discord WebHooks to log events in the form of embeds.


How to install:

  1. Download the resource
  2. Extract in your resources folder.
  3. Add ensure zetta64_discordlogs to your server.cfg

Configuration:

In the config.lua file of the resource you can customize certain options:

  • Config.whlink: default WebHook link. (Value: Discord WebHook URL).
  • Config.loginLog: whether to log when players join and leave or not (Value: true, false).
  • Config.loginLogLink: WebHook link where logins and leaves are logged. (Value: Discord WebHook URL). Only applies when Config.loginLog = true.
  • Config.whName: Name of the WebHook to display in Discord. (Value: Text String).
  • Config.whLogo: Avatar of the WebHook to display in Discord. (Value: Image URL).

Configure a new event:

In order to log more than players joining and leaving, you will need a little bit of knowledge about .lua strings and concats, as well as variables and events.

How to do it?

You will need to add this lines wherever you want to trigger a message.

 local whData = {
 link = 'https://discord.com/api/webhooks/*********',
 title = " This is a title ",
 color = 16774656,
 message = 'This is test message'
 }
 TriggerEvent('z64_logs:sendWebhook', whData)
  • link: The URL of the webhook i want to send the message. If not present, message will be sent to Config.whlink by default. (Discord WebHook URL)
  • title: The title of the embed message (Text string).
  • color: The color of the embed message line. (Decimal Value). I recommend using spycolor.com.
  • message: The message to be sent.

Result:

example1

Using variables and concatenating:

For example, i’m using d3x_vehicleshop script. And i want to log every vehicle is buyed by a player. I find the event where the vehicle is being saved as a personal vehicle and i add this:

 local whData = {
 link = 'https://discord.com/api/webhooks/*********'
 title = "CAR BUYED",
 color = 62207,
 message =
 '**[User]: **'..plyName..'\n'..
 '**[ID]: **'..xPlayer.identifier..'\n'..
 '**[Model]: **'..model..'\n'..
 '**[Plate]: **'..vehicleProps.plate..'\n'
 }
 TriggerEvent('z64_logs:sendWebhook', whData)

Which leads to this result:

example2

HOW?

If you know how to format Discord embeded messages you are halfway done.

Let’s see the message in one line:

'**[User]: **'..plyName..'\n'..'**[ID]: **'..xPlayer.identifier..'\n'..'**[Model]: **'..model..'\n'..'**[Plate]: **'..vehicleProps.plate..'\n' 

We start with **[User]: **, which is bold because it is inside asteriscs **. This is because formatting a message in Discord uses markdown

Then we used two dots .. to add something that is not text to the message, it is a variable.

  • plyName is defined earlier, which saves the Player Name, in my case, “carlos55ml”.

Two dots .. again to add some text to the string.

  • \n adds a line break in Discord, which forces to write the next character in the next line.

And then repeat all the proccess again to obtain the desired message.

As said before, to get this type of messages, a little bit of knowledge about .lua is required.

FAQ

  • What can i log?: Everything! Just find the event for it and add this:
 local whData = {
 title = " Your Title ",
 color = 16774656,
 message = 'Your message.'
 }
 TriggerEvent('z64_logs:sendWebhook', whData)
  • Does it have any default logs?: Yes. It can log players joins and leave if you want so.
  • Can I modify the format of the embed?: Sure! if you feel confident about it just go to the file z64_dl_server_main.lua and play around!
  • How can I create a new WebHook in my Discord Server?: Check this Official Discord Guide. Also check this one! Birdie0’s Guide.
  • What do I need in order to create a WebHook?: You need the right permissions in your Discord Server. manageWebhooksPermission
  • Is this updated?: Yes!
  • Does it need any other script?: No. This script has no dependencies.

DOWNLOAD:

Version: 1.4.2: zetta64_discordlogs-main.zip (16.3 KB)

Latest Version: GITHUB

15 Likes

Impressive, works properly :slight_smile:
Nice job!

1 Like

Thank you!!
I’m glad you like it.

Good Work :heart:

1 Like

Thank you! Glad you like it!

Wow amazing!
Nice job :partying_face:

1 Like

NEW VERSION - 1.3

  • Fix on message spam (i’m sorry, its fixed now).
  • Cleaner code.

zetta64_discordlogs-main.zip (16.3 KB)

Never have a file with webhooks stored on the client. Tis can be abused by server dumpers.

I recommend moving the config server sided instead of shared.

NEW VERSION - 1.4

  • config.lua is now on the server side. More secure option against server dumpers

DOWNLOAD:

Version 1.4: zetta64_discordlogs-main.zip (16.3 KB)

LATEST VERSION: GITHUB

1 Like

makes sense since config.lua is not needed on the client side. working on it!

Feel free to make a Pull Request on GITHUB.

1 Like

NEW VERSION 1.4.2

  • Some features were not working as intended. Fixed using a thread.

DOWNLOAD:

Version 1.4.2: zetta64_discordlogs-main.zip (16.3 KB)

LATEST VERSION: GITHUB

Not working :frowning:

what version are you using? what is the error and expected behavior?

1 Like

the last Version, und es_exte whit 1.1

is the code correct? is there any link set? any messages in console?
Please let me know what are you trying to do

I tried to do it in esx_carshop after that no vehicles are displayed anymore

show me your code if possible please.

Hi there! I wanted to create logs for when people buy cars, when they store stuff or remove stuff from their house or motels, stuff like this some custom logs, where do I add the code? To the server main.lua of the script I want to create the log for or the config.lua of your script?

you need to copy, paste, and modify the code provided in the readme.md, to yhe event you want to log.

For example if you want to log when players put or extract items of the house inventory, find the resource that is handling it, find the exact event of putting item or extracting item and paste the code. modify the message to your liking.

hope this helps!

1 Like

Thank you! I have been creating custom logs with your help and resource since yesterday lol, sometimes it can be a pain in the ass cus I got to find the exact word for the log to get like the quantity, sometimes its count sometimes its something diferent depends on the script I guess but hey, its been “do-able” haha

One more question, apart from steam identifier using xPlayer.identifier, how do I add more identifiers for the logs? Lets say I want the log to tell me their steam id, xboxlive id, fivem license etc, what “Phrase” like “xPlayer.identifier” do I need to add for it to grab those identifiers? If there is any cfx.re link that shows me that could you link me to it? Thank you very much!