[Release] Discord Identifier

A little script for discord bot for tag player doing something in server and send message to discord server
Not use Database, I hate it :upside_down_face:

little code, you can use function or RegisterServerEvent to create file

server.lua

local discord = ""
local id = ""
    
identifiers = GetNumPlayerIdentifiers(source)
for i = 0, identifiers + 1 do
    if GetPlayerIdentifier(source, i) ~= nil then
        if string.match(GetPlayerIdentifier(source, i), "discord") then
            discord = GetPlayerIdentifier(source, i)
            id = string.sub(discord, 9, -1)
        end
    end
end

fxmanifest.lua

fx_version 'bodacious'
game 'gta5'

client_scripts {
    'server.lua',
}

Review:
image

Have Fun!

1 Like

This is not a release, but more of a snippet. Moved to #development:scripts

How to use this script?

add code in server file use functtion or RegisterServerEvent
like

function discordid()
    add here
end
2 Likes

Knipsel
log
it logs the discord id but i wouldn’t tag the person

1 Like

local playerDiscordTag = nil
for _, identifier in ipairs(GetPlayerIdentifiers(source)) do
if identifier:match(“discord”) then
playerDiscordTag = ‘<@’…identifier:gsub(“discord:”, “”)…’>’
end
end
if playerDiscordTag then
local discordWebhook = “”
PerformHttpRequest(discordWebhook,function(a, b, c)end,“POST”,json.encode({embeds = {{description = playerDiscordTag}}}),{[“Content-Type”] = “application/json”})
end