[Release] Server Logs to Discord

Getting Player’s Name
GetPlayerName(source) Will get the player name. The same way as they get it for the Chat message.

Getting Players ID
source is the PlayerID of the person who triggered the command. So that will be the PlayerID.

Getting the Steam ID
GetPlayerIdentifiers(source)[1] Will get the player’s identifiers.
The [1] will be the Steam ID.

To use any of these variables in the message you’ll need to add them into your text string.

Example:
'This is where text goes ' .. GetPlayerName(source) .. ' and this is where some more text goes'

Will display like
This is where some text goes PLAYERNAME and this is where some more text goes

Used inside a command:

--/twt Command
	RegisterCommand('twt', function(source, args, user)
	TriggerClientEvent('chatMessage', -1, "^0^*[^4Twotter^0] (^5@" .. GetPlayerName(source) .. "^0)^r", {30, 144, 255}, table.concat(args, " "))
	exports.JD_logs:discord('[Twotter] **'.. GetPlayerName(source) ..'** '.. table.concat(args, " ") ..'\n**PlayerID:**'.. source ..'**\nSteamID:** '.. GetPlayerIdentifiers(source)[1] ..'', '1952511', 'twot')
	end, false)

The table.concat(args, " ") will just like in the Chat message display the content of the twot in this case


Hope this helps.
If you have any more questions just ask :slight_smile:

1 Like

Hi,
I must say this is really good work from you and I can’t wait to see more functions added to this project. :slightly_smiling_face:

2 Likes

I made an Showcase of your project! @JokeDevil
https://www.youtube.com/watch?v=FHPJbeMfnEQ&t=24s

Looks great!

1 Like

Updated to 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)

I have all the webhooks in and set up to all the right channels but when i go to test any of them they dont show up in discord??

hi,

I installed the v1.0.3 Update, and there still seems to be an issue with the death logs :confused:

the player & killer remain the same as shown below

I also noticed an error log in our console:

hope this can help !

Hello, im trying to add discordID and steamurl to when players take out items from property/motels.
I have got it so far that it logs steamid, and what they take out and how many. But i can’t seem to get the steamurl link or discordID working…

This is my code:

TriggerServerEvent(“esx_property:getItem”, ESX.GetPlayerData().identifier, data.item.type, data.item.name, tonumber(data.number))

if Config.discordID then _discordID ="\nDiscord ID: <@" …ids.discord:gsub(“discord:”, “”)…">" else _discordID = “” end

if Config.steamURL then _steamURL ="\nhttps://steamcommunity.com/profiles/" …tonumber(ids.steam:gsub(“steam:”, “”),16)…"" else _steamURL = “” end

exports.JD_logs:discord(’[Lägenhet/hus] \nSteamID: ’ … ESX.GetPlayerData().identifier … ’ \nTog ut ’ … _discordID…’’ … _steamURL…’’ … data.item.name …’ ’ … count … ’ st/ammo’, ‘1752220’, ‘fastighet’)

And this is how my log comes out in discord:

[Lägenhet/hus] SteamID : steam:110000108537146 Tog ut iphone 1 st/ammo"
It just skips the Discord and steamURL thing…

Possible to get some help ?

Working on resolving this thanks

2 Likes

Updated V 1.0.3b
Issue should be fixed now

1 Like

i got error in server.lua line 34

what’s te error?

Capturxe

and this errors when i shoot bullets Capwture

Make sure the user has steam running before they join your server

maybe bcz i set set steam_webApikey “none” in server.cfg ?

if you’re not using steam disable the steam functions in the config.lua

1 Like

working like charm

1 Like

you can add operations between players, like giving money, weapons and others?