Skip to content

Exports & events

Public API of Cuxial Pause Menu: the player state that tells whether someone has the menu or the map open.

Cuxial Pause Menu has no exports and no events for other resources. What it offers is one player state you can read.

Player state: pauseState ​

The server keeps a replicated state bag on each player that tells whether they have the menu or the map open. Use it to skip actions on a player who is not looking at the game.

ValueMeaning
'menu'The menu or the GTA settings are open.
'map'The GTA map is open.
false or nilNothing open.
lua
local state = Player(serverId).state.pauseState

if state == 'menu' or state == 'map' then
    -- that player is paused
end

To react when it changes:

lua
AddStateBagChangeHandler('pauseState', nil, function(bagName, _, value)
    local player = GetPlayerFromStateBagName(bagName)
    if player == 0 then return end
    print(player, value)
end)

The state is only written with aura.enabled = true. It is not set while the player is dead or downed with aura.clearOnDeath = true. Read it only; the resource overwrites any other value.

© Cuxial