So… i have spend all day tried to make a certen discord log - here are the ‘server.lua’ code
function getIdentity(_source)
local user_id = vRP.getUserId({source})
local _source = source
local username = GetPlayerName(target)
local target = vRP.getUserSource({targetID})
vRP.getUserIdentity({targetID, function(identity)
if identity then
MySQL.Async.fetchAll("SELECT * FROM vrp_user_identities WHERE user_id = @user_id", {user_id = user_id}, function(cb, firstname, lastname, height)
cb {
--username = GetPlayerName(target),
firstname = identity.firstname,
lastname = identity.name,
height = identity.registration
}
end)
end
end})
end
function discordlog(firstname, lastname, height)
local d1name = "[Fangeflugt] Denne person mangler:"
local d1message = "**Navn:** " .. tostring(firstname).. " " .. tostring(lastname).. " **CPR:** " .. tostring(height).. ""
PerformHttpRequest('https://discord.com/api/webhooks/8261851867921/S7jLX_-bpNz9Ec15SUp1NSJW-eH-Gr77XoBXJL0K8MYjZCy46clYN-11rMGIarspJQjG', function(err, text, headers) end, 'POST', json.encode({username = d1name, content = d1message}), { ['Content-Type'] = 'application/json' })
end
But when the log is printet, it’s says " Navn: nil nil CPR: nil "
And I ofc. know, thats becouse it’s not specificed right. And in my defence, this is my first time trying to make discord log with names instead of “user_id”.
I have looked everywhere for some code to eaither use some of, or all of it. but did’t find anything.
Hope there are someone with more experices than me.