Exports
This page explains how to register and execute commands and actions from external scripts using the terminal's built-in exports.
addExternal(name,callback)
Use this export to register a custom callback. It triggers whenever the terminal processes an action with a matching callback value.
Parameters
name:
stringAction name, should match the field callback from a server side action.callback:
function(data)Callback to performReturn
success:
booleantrue will allow the command to execute the following actions, false will stop everything and print the failure action.
addSuccess(command, callback)
Use this export to register a onSuccess callback to trigger when a command is completed successfully.
Parameters
command:
stringMust be an existing command.callback:
function(data)Callback to perform
terminal(action)
Triggers an array of actions within the terminal, adhering to the format specified in Terminal
local actions = { { type = "text", input = "No vehicle found nearby.", style = "error", delay = 0 } } exports['av_laptop']:terminal(actions)
addCommand(settings)
Use this exports server side to register a new command for Terminal.
Parameters:
command:
stringCommand name, needs to be unique.show:
booleanMakes the command visible for player when using /help command.allowed:
function(playerId, laptopSerial)Should return a boolean, gets triggered when command /help is used and field show is true, is an extra layer where you can run custom code to restrict command access.canProcess:
function(playerId, laptopSerial, args)Should return a boolean, gets triggered when player uses command, use it to verify if the arguments are valid or if the player have X item, etc.onSuccess:
function(playerId, laptopSerial, args)Should return a boolean, triggered when all actions are completed successfully.actions:
tableA table with all actions to perform in terminal.output?:
tableA final action we can use to display text on terminal if all actions were completed successfully.An example running this command can be found below.
Keyfob Example
This example script registers the keyfob command to execute a sequence of actions, demonstrating how to:
Trigger 3 custom client-side callbacks (
demo:validate,demo:getClosest, anddemo:processKeys).Use the
userInputaction type to pause the sequence and capture the vehicle's SSID.Reward the player with the vehicle keys once the entire action sequence is successfully completed.

Last updated