WebHooks

so i have been working on discord webhooks or discord logs for the past few days and i got them down decently
image


I get this result from the 2 pictures above

Anyone know how i can get identifiers like steam/fivem licenses and Rockstar licenses

1 Like

GetPlayerIdentifiers

ive been looking at this reference i do not seem to understand it tho

You juste do :

local identifier = GetPlayerIdentifier(source, X) 

Where ā€˜Xā€™ is a number (1,2,3,4) which is an index for the identifier.

local identifierFiveM = GetPlayerIdentifier(source, 1)
local identifierSteam =  GetPlayerIdentifier(source, 2)

And so on (dont quote me on the index it might be out of order).
If you want to get them all better use a loop like in the example ImTase linked, If not you cant do it like that.

i know its possible the server had old logs like this
image

i am just so confused on why i cannot get itā€¦ i keep getting the same error after trying 1000 ways multiple times
imagetrying your ways
imagetrying to get from id
image trying random bullshits

this is the only error i get

this is all the script is by default without any identifiers

ā€™

how can i setup a loop like you said to grab all of them

Ah ! Here is you issue, you are trying to use the Native client side but itā€™s a Native that can only be used server side.
You could add the identifiers in the code of the event you are triggering server side.

what do you mean by this? add the webhook to be on server side event?

or just add the
local identifier = GetPlayerIdentifier/local identifierFiveM = GetPlayerIdentifier
to be server side then trigger them in client event?

imageā€“this is the server sided event

btw thank you tons this is lots of help!!

Honestly, I wouldnā€™t allow toDiscord from the client.

Thatā€™s extremely vulnerable from any injector/executo, to simply spam that with what they want, and your logs will be flooded.

Same with your gangs, Iā€™d recommend passing the table/object (instead of itemname and amount) and add server validation with a gang check & item check.

Iā€™d recommend only using that logging via a server event.

yeah thats fair i didnt even think of that like you said any executor could spam logs i can make it log from a server sided event easily
still needa figure out the identifiers tho

1 Like

Yeah thatā€™s one thing I quickly noticed, wanna nip that shit in the bud, as these executing kids can seriously get out of hand.

So you want to get a specific identifier?

dude yeah for real good lookin outā€¦ i can imagine some 12 year old poppin up in my server saying ā€œCHECK LOGS CHECK LOGSā€

So you want to get a specific identifier? yes mostly steam hexs and fivem licenses

Hereā€™s an old piece of code of mine, it used to work in Lua for getting specific identifiers. Feel free to mess with it as you see fit.

Keep in mind if you want the full identifier steam:hex_here and not just hex_here then use the second function Iā€™ve posted.

JUST IDENTIFIERS - license_id

function GetIdentifier(server_id, identifier_type)
    local name = GetPlayerName(server_id) or 'Unknown'
    local identifiers = GetPlayerIdentifiers(server_id) or {}
    local license = nil or 'Unknown'
    local xbl = nil or 'Unknown'
    local live = nil or 'Unknown'
    local discord = nil or 'Unknown'
    local fivem = nil or 'Unknown'
    local ip = nil or 'Unknown'

    for _, identifier in pairs(identifiers) do
        if (string.match(string.lower(identifier), 'steam:')) then
            steam_hex = identifier
        elseif (string.match(string.lower(identifier), 'license:')) then
            license = string.sub(identifier, 9)
        elseif (string.match(string.lower(identifier), 'xbl:')) then
            xbl = string.sub(identifier, 5)
        elseif (string.match(string.lower(identifier), 'live:')) then
            live = string.sub(identifier, 6)
        elseif (string.match(string.lower(identifier), 'discord:')) then
            discord = string.sub(identifier, 9)
        elseif (string.match(string.lower(identifier), 'fivem:')) then
            fivem = string.sub(identifier, 7)
        elseif (string.match(string.lower(identifier), 'ip:')) then
            ip = string.sub(identifier, 4)
        end
    end

    if identifier_type == "steam" then
        return steam_hex
    elseif identifier_type == "license" then
        return license
    elseif identifier_type == "xbl" then
        return xbl
    elseif identifier_type == "live" then
        return live
    elseif identifier_type == "discord" then
        return discord
    elseif identifier_type == "fivem" then
        return fivem
    elseif identifier_type == "ip" then
        return ip
    end
end

FULL IDENTIFIERS | license:license_id

function GetIdentifier(server_id, identifier_type)
    local name = GetPlayerName(server_id) or 'Unknown'
    local identifiers = GetPlayerIdentifiers(server_id) or {}
    local license = nil or 'Unknown'
    local xbl = nil or 'Unknown'
    local live = nil or 'Unknown'
    local discord = nil or 'Unknown'
    local fivem = nil or 'Unknown'
    local ip = nil or 'Unknown'

    for _, identifier in pairs(identifiers) do
        if (string.match(string.lower(identifier), 'steam:')) then
            steam_hex = identifier
        elseif (string.match(string.lower(identifier), 'license:')) then
            license = identifier
        elseif (string.match(string.lower(identifier), 'xbl:')) then
            xbl = identifier
        elseif (string.match(string.lower(identifier), 'live:')) then
            live = identifier
        elseif (string.match(string.lower(identifier), 'discord:')) then
            discord = identifier
        elseif (string.match(string.lower(identifier), 'fivem:')) then
            fivem = identifier
        elseif (string.match(string.lower(identifier), 'ip:')) then
            ip = identifier
        end
    end

    if identifier_type == "steam" then
        return steam_hex
    elseif identifier_type == "license" then
        return license
    elseif identifier_type == "xbl" then
        return xbl
    elseif identifier_type == "live" then
        return live
    elseif identifier_type == "discord" then
        return discord
    elseif identifier_type == "fivem" then
        return fivem
    elseif identifier_type == "ip" then
        return ip
    end
end
1 Like

For me when I looked at your screenshots it didnā€™t seem like the webhook was made client side anyway, as I just see a server event get triggered, server event that is going to preform the HTTP request for the hook (but server side).
@LX_Creations Is right though, try to put some security check in place and make it so the http request his performed ā€œas farā€ as possible from the client reach.

But itā€™s pretty straight forward anyway, the Native we spoke about just before is simple it gives you the identifiers and you just add them to the data sent through the WebHook.
Example :

local datas = datasYouWantToSend
local identifierFiveM = GetPlayerIdentifier(source, 1)
local identifierSteam =  GetPlayerIdentifier(source, 2)

identifierFiveM = identifierFiveM:gsub('%license:', '')
identifierSteam = identifierSteam:gsub('%steam:', '')

datasYouWantToSend = datasYouWantToSend.." - fiveM ID : "..identifierFiveM.."Steam ID : "..identifierSteam
if Config.Webhook then --This is just a check if you set it in the config 
	if Config.Webhook ~= "" and Config.Webhook ~= "YOUR_WEB_HOOK_HERE" then
		SendWebhook(datasYouWantToSend) -- This functionn contain you WebHook code
	end
end

The example doesnā€™t contain the security checks and all the other things that can be useful (check if the source isnā€™t 0, to be sure etcā€¦). But Itā€™s hard to make it simpler, as there is a native already available and simple to use and it seems like you already have the code for the WebHook made you just have to use the native and concatante a few string ^^ā€™

1 Like

Oups, I did not see you reply when I wrote mine. This topic is getting pretty redundant :rofl: .
Yeah, good example too; There is only two way of simply doing it : yours with the loop to get all the identifiers or mine with a line for each identifier (if he wants just 1 or 2 of them). I donā€™t think we can add anything more than what You, Trase and me said regading simply using the Native at least.

Yeah checks are very much required because one, theyā€™ll spam your logs and two, it will disable any other hooks or discord API usage for a while, as you will be timed out by Discords API, for rate limiting.

Yeah I myself try not to use GetPlayerIdentifier as it doesnā€™t always return the same data if itā€™s higher identifiers like 4 or 5, at least in my experience, if heā€™s just getting steam and license it should be okay.