Globals - tayjay/SCriPt GitHub Wiki

The following are global variables that can be accessed from anywhere in the code.

AdminToys

For spawning and interacting with Admin Toys. These are Unity primitive or custom objects that can be spawned in the game such as cubes, spheres, lights, speakers, and NPC toys.

Type Function Arguments
TextToy AdminToys:SpawnText Vector3 position
Quaternion rotation
string text
LightSourceToy AdminToys:SpawnLightSource Vector3 position
float intensity
Color? color
float range
ShootingTargetToy AdminToys:SpawnShootingTarget Vector3 position
Quaternion rotation
Vector3 scale
SpeakerToy AdminToys:SpawnSpeaker Vector3 position
Quaternion rotation
Vector3 scale
CapybaraToy AdminToys:SpawnCapybara Vector3 position
Quaternion rotation
Vector3 scale
bool collidable
PrimitiveObjectToy AdminToys:SpawnPrimitiveObject PrimitiveType type
Vector3 position
Quaternion rotation
Vector3 scale
Color color
bool collidable

Coroutines

For managing delayed and repeated code execution inside scripts.

Type Function Arguments
CoroutineHandle Coroutines:CallDelayed float delay
Closure closure
CoroutineHandle Coroutines:CallDelayed float delay
Closure closure
object[] args
CoroutineHandle Coroutines:CallCoroutine Closure closure
CoroutineHandle Coroutines:CallCoroutine Closure closure
object[] args
CoroutineHandle Coroutines:RunCoroutine Closure closure
CoroutineHandle Coroutines:RunCoroutine Closure closure
object[] args
CoroutineHandle Coroutines:CallContinuously float timeframe
Closure closure
CoroutineHandle Coroutines:CallContinuously float timeframe
Closure closure
object[] args
CoroutineHandle Coroutines:CallPeriodically float timeframe
float period
Closure closure
CoroutineHandle Coroutines:CallPeriodically float timeframe
float period
Closure closure
object[] args
void Coroutines:Kill CoroutineHandle handle
void Coroutines:KillCoroutine CoroutineHandle handle
void Coroutines:KillAll
float Coroutines:WaitForSeconds float seconds

Data

For storing and retrieving persistent custom script data.

Type Function Arguments
LuaCustomData Data:Get string name

DeadmanSwitch

For controlling the warhead deadman switch system.

Type Function Arguments
void DeadmanSwitch:Initiate float addDelay
void DeadmanSwitch:Disable
void DeadmanSwitch:Enable

Decon

For controlling LCZ decontamination.

Type Function Arguments
void Decon:Disable
void Decon:Force
void Decon:Reset

Dummy

For spawning and controlling dummy players for testing and events.

Type Function Arguments
Player Dummy:Spawn string name
Player Dummy:Remove Player dummy
Table Dummy:GetDummyActions Player dummy
float Dummy:Action Player dummy
string action
void Dummy:ActionSequence Player dummy
Table sequence

Events

For accessing all scriptable event handlers.

Event categories are accessed as Events.<Category>, and are discovered automatically from LabAPI — new categories appear without a plugin update. The common ones, with their nickname aliases, are:

Category Aliases
Events.Server
Events.Player
Events.Warhead
Events.Objective
Events.Scp049 Events.Doctor
Events.Scp0492 Events.Zombie
Events.Scp079
Events.Scp096 Events.ShyGuy
Events.Scp106 Events.Larry
Events.Scp127
Events.Scp173 Events.Peanut
Events.Scp914
Events.Scp939 Events.Dog
Events.Scp3114 Events.Skeleton

See the Events page for the full list of events and their arguments.


Http

For making outbound HTTP requests. Disabled by default — set HttpEnabled in the config. See HTTP Requests for the full lifecycle guide.

Type Function Arguments
void Http.Get string url
Closure callback
void Http.Post string url
string body
Closure callback
void Http.Post string url
string body
string contentType
Closure callback

The callback receives (success, body, status) and runs on the main thread once the response arrives.


Lobby

For controlling the pre-game lobby.

Type Function Arguments
void Lobby:Lock
void Lobby:Unlock

New

For creating new Unity value types from Lua.

Type Variable Interaction
Func New:Vector3 Static
Func New:Vector2 Static
Func New:Quaternion Static
Func New:Color Static

You can often skip New entirely: a Lua table like {x=1, y=2, z=3} (or {1, 2, 3}) is automatically converted to a Vector3/Vector2/Quaternion/Color wherever one is expected, and enum values can be passed as strings. See Type Conversions.


Players

For retrieving and interacting with players.

Type Function Arguments
Player Player:ByName string name
Player Player:ByUserId string id
Player Player:ById int id
Player Player:ByNetId int netId
Player Player:ByReferenceHub ReferenceHub hub
IReadOnlyCollection Player:ByRole RoleTypeId role
IReadOnlyCollection Player:ByTeam Team team
IReadOnlyCollection Player:ByZone FacilityZone zone
Player Player:Random
IReadOnlyCollection Player:All

Round

For controlling and monitoring the game round.

Type Function Arguments
void Round:Lock
void Round:Unlock
void Round:Start
void Round:Restart
void Round:End
Type Variable Interaction
bool Round.CanRoundEnd Get
bool Round.InProgress Get
bool Round.IsLocked Get
bool Round.IsEnded Get
int Round.ExtraTargets Get/Set
int Round.TargetCount Get/Set

SCriPt

For creating modules, commands, and registering types in SCriPt.

Type Function Arguments
LuaModule SCriPt:Module string name
LuaModule SCriPt:Mod string name
LuaCustomCommand SCriPt:Command CommandType type
string name
string[] aliases
string description
string permission
Closure execute
LuaCustomSettings SCriPt:Settings Table settings
Closure callback
void SCriPt:RegisterType string typeName

Server

For retrieving server info and sending remote/local admin commands.

Type Variable Interaction
int Server.Port Get
string Server.Name Get
string Server.IpAddress Get
int Server.PlayerCount Get
int Server.MaxPlayers Get
bool Server.IdleModeAvailable Get/Set
bool Server.IdleModeActive Get
bool Server.FriendlyFire Get/Set
List Server.RemoteAdmins Get
Type Function Arguments
string Server:RACommand string command
string Server:RACommandAs string command
Player player
string Server:LACommand string command
void Server:SendBroadcast string message
ushort duration
void Server:Restart
void Server:Shutdown

RACommand and RACommandAs execute RemoteAdmin commands as the server console and require the full_access config option to be enabled. See the Dangerous page.

Settings

For creating Server Specific Settings.

Type Function Arguments
SSButton Settings:Button string name,
string buttonText,
string hint = nil
SSGroupHeader Settings:GroupHeader string label,
string hint = nil
SSTextArea Settings:TextArea string content
SSDropdownSetting Settings:Dropdown string label,
string[] options,
int selectedIndex,
string hint = nil
SSKeybindSetting Settings:Keybind string label,
KeyCode defaultKey = KeyCode.None,
string hint = nil
SSPlaintextSetting Settings:Plaintext string label,
string content,
string hint = nil,
ContentType contentType = ContentType.Standard
SSSliderSetting Settings:Slider string label,
float minValue,
float maxValue,
float defaultValue,
string hint = nil
SSTwoButtonsSetting Settings:TwoButtons string label,
string buttonAText,
string buttonBText,
defaultIsB = false,
string hint = nil
ServerSpecificSettingBase Settings:GetSettingOfPlayer Player player,
int id

Time

For retrieving server and round time.

Type Variable Interaction
long Time.ServerTimeUtc Get
long Time.ServerTimeLocal Get
double Time.RoundDuration Get
DateTime Time.ServerDateTimeUtc Get
DateTime Time.ServerDateTimeLocal Get
TimeSpan Time.RoundTimeSpan Get
Type Function Arguments
TimeSpan Time:MillisecondsToTimeSpan long milliseconds
TimeSpan Time:SecondsToTimeSpan double seconds

Warhead

Interacting with the Alpha Warhead system, which is the nuclear warhead in the game.

Type Variable Interaction
double Warhead.CooldownTime Get/Set
float Warhead.DetonationTime Get/Set
bool Warhead.LeverStatus Get/Set
Type Function Arguments
void Warhead:Lock
void Warhead:Unlock
void Warhead:Start
void Warhead:Stop
void Warhead:Shake
⚠️ **GitHub.com Fallback** ⚠️