Cube Scripts

Server

Events you can trigger from a client.

This is not a comprehensive list and omits events intended for internal use only - the signalling events that carry the WebRTC handshake should never be triggered by another resource.

Event Triggers#

Note

These events are safe to trigger from a client script.

Every one of them runs the permission check on the caller, so they cannot be abused by a player who is not staff.

cube_monitoring:watch#

Opens a live stream of the target player for whoever triggers it.

lua
TriggerServerEvent('cube_monitoring:watch', targetId)
  • targetId: number

If a limit is hit, the caller receives cube_monitoring:watchRejected with the reason, and the interface shows it.

cube_monitoring:screenshot#

Captures the target player's screen and opens the result in a window.

lua
TriggerServerEvent('cube_monitoring:screenshot', targetId)
  • targetId: number

cube_monitoring:openPanel#

Opens the player list for whoever triggers it.

lua
TriggerServerEvent('cube_monitoring:openPanel')

Use this to add a button to your existing admin menu:

client.lua
RegisterCommand('adminmenu', function()
    -- ... your menu ...
    TriggerServerEvent('cube_monitoring:openPanel')
end)

cube_monitoring:requestPlayers#

Asks for a fresh player list. The panel does this on its own every Config.PlayerListRefresh milliseconds, so you rarely need it.

lua
TriggerServerEvent('cube_monitoring:requestPlayers')

Event Handlers#

Warning

These are triggered by the resource. Listening to them is fine; triggering them yourself is not.

cube_monitoring:watchedState#

Sent to a watched player when Config.NotifyTarget is enabled.

lua
RegisterNetEvent('cube_monitoring:watchedState', function(active)
    -- active: boolean
end)

The resource already shows a notification. Handle it only if you want extra behaviour, such as a persistent on-screen indicator.

cube_monitoring:playerList#

Sent to an admin with an open panel, on every refresh.

lua
RegisterNetEvent('cube_monitoring:playerList', function(players)
    -- players: table[] of { id, name, label, ping, watchers }
end)