Custom · origen_pausemenu
The custom/ folder is open-source and is the intended place to adapt the resource to your framework and server logic. These files are listed in escrow_ignore.
custom/
├── client.lua
└── server.luacustom/client.lua
SendNUIData()
Called when Config.CustomNUIData = true and the player opens the menu. Override this function to send fully custom data to the NUI instead of the default payload.
The function must call SendNUIMessage with at least the action = "OpenMenu" key. All other fields are optional and depend on what your NUI template uses.
function SendNUIData()
-- refresh player info if stale (>10 seconds old)
if GetGameTimer() - lastInfoUpdated > 10000 then
updateInfo()
end
pInfo = pInfo or {}
SendNUIMessage({
action = "OpenMenu",
usersOnline = pInfo.usersOnline or 0,
maxPlayers = pInfo.maxPlayers or 32,
name = pInfo.name or "Loading...",
job = pInfo.job or "Loading...",
cash = pInfo.cash or 0,
bank = pInfo.money or 0,
discord = Config.Discord,
website = Config.Website,
twitter = Config.Twitter,
instagram = Config.Instagram,
youtube = Config.Youtube,
PoliceAvailable = pInfo.PoliceAvailable and true or false,
other = Config.ExtraData,
})
endpInfo is populated by the server callback origen_pauseMenu:server:getInfo. The variables lastInfoUpdated and updateInfo() are defined in client/main.lua — do not redefine them here.
CanBeOpened() → boolean
Called every time a player attempts to open the pause menu. Return false to block it.
The default implementation reads the internal canOpen flag, which can be toggled from other resources via the SetCanOpen export.
local canOpen = true
function CanBeOpened()
return canOpen
end
exports("SetCanOpen", function(value)
canOpen = value
end)custom/server.lua
getPolice() → number
Returns the number of players currently on duty in any job listed in Config.PoliceJobs.
If origen_police is running, it delegates to exports["origen_police"]:GetPlayersInDuty() for accurate duty tracking. Otherwise it falls back to the framework's native player-by-job query.
function getPolice()
if Config.Framework == 'esx' or Config.Framework == 'newesx' then
Police = ESX.GetExtendedPlayers("job", Config.PoliceJobs[1])
if GetResourceState("origen_police") ~= "missing" then
Police = exports["origen_police"]:GetPlayersInDuty(Config.PoliceJobs[1])
end
else
Police = #(QBCore.Functions.GetPlayersOnDuty(Config.PoliceJobs[1]))
end
return Police
endgetOnlinePlayers() → number
Returns the total number of players currently connected to the server.
function getOnlinePlayers()
if Config.Framework == 'esx' or Config.Framework == 'newesx' then
playerCount = #(ESX.GetPlayers())
else
playerCount = #(QBCore.Functions.GetPlayers())
end
return playerCount
end