I need Help with making Exports

Hello their,
I am trying to work on a menu to access all the other ones rather than having to know all the buttons for each and every menu, SO…


It all comes to having to create exports that opens the menus
And this is what I tried (New at this stuff, Take it easy on me ;D)

if data2.current.value == 'menuperso_moi_inventaire' then
exports['es_extended']:openInventory()

But it doesn’t Seem to WorK


Just need 1 accurate example so I can continue…
_____________________________________________________________________________________________________________

-Thank You :cloud_with_lightning_and_rain:

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

Thank u, I will give it a shot.


In my case IS it :
1: server_export “es_extended”
OR
2: server_export “Inventory”

You have to export the function name. Is the function client or server?

If its Inventory
It should be client if I’m right!

Then I believe you would use export not server_export