STG ScriptsDocumentation
Game Consoles

Exports

Open or close an STG Game Consoles console from your own scripts, check if a player is playing and listen for finished game scores.

Use these to open a console from your own item handler, a shop, a phone app or any other script.

Client exports

Use

local ok = exports['stg-gameconsoles']:Use('stg_pocketx_lilac')

Same as using the item: opens that console, or puts it away when one is already open. Takes an item name from Config.Items. Returns false when the name is not in the config or the console is still being pulled out.

Close

exports['stg-gameconsoles']:Close()

Puts the console away. Returns false when no console is open.

IsOpen

local playing = exports['stg-gameconsoles']:IsOpen()

Returns true while the player has a console open.

Server export

Use

exports['stg-gameconsoles']:Use(source, 'stg_handheld_navy')

Opens the console for that player, without checking their inventory. Returns false when the item name is not in Config.Items.

Client event

stg-gameconsoles:client:score

AddEventHandler('stg-gameconsoles:client:score', function(game, score)
    print(game, score)
end)

Fires on the player's client every time a game ends, with the game id (for example tinyquest or sunnydash) and the final score.

The score comes from the player's own client. Do not pay out money or items based on it.

Still having trouble?

Open a ticket on our Discord. Our team answers around 15 hours a day.

Get help on Discord

On this page