I created a function recently but I guess I can share it.
ESX.CheckPerms = function(playerId, rolesArray)
local p = promise.new()
if rolesArray ~= nil then
exports['discordroles']:getUserRoles(playerId, function(roles)
if roles ~= nil then
for _, playerRole in pairs(roles) do
for _, role in pairs(rolesArray) do
if playerRole == role then
return p:resolve({a = true})
end
end
end
else
TriggerClientEvent('t-notify:client:Alert', playerId, {
style = 'error',
message = 'No estas en el discord'
})
end
return p:resolve({a = false})
end)
else
print("Array of data is missing")
return false
end
local result = Citizen.Await(p)
return result.a
end
It basically returns if the player has a discord role from the roles array. You just need discordroles
Regarding owning a vehicle. That’s probably due to Gmatt since I did not know how it works and my qbcore testing server is broken.