Mailar
1
I have been trying to solve it but I don’t know what to do next.
Nothing sends to discord I have the real webhook there and no error or anything on console.
client.lua
function customLog(webhook, color, title, message)
local log = {
["color"] = color,
["title"] = title,
["description"] = message
}
print("Client has responded with ")
print(webhook)
print(log["color"])
print(log["title"])
print(log["description"])
TriggerServerEvent('core-log:Loki', webhook, log) -- Send to server webhook and log information
end
RegisterNetEvent('core-log:Loki')
AddEventHandler('core-log:Loki', function(webhook, color, title, message)
customLog(webhook, color, title, message)
end)
RegisterCommand('autokauppa', function(source, args)
exports['core-log']:customLog('WEBHOOK', '16711680', 'Pelaaja', 'Hankki uuden ajoneuvon. Rekisterillä: LE9E-200')
end, false)
server.lua
RegisterNetEvent('core-log:Loki')
AddEventHandler('core-log:Loki', function(webhook, log)
if Config.logs then
Citizen.Wait(1000)
print("Server has responded with ")
print(webhook)
print(log["color"])
print(log["title"])
print(log["description"])
PerformHttpRequest(webhook, function(err, text, headers)
end, 'POST', json.encode({
username = "Lokipoliisi",
embeds = log
}), {
['Content-Type'] = 'application/json'
})
else
end
end)
fxmanifest.lua
fx_version 'cerulean'
games {'gta5'}
author 'author'
client_scripts {'client.lua'}
server_script {'server.lua', 'config.lua'}
export "customLog"
Taxis1
3
It does not read webhook , you print(webhook) and it returns WEBHOOK , have you put somewhere your webhook link ? In the Config.logs ?
Mailar
4
Config.logs is just true/false are the logs enabled or not
Taxis1
5
You Should Replace ‘WEBHOOK’ With Your Webhook Link Then !
Mailar
6
Yes I have it replaced but I just didn’t want to put my webhook link here so I renamed it just WEBHOOK for this example.
It’s not the problem it all goes through server but the PerformHttpRequest doesn’t do what it should.
Taxis1
7
Alright … Let me think of it … 
1 Like
Taxis1
8
Where is this export from ? Does this export works properly ? Cause i dont see anything wrong in your code !
Mailar
9
Yes the exports works I did the log in server side and it had all the information from that exports line
1 Like
Mailar
11
What do I put on resourcename?
I think exports.core-log.customLog
are same
exports['resourceName']:customLog
Taxis1
12
Yes they are the same , but try it!
Mailar
13
It gives same results its not the export function
because the idea of that is to bring the data to server side and they are there succesfully like you can see on the picture.
1 Like
Mailar
14
The client side is fine the problem is on the server side
1 Like
Mailar
15
Ok the problem is on the embeds = log,
for some reason it can’t get the log from clientside
1 Like
Mailar
16
SOLVED I needed to add 2 times Curly brackets on the client side
Before
local log = {
["color"] = color,
["title"] = title,
["description"] = message
}
After
local log = {{
["color"] = color,
["title"] = title,
["description"] = message
}}