[Release] [Standalone] Boost's webhook system

Hey! Could this work with the txAdmin Beta menu? Bans, warnings, spectate…etc?

If you can edit txadmin menu files it certenly can work

1 Like

Hi! Im trying to work with the txAdmin menu, hope you can help me out here…

Im using EventHandlers, the txAdmin:events:playerWarned works perfect, but the Kick and Ban seem to not send the ID, I get the: “attempt to concatenate a nil value”. This is the code:

ESX = nil
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)

AddEventHandler('txAdmin:events:playerWarned', function(eventData)
	local data = {
	  ['Log'] = 'acciones_admin', 
	  ['Jugador'] = eventData.target, 
	  ['Title'] = '🚨 Advertencia 🚨', -- Title
	  ['Message'] = '**Autor: **``' .. eventData.author .. '``\n **Razon:** ``' .. eventData.reason .. '`` \n **ID:** ``' .. eventData.actionId .. '``',
	  ['Color'] = 'morado', 
	}
  
	TriggerEvent('Boost-Logs:SendLog', data)
end)

AddEventHandler('txAdmin:events:playerBanned', function(eventData)
	local data = {
	  ['Log'] = 'acciones_admin', 
	  ['Jugador'] = eventData.target, 
	  ['Title'] = '🛑 Ban Hammer 🛑', -- Title
	  ['Message'] = '**Autor: **``' .. eventData.author .. '``\n **Razon:** ``' .. eventData.reason .. '`` \n **ID:** ``' .. eventData.actionId .. '``',
	  ['Color'] = 'red', 
	}
  
	TriggerEvent('Boost-Logs:SendLog', data)
end)

AddEventHandler('txAdmin:events:playerKicked', function(eventData)
	local data = {
	  ['Log'] = 'acciones_admin', 
	  ['Jugador'] = eventData.target, 
	  ['Title'] = '🚨 Test 🚨', -- Title
	  ['Message'] = 'test',
	  ['Color'] = 'morado', 
	}
	TriggerEvent('Boost-Logs:SendLog', data)
end)

Also created a new embed on your code:

if data['Target'] ~= nil then
        local srcIds = ExtractIdentifiers(_source)
        local trgIds = ExtractIdentifiers(data['Target'])
        local srcSteamSub = srcIds.steam:gsub("steam:", "")
        local trgSteamSub = trgIds.steam:gsub("steam:", "")
        local srcSteam = tostring(tonumber(srcSteamSub,16))
        local trgSteam = tostring(tonumber(trgSteamSub,16))

        embed = {
            {
                ["color"] = Config.Colors[data['Color']],
                ["title"] = "**"..data['Title'].."**",
                ["description"] = data['Message'] .. '\n\n'
                .. '**Jugador**\n**Jugador:** ``' .. GetPlayerName(_source) .. '``\n'
                --.. '**Player ip:** ||' .. srcIds.ip .. '||\n'
                .. '**Identifier:** ``' .. srcIds.license .. '``\n'
                .. '**Steam:** https://steamcommunity.com/profiles/' .. srcSteam .. '\n'
                .. '**Discord:** <@' .. srcIds.discord:gsub('discord:','') .. '> ``' .. srcIds.discord:gsub('discord:','')..'``\n\n'
                .. '**Target Player**\n**Target name:** ``' .. GetPlayerName(data['Target']) .. '``\n'
                --.. '**Target ip:** ||' .. trgIds.ip .. '||\n'
                .. '**Odentifier:** ``' .. trgIds.license .. '``\n'
                .. '**Steam:** https://steamcommunity.com/profiles/' .. trgSteam  .. '\n'
                .. '**Discord:** <@' .. trgIds.discord:gsub('discord:','') .. '> ``' .. trgIds.discord:gsub('discord:','')..'``',
                ["footer"] = {
                    ["text"] = os.date("%A, %m %B %Y, %X"),
                },
            }
        }
    elseif data['Log'] == 'acciones_admin' then
        local trgIds = ExtractIdentifiers(data['Jugador'])
        local trgSteamSub = trgIds.steam:gsub("steam:", "")
        local trgSteam = tostring(tonumber(trgSteamSub,16))
        embed = {
            {
                ["color"] = Config.Colors[data['Color']],
                ["title"] = "**"..data['Title'].."**",
                ["description"] = data['Message'] .. '\n\n'
                .. '**Jugador afectado**\n**Nombre:** ``' .. GetPlayerName(data['Jugador']) .. '``\n'
                --.. '**Target ip:** ||' .. trgIds.ip .. '||\n'
                .. '**Identifier:** ``' .. trgIds.license .. '``\n'
                .. '**Steam:** https://steamcommunity.com/profiles/' .. trgSteam  .. '\n'
                .. '**Discord:** <@' .. trgIds.discord:gsub('discord:','') .. '> ``' .. trgIds.discord:gsub('discord:','')..'``',
                ["footer"] = {
                    ["text"] = os.date("%A, %m %B %Y, %X"),
                },
            }
        }  
    else
        local srcIds = ExtractIdentifiers(_source)
        local steam = srcIds.steam:gsub("steam:", "")
        local steamDec = tostring(tonumber(steam,16))
        steam = "https://steamcommunity.com/profiles/" .. steamDec
        embed = {
            {
                ["color"] = Config.Colors[data['Color']],
                ["title"] = "**"..data['Title'].."**",
                ["description"] = data['Message'] .. '\n\n'
                .. '**Jugador:** ``' .. GetPlayerName(_source) .. '``\n'
                --.. '**Player ip:** ||' .. srcIds.ip .. '||\n'
                .. '**Identifier:** ``' .. srcIds.license .. '``\n'
                .. '**Steam:** ' .. steam .. '\n'
                .. '**Discord:** <@' .. srcIds.discord:gsub('discord:','') .. '> ``' .. srcIds.discord:gsub('discord:','')..'``',
                ["footer"] = {
                    ["text"] = os.date("%A, %m %B %Y, %X"),
                },
            }
        }
    end

The thing is, the Warn works perfect, the Ban and Kick no, and they are the same… So Im a bit lost :sweat_smile:

Hope you can help me, thanks for your time!

You renamed the Target to Jugador this is the problem

1 Like

If I add the Target, I need to add the Player, and I cant get the Player ID, only his name :frowning:

Tried:

AddEventHandler('txAdmin:events:playerKicked', function(eventData)
	local data = {
      ['Player'] = eventData.target, 
	  ['Log'] = 'acciones_admin', 
	  ['Target'] = eventData.target, 
	  ['Title'] = '🚨 Test 🚨', -- Title
	  ['Message'] = 'test',
	  ['Color'] = 'morado', 
	}

	TriggerEvent('Boost-Logs:SendLog', data)
end)

And I get:

[   script:Boost_Logs] SCRIPT ERROR: @Boost_Logs/server/main.lua:64: attempt to concatenate a nil value
[   script:Boost_Logs] > handler (@Boost_Logs/server/main.lua:123)

Youtube tutorial added !
https://www.youtube.com/watch?v=e_xnubmRQq0

@KonarPlus

you should ask @Boost to rerelease his webhook codes :airplane::rofl: omg !!

1 Like

he is pro

Script does not work for me with ESX Legacy

What errors are you getting ? And did you specify the webhook ?

in the ['Message'] = there is no , at the end

Easy to use for starters, nice :slight_smile:

how to use it on ox_inventory logs