[STANDALONE] [FREE] MSK_DiscordWebhook

Hello guys!

We all need security on our server and webhooks help us tremendously to store everything that’s going on :smiley:

So we wrote a script that allows you to simply add an export to any serverside and log something directly

Please read the README.md file to avoid misapplication.
If something doesn’t work, our support is open for you!

Best regards from the MSK-Scripts team!

Code is accessible Yes
Subscription-based No
Lines (approximately) 62
Requirements No
Support Yes
README

ReadMe

webhook = "WEBHOOK_LINK"

botColor = false to deactivate it
botName = false to deactivate it
botAvatar = false to deactivate it
title = false to deactivate it
description = false to deactivate it
fields = false to deactive it
footer = false to deactive it
time = false to deactive it
webhook = "https://discordapp.com/api/webhooks/101088",
botColor = "6205745", -- https://www.mathsisfun.com/hexadecimal-decimal-colors.html
botName = "MSK Scripts",
botAvatar = "https://i.imgur.com/PizJGsh.png",
title = "MSK Scripts - Webhook Script",
description = "Test Beschreibung",
fields = {
    {name = "Title", value = 'Description', inline = true},
    {name = "Title", value = 'Description', inline = true},
},
footer = {
    text = "© MSK Scripts", 
    link = "https://i.imgur.com/PizJGsh.png"
},
time = "%d/%m/%Y %H:%M:%S" -- format: "day/month/year hour:minute:second"
exports['msk_webhook']:sendDiscordLog(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)

Our other Scripts

Paid

Free

7 Likes

I think we implemented your idea well :slight_smile:

3 Likes

Hello !! I tried the script and it works correctly but I would like to know if it can deliver values such as… steam name or IC name within the server or different variables since with that it would help me a lot to control

1 Like

Yes sure!

description = "Your Character Name is " .. xPlayer.name,

So it look like: "Your Character Name is Jason Smith"

2 Likes

any solution?

1 Like

You have to define xPlayer like local xPlayer = ESX.GetPlayerFromId(source)
or you just use

description = "Your Character Name is " .. ESX.GetPlayerFromId(source).name,
2 Likes

Excuse my ignorance… (I’m learning about this) where exactly would the “local xPlayer = ESX.GetPlayerFromId(source)” go?

Into your Thread

1 Like

Excuse me… could you give me an example? I’ve tried to do it and it still doesn’t work :cry:

RegisterServerEvent('Eventname')
AddEventHandler('Eventname', function()
    local src = source
    local xPlayer = ESX.GetPlayerFromId(src)

    local webhook = "https://discordapp.com/api/webhooks/101088",
    local botColor = "6205745", -- https://www.mathsisfun.com/hexadecimal-decimal-colors.html
    local botName = "MSK Scripts",
    local botAvatar = "https://i.imgur.com/PizJGsh.png",
    local title = "MSK Scripts - Webhook Script",
    local description = "Your Charactername is " .. xPlayer.name .. " ID: (" .. xPlayer.source .. ") Identifier: (" .. xPlayer.identifier .. ")",
    local fields = {
        {name = "Identifier", value = xPlayer.identifier, inline = true},
        {name = "Name", value = xPlayer.name, inline = true},
    },
    local footer = {
        text = "© MSK Scripts", 
        link = "https://i.imgur.com/PizJGsh.png"
    },
    local time = "%d/%m/%Y %H:%M:%S" -- format: "day/month/year hour:minute:second"

    exports['msk_webhook']:sendDiscordLog(webhook, botColor, botName, botAvatar, title, description, fields, footer, time)
end)