This is a simple script. Not tested, should work though. I feel this is not really needed in #development:releases so I’ll put it here as a resource. It has no license, use as you wish
------------------------------------------
--- Warnings To Discord, Made by FAXES ---
------------------------------------------
resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937"
server_script "server.lua"
--[[
ACE PERMISSIONS TO ADD TO SERVER.CFG
add_ace WarnsReport faxes.warns.reports allow
add_principal identifier.steam:HEX-ID-HERE WarnsReport
]]--
server.lua
------------------------------------------
--- Warnings To Discord, Made by FAXES ---
------------------------------------------
--- Config ---
webHookURL = "Add_Webhook_URL_Here" -- The Webhook link to post too.
enableReport = true -- Enable /report command
enableWarns = true -- Enable /warn command
--- Code ---
function DisplayHelp(text)
SetTextComponentFormat("STRING")
AddTextComponentString(text)
DisplayHelpTextFromStringLabel(0, 0, 1, - 1)
end
if enableWarns then
RegisterCommand("warn", function(source, args, rawCommand)
local user = tonumber(args[1])
local msg = table.concat(args, " ", 2)
local username = GetPlayerName(user)
if IsPlayerAceAllowed(source, "faxes.warns.reports") then
sendTahTheFuckingDiscordChat(username, msg, "User was warned for:")
DisplayHelp("~g~Warning Sent!")
else
DisplayHelp("~r~Invalid Permissions")
end
end)
end
if enableReport then
RegisterCommand("report", function(source, args, rawCommand)
local user = tonumber(args[1])
local msg = table.concat(args, " ", 2)
local username = GetPlayerName(user)
sendTahTheFuckingDiscordChat(username, msg, "This user was reported for:")
DisplayHelp("~g~Report Sent!")
end)
end
function sendTahTheFuckingDiscordChat(name, message, type)
PerformHttpRequest(webHookURL, function(err, text, headers) end, 'POST', json.encode({username = name, content = type .. "\n" .. message}), { ['Content-Type'] = 'application/json' })
end
Hey, love your script’s but every time someone make a report or write /report without id the server gives errors. Is there a way for you to make it so when someone report without the id, a text will pop up to say to use id. And when someone dose a report It doesn’t make an error?
ERRORS:
Error when do /report (id) (reason):
The webhook works fine for me, and sends the message fine - I took out the display help function and switched it to utilize the ChatMessage function so it would confirm the report has been sent. The error goes away.
Are you sure you have restarted your server, also note i’m only doing a fix for the reporting system not the warning system. If it is a warning based error it most likely has something to do with the ace permissions.