Skip to main content

Exports & Events

Closing the screen from your own scripts, and handing the settings over from a custom connection queue.

This section

Exports & Events

Client — Close the Screen​

Plays the closing animation and takes the screen down.

lua
exports.code9_loading:close()

The same through an event:

lua
TriggerEvent('code9_loading:close') -- client side
TriggerClientEvent('code9_loading:close', src) -- from the server

Use it with Config.game.closeWhen = 'manual' to decide yourself when the screen goes — for example once your character selection is ready to show.

Character Selection Example​

lua
-- in your character selection's client script
CreateThread(function()
-- …prepare your character selection…
exports.code9_loading:close()
end)

Server — Handover Data​

Returns everything the screen needs: the settings and the words of the chosen language.

lua
exports.code9_loading:handoverData()

Only needed when another resource owns the connection queue. Set Config.game.handover = false, then hand the data over from your queue:

lua
AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
deferrals.defer()
Wait(0)
-- …your own checks…
deferrals.handover(exports.code9_loading:handoverData())
deferrals.done()
end)