is openInventory exported from es_extended resource?
Let me see if I can find a good example.
Ok SO
I have this function that handles my DB querying to my database
resource name is “externalsql”
function DBAsyncQuery(queryData, callback)
Citizen.CreateThread(function()
if authToken ~= nil then
PerformHttpRequest("http://" .. SQLConfig.host .. ":" .. SQLConfig.port .. SQLConfig.apipath .. "/execute", function(code, text, headers)
local decode = json.decode(text)
if decode.status ~= false then
callback({status = true, data = decode.results})
else
print(text)
callback({status = false, data = {}})
end
end, "POST", json.encode({
query = queryData.string,
data = queryData.data,
secret = SQLConfig.secret
}), {
["Content-Type"] = "application/json",
["Authentication"] = tostring("Bearer " .. authToken)
})
end
end)
end
In that same resource in the __resource.lua file I set
server_export "DBAsyncQuery"
then NOW I can use that by calling it the same way you just showed
XRPLifeDB["character"].DoesCharacterExist = function(name, dob, callback)
exports["externalsql"]:DBAsyncQuery({
string = "SELECT * FROM characters WHERE `name` = :name AND `dob` = :dob",
data = {
name = name,
dob = dob
}
}, function(results)
if #results.data >= 1 then
callback(true)
else
callback(false)
end
end)
end
This might also help you as client and server functions will require different exports