LOG EVERYTHING!


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


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

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).

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)

Outcome:

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 .. so as to add one thing that isn’t textual content to the message, it’s a variable.

  • plyName is outlined earlier, which saves the Participant Title, in my case, “carlos55ml”.

Two dots .. once more so as to add some textual content to the string.

  • n provides a line break in Discord, which forces to put in writing the subsequent character within the subsequent line.

After which repeat all of the proccess once more to acquire the specified message.

As mentioned earlier than, to get one of these messages, somewhat bit of information about .lua is required.

  • What am i able to log?: Every little thing! Simply discover the occasion for it and add this:
 native whData = {
 title = " Your Title ",
 coloration = 16774656,
 message="Your message."
 }
 TriggerEvent('z64_logs:sendWebhook', whData)
  • Does it have any default logs?: Sure. It will probably log gamers joins and depart in order for you so.
  • Can I modify the format of the embed?: Positive! in case you really feel assured about it simply go to the file z64_dl_server_main.lua and mess around!
  • How can I create a brand new WebHook in my Discord Server?: Examine this Official Discord Guide. Additionally examine this one! Birdie0’s Guide.
  • What do I want with a view to create a WebHook?: You want the fitting permissions in your Discord Server. manageWebhooksPermission
  • Is that this up to date?: Sure!
  • Does it want another script?: No. This script has no dependencies.

DOWNLOAD:

zetta64_discordlogs-main.zip (16.2 KB)

GITHUB LINK



Looking for paid scripts? Click here