List of Counter-Strike: Global Offensive Script Functions
Contents
- 1 Variables
- 2 Constants
- 3 Classes
- 3.1 CBaseEntity
- 3.2 CBaseAnimating
- 3.3 CBaseFlex
- 3.4 CBasePlayer
- 3.5 CBaseMultiplayerPlayer
- 3.6 CEnvEntityMaker
- 3.7 CPointTemplate
- 3.8 CSceneEntity
- 3.9 CTriggerCamera
- 3.10 CFuncTrackTrain
- 3.11 CHostage
- 3.12 CGameCoopMissionManager
- 3.13 CCallChainer
- 3.14 CEntities
- 3.15 CPlayerVoiceListener
- 3.16 CScriptKeyValues
- 3.17 CSimpleCallChainer
- 3.18 LateBinder
- 3.19 regexp
- 3.20 Vector
- 4 Global functions
- 5 See also
This list contains the engine-related Squirrel classes, functions and variables available for VScript in
Counter-Strike: Global Offensive. The official documentation can be printed in the console by setting
developer
to non-zero, loading a map, and executing script_help
.
Variables
Instance | Type | Description |
---|---|---|
Entities
|
CEntities
|
Provides access to spawned entities in the server. |
Constants
Instance | Type | Value |
---|---|---|
_charsize_
|
integer | 1 |
_floatsize_
|
integer | 4 |
_intsize_
|
integer | 4 |
_version_
|
string | "Squirrel 2.2.3 stable" |
RAND_MAX
|
integer | 32767 |
PI
|
float | 3.14159 |
Classes
CBaseEntity
This is a script handle class for entities. All entities spawned have a script handle using this or one of its subclasses.
All script handles in-game are accessible from Entities. Entity scripts can use self
to access their own script handle. activator
and caller
variables can be accessed on function calls.
Methods
Function | Signature | Description |
---|---|---|
__KeyValueFromInt
|
bool __KeyValueFromInt(string key, int value)
|
Sets entity keyvalue from an integer. |
__KeyValueFromFloat
|
bool __KeyValueFromFloat(string key, float value)
|
Sets entity keyvalue from a float. |
__KeyValueFromString
|
bool __KeyValueFromString(string key, string value)
|
Sets entity keyvalue from a string. |
__KeyValueFromVector
|
bool __KeyValueFromVector(string key, Vector value)
|
Sets entity keyvalue from a Vector. |
ConnectOutput
|
void ConnectOutput(string output, string function)
|
Adds an I/O connection that will call the named function when the specified output fires. |
DisconnectOutput
|
void DisconnectOutput(string output, string function)
|
Removes a connected script function from an I/O event. |
Destroy
|
void Destroy()
|
Kills the entity. |
EmitSound
|
void EmitSound(string soundname)
|
Plays a sound from this entity. |
entindex
|
int entindex()
|
Returns the entity index. |
EyePosition
|
Vector EyePosition()
|
Get vector to the eye position - absolute coordinates. |
FirstMoveChild
|
handle FirstMoveChild()
|
If in hierarchy, get the first move child. |
GetAngles
|
Vector GetAngles()
|
Get the entity pitch, yaw, roll as a Vector object. |
GetAngularVelocity
|
Vector GetAngularVelocity()
|
Get the local angular velocity - returns a Vector of pitch, yaw, roll. |
GetBoundingMaxs
|
Vector GetBoundingMaxs()
|
Get a vector containing max bounds, centered on object |
GetBoundingMins
|
Vector GetBoundingMins()
|
Get a vector containing min bounds, centered on object |
GetCenter
|
Vector GetCenter()
|
Get vector to center of object - local coords |
GetClassname
|
string GetClassname()
|
Get entity classname. |
GetForwardVector
|
Vector GetForwardVector()
|
Get the forward vector of the entity. |
GetHealth
|
int GetHealth()
|
Returns the current health. |
GetLeftVector
|
Vector GetLeftVector()
|
Get the right vector of the entity. |
GetMaxHealth
|
int GetMaxHealth()
|
Returns the maximum health. |
GetModelKeyValues
|
CScriptKeyValues GetModelKeyValues()
|
Returns the $keyvalues block of the entity's model as a #CScriptKeyValues object. Note that this is not the keyvalues of the entity itself. |
GetModelName
|
string GetModelName()
|
Returns the name of the model |
GetMoveParent
|
handle GetMoveParent()
|
If in hierarchy, retrieves the entity's parent. |
GetName
|
string GetName()
|
Returns the targetname of the entity. |
GetOrigin
|
Vector GetOrigin()
|
Returns this entity's local origin. |
GetOwner
|
handle GetOwner()
|
Gets this entity's owner. |
GetPreTemplateName
|
string GetPreTemplateName()
|
Get the entity name stripped of template unique decoration. This is the &048 suffix added by templates that do not preserve the entity name.
|
GetRootMoveParent
|
handle GetRootMoveParent()
|
If in hierarchy, walks up the hierarchy to find the root parent. |
GetScriptId
|
string GetScriptId()
|
Returns the thinkfunction keyvalue of the entity. |
GetScriptScope
|
handle GetScriptScope()
|
Retrieve the table storing the Entity Script data associated with this entity. |
GetSoundDuration
|
float GetSoundDuration(string soundname, string actormodel)
|
Returns float duration of the sound. |
GetTeam
|
int GetTeam()
|
Get the team this entity is on. |
GetUpVector
|
Vector GetUpVector()
|
Get the up vector of the entity. |
GetVelocity
|
Vector GetVelocity()
|
Get the velocity of the entity. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
NextMovePeer
|
handle NextMovePeer()
|
Return the next entity in the same movement hierarchy. |
PrecacheModel
|
void PrecacheModel(string modelname)
|
Precache a model. Expensive. |
PrecacheScriptSound
|
void PrecacheScriptSound(string soundname)
|
Precache a sound. Expensive. |
PrecacheSoundScript
|
void PrecacheSoundScript(string soundscript)
|
Precache a sound for later playing. Expensive. |
SetAbsOrigin
|
void SetAbsOrigin(Vector position)
|
Set absolute origin. |
SetAngles
|
void SetAngles(float pitch, float yaw, float roll)
|
Set entity pitch, yaw, roll. |
SetAngularVelocity
|
void SetAngularVelocity(float pitch, float yaw, float roll)
|
Set the local angular velocity - takes float pitch, yaw, roll velocities. |
SetForwardVector
|
void SetForwardVector(Vector forwardvec)
|
Set the orientation of the entity to have this forward vector. |
SetHealth
|
void SetHealth(int health)
|
Sets the current health. |
SetMaxHealth
|
void SetMaxHealth(int health)
|
Sets the maximum health. |
SetModel
|
void SetModel(string modelname)
|
Changes the model of the entity. Does not precache the model. |
SetOrigin
|
void SetOrigin(Vector position)
|
Set local origin. |
SetOwner
|
void SetOwner(handle owner)
|
Sets this entity's owner. |
SetSize
|
void SetSize(Vector mins, Vector maxs)
|
Sets the bounding box size. |
SetTeam
|
void SetTeam(int team)
|
Set the team this entity is on. |
SetVelocity
|
void SetVelocity(Vector velocity)
|
Set local velocity. |
StopSound
|
void StopSound(string soundname)
|
Stops a sound on this entity. |
ValidateScriptScope
|
bool ValidateScriptScope()
|
Ensure that an entity's script scope has been created. |
Hooks
If one of these functions are declared in an Entity Script, the entity will run this function automatically in the appropriate situation.
Function | Signature | Description |
---|---|---|
InputInputName
|
bool InputInputName()
|
Called when the entity receives an input from the I/O system. The name of the function needs to be Input followed by the name of the input in CamelCase, for example InputFireUser1 for the FireUser1 input. The function needs to return a boolean value. Setting it to true allows the entity to process the input, while false cancels it.
|
OnPostSpawn
|
void OnPostSpawn()
|
This is called after the entity has spawned. |
Precache
|
void Precache()
|
This is called during entity spawning and after restore to allow scripts to precache any resources they need. |
CBaseAnimating
Extends CBaseEntity
Script handle class for animating entities such as props.
Methods
Function | Signature | Description |
---|---|---|
GetAttachmentAngles
|
Vector GetAttachmentAngles(int id)
|
Get the attachment ID's angles as a pitch, yaw, roll vector. |
GetAttachmentOrigin
|
Vector GetAttachmentOrigin(int id)
|
Get the attachment ID's origin vector. |
IsSequenceFinished
|
bool IsSequenceFinished()
|
Ask whether the main sequence is done playing. |
LookupAttachment
|
int LookupAttachment(string attachmentName)
|
Get the named attachment ID. |
SetBodygroup
|
void SetBodygroup(int groupIndex, int value)
|
Sets the models bodygroup value by index. |
CBaseFlex
Extends CBaseAnimating
Methods
Function | Signature | Description |
---|---|---|
GetCurrentScene
|
handle GetCurrentScene()
|
Returns the instance of the oldest active scene entity (if any). |
GetSceneByIndex
|
handle GetSceneByIndex(int index)
|
Returns the instance of the scene entity at the specified index. |
CBasePlayer
Extends CBaseAnimating
Methods
Function | Signature | Description |
---|---|---|
IsNoclipping
|
bool IsNoclipping()
|
Returns true if the player is in noclip mode. |
CBaseMultiplayerPlayer
Extends CBasePlayer
Script handle class for the CS:GO players. No additional methods.
CEnvEntityMaker
Extends CBaseEntity
Script handle class for env_entity_maker.
Methods
Function | Signature | Description |
---|---|---|
SpawnEntity
|
void SpawnEntity()
|
Create an entity at the location of the maker |
SpawnEntityAtEntityOrigin
|
void SpawnEntityAtEntityOrigin(handle entity)
|
Create an entity at the location of a specified entity instance. |
SpawnEntityAtLocation
|
void SpawnEntityAtLocation(Vector origin, Vector orientation)
|
Create an entity at a specified location and orientation, orientation is Euler angle in degrees (pitch, yaw, roll). |
SpawnEntityAtNamedEntityOrigin
|
void SpawnEntityAtNamedEntityOrigin(string targetname)
|
Create an entity at the location of a named entity. |
CPointTemplate
Extends CBaseEntity
Script handle class for point_template.
Hooks
table PreSpawnInstance(string entityClass, string entityName)
- If this is defined, it will be called right before the entity is created, and any keyvalues returned will be assigned to the entity.
function PreSpawnInstance( entityClass, entityName )
{
local keyvalues =
{
rendercolor = "0 255 0",
targetname = "mySpawnedEntity"
}
return keyvalues
}
void PostSpawn(table entities)
- Called after the entities are spawned. A table with the handles of the spawned entities indexed by name is passed to the function. Could use this to connect outputs or do whatever needs to be done after the entity was created.

function PostSpawn( entities )
{
foreach( targetname, handle in entities )
{
printl( targetname + ": " + handle )
}
}
CSceneEntity
Extends CBaseEntity
Methods
Function | Signature | Description |
---|---|---|
AddBroadcastTeamTarget
|
void AddBroadcastTeamTarget(int index)
|
Adds a team (by index) to the broadcast list. |
EstimateLength
|
float EstimateLength()
|
Returns length of this scene in seconds. |
FindNamedEntity
|
handle FindNamedEntity(string reference)
|
given an entity reference, such as !target, get actual entity from scene object. |
IsPaused
|
bool IsPaused()
|
If this scene is currently paused. |
IsPlayingBack
|
bool IsPlayingBack()
|
If this scene is currently playing. |
LoadSceneFromString
|
bool LoadSceneFromString(string sceneName, string scene)
|
Given a dummy scene name and a vcd string, load the scene. |
RemoveBroadcastTeamTarget
|
void RemoveBroadcastTeamTarget(int index)
|
Removes a team (by index) from the broadcast list. |
CTriggerCamera
Extends CBaseEntity
Methods
Function | Signature | Description |
---|---|---|
GetFov
|
int GetFov()
|
Get cameras current Field Of View setting as integer. |
SetFov
|
void SetFov(int fov, float rate)
|
Set cameras current FOV in integer degrees and FOV change rate as float. |
Hooks
Function | Signature | Description |
---|---|---|
ScriptStartCameraShot
|
void ScriptStartCameraShot(string shotType, handle sceneEntity, handle actor1, handle actor2, float duration)
|
Called from SceneEntity in response to a CChoreoEvent::CAMERA sent from a VCD. To do |
CFuncTrackTrain
Extends CBaseEntity
Methods
Function | Signature | Description |
---|---|---|
GetFuturePosition
|
Vector GetFuturePosition(float x, float speed)
|
Get a position on the track x seconds in the future. |
CHostage
Extends CBaseEntity
Methods
Function | Signature | Description |
---|---|---|
IsBeingCarried
|
bool IsBeingCarried()
|
Get whether the hostage is currently being carried or not. |
CGameCoopMissionManager
Extends CBaseEntity
Methods
Function | Signature | Description |
---|---|---|
GetWaveNumber
|
int GetWaveNumber()
|
Get the number of waves the players have completed. |
CCallChainer
To do
Methods
Function | Signature | Description |
---|---|---|
constructor
|
constructor(prefixString, scopeForThis = null)
|
|
PostScriptExecute
|
PostScriptExecute()
|
|
Call
|
Call(event, ...)
|
Members
Instance | Type | Description |
---|---|---|
chains
|
null
|
|
prefix
|
null
|
|
scope
|
null
|
CEntities
Script instance: Entities
An interface to find and iterate over the script handles for the entities in play.
To iterate over a set of entities, pass null
to the previous argument in the appropriate method to start an iteration, or reference to a previously found entity to continue a search.
Methods
Function | Signature | Description |
---|---|---|
CreateByClassname
|
handle CreateByClassname(string classname)
|
Creates an entity by class name. |
FindByClassname
|
handle FindByClassname(handle previous, string classname)
|
Find entities by class name. |
FindByClassnameNearest
|
handle FindByClassnameNearest(string class, Vector origin, float radius)
|
Find the entity with the given class name nearest to the specified point. |
FindByClassnameWithin
|
handle FindByClassnameWithin(handle previous, string classname, Vector origin, float radius)
|
Find entities by class name within a radius. |
FindByModel
|
handle FindByModel(handle previous, string modelname)
|
Find entities by model name. |
FindByName
|
handle FindByName(handle previous, string targetname)
|
Find entities by name. |
FindByNameNearest
|
handle FindByNameNearest(string targetname, Vector origin, float radius)
|
Find entities by name nearest to a point. |
FindByNameWithin
|
handle FindByNameWithin(handle previous, string targetname, Vector origin, float radius)
|
Find entities by name within a radius. |
FindByTarget
|
handle FindByTarget(handle previous, string target)
|
Find entities by target keyvalue. |
FindInSphere
|
handle FindInSphere(handle previous, Vector origin, float radius)
|
Find entities within a radius. |
First
|
handle First()
|
Returns the first entity, typically worldspawn. Equivalent to Entities.Next(null)
|
Next
|
handle Next(handle previous)
|
Providing reference to a previously found entity, returns the next one in the list. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
CPlayerVoiceListener

PlayerVoiceListener
instance is not.
Methods
Function | Signature | Description |
---|---|---|
GetPlayerSpeechDuration
|
float GetPlayerSpeechDuration(int playerIndex)
|
Returns the number of seconds the player has been continuously speaking. |
IsPlayerSpeaking
|
bool IsPlayerSpeaking(int playerIndex)
|
Returns whether the player specified is speaking. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid entity. |
CScriptKeyValues
Script handle representation of a models $keyvalues block. Sub keys are instances of the same class.
Methods
Function | Signature | Description |
---|---|---|
constructor
| ||
FindKey
|
CScriptKeyValues FindKey(string key)
|
Find a sub key by the key name. |
GetFirstSubKey
|
CScriptKeyValues GetFirstSubKey()
|
Return the first sub key object. |
GetKeyBool
|
bool GetKeyBool(string key)
|
Return the key value as a bool. |
GetKeyFloat
|
float GetKeyFloat(string key)
|
Return the key value as a float. |
GetKeyInt
|
int GetKeyInt(string key)
|
Return the key value as an integer. |
GetKeyString
|
string GetKeyString(string key)
|
Return the key value as a string. |
GetNextKey
|
CScriptKeyValues GetNextKey()
|
Return the next neighbor key object to the one the method is called on. |
IsKeyEmpty
|
bool IsKeyEmpty(string key)
|
Returns true if the named key has no value. |
IsValid
|
bool IsValid()
|
Whether the handle belongs to a valid key. |
ReleaseKeyValues
|
void ReleaseKeyValues()
|
Releases the contents of the instance. |
CSimpleCallChainer
Has the same members as CCallChainer. To do
LateBinder
Late binding: allows a table to refer to parts of itself, it's children, it's owner, and then have the references fixed up after it's fully parsed.
// Usage:
lateBinder <- LateBinder();
lateBinder.Begin( this );
Test1 <-
{
Foo=1
}
Test2 <-
{
FooFoo = "I'm foo foo"
BarBar="@Test1.Foo"
SubTable = { boo=[bah, "@Test2.FooFoo", "@Test1.Foo"], booboo2={one=bah, two="@Test2.FooFoo", three="@Test1.Foo"} }
booboo=[bah, "@Test2.FooFoo", "@Test1.Foo"]
booboo2={one=bah, two="@Test2.FooFoo", three="@Test1.Foo"}
bah=wha
}
lateBinder.End();
delete lateBinder;
When End() is called, all of the unresolved symbols in the tables and arrays will be resolved, any left unresolved will become a string prepended with '~', which later code can deal with.
Methods
Function | Signature | Description |
---|---|---|
Begin
| ||
End
| ||
EstablishDelegation
| ||
HookRootMetamethod
| ||
Log
| ||
m_bindNamesStack
| ||
m_fixupSet
| ||
m_log
| ||
m_logIndent
| ||
m_targetTable
| ||
RemoveDelegation
| ||
Resolve
| ||
UnhookRootMetamethod
|
regexp
The built-in Squirrel class for regular expressions.
Methods
Function | Signature | Description |
---|---|---|
constructor
|
regexp()
|
|
capture
|
[table] capture(str, [start])
|
Returns an array of tables containing two indexes("begin" and "end")of the first match of the regular expression in the string str. An array entry is created for each captured sub expressions. If no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string. |
match
|
bool match(str)
|
Returns a true if the regular expression matches the string str, otherwise returns false. |
search
|
table search(str, [start])
|
Returns a table containing two indexes("begin" and "end") of the first match of the regular expression in the string str, otherwise if no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string. |
subexpcount
|
Vector
Squirrel equivalent of the C++ Vector class.
Three-dimensional vector.
Has overloaded operations for the following:
Vector * number
Vector + Vector
Vector - Vector
Methods
Function | Signature | Description |
---|---|---|
constructor
|
Vector(float x = 0, float y = 0, float z = 0)
|
Creates a new vector with the specified Cartesian coordiantes. |
Cross
|
float Cross(Vector factor)
|
The vector product of two vectors. Returns a vector orthogonal to the input vectors. |
Dot
|
float Dot(Vector factor)
|
The scalar product of two vectors. |
Length
|
float Length()
|
Length of the vector. |
LengthSqr
|
float LengthSqr()
|
Length of the vector squared. Cheaper than the above method. |
Length2D
|
float Length2D()
|
Returns the length of the vector on the x-y plane. |
Length2DSqr
|
float Length2DSqr()
|
Returns the square of the length of the vector on the x-y plane. Cheaper than the above method. |
Norm
|
float Norm()
|
Normalises the vector, returns the vector length. |
ToKVString
|
string ToKVString()
|
Returns a string without separations commas. |
Members
Instance | Type | Description |
---|---|---|
x
|
float
|
Cartesian X axis. |
y
|
float
|
Cartesian Y axis. |
z
|
float
|
Cartesian Z axis. |
Global functions
Printing and drawing
Function | Signature | Description |
---|---|---|
DebugDrawBox
|
void DebugDrawBox(vector origin, vector mins, vector maxs, int r, int g, int b, int alpha, float duration)
|
Draw a debug overlay box. |
DebugDrawLine
|
void DebugDrawLine(Vector start, Vector end, int r, int g, int b, bool noDepthTest, float duration)
|
Draw a debug line between two points. |
Msg
|
void Msg(string message)
|
Equivalent to print
|
print
|
void print(string message)
|
Prints the given message to the developer console. |
printl
|
void printl(string message)
|
Prints the given message to the developer console with newline. Equivalent to print(message + "\n")
|
ScriptPrintMessageCenterAll
|
void ScriptPrintMessageCenterAll(string message)
|
Prints an alert message in the center of the screen to all players. |
ScriptPrintMessageCenterAllWithParams
|
void ScriptPrintMessageCenterAllWithParams(string message, string param1, string param2, string param3)
|
Prints an alert message in the center print method to all players. Needs to pass token/message. |
ScriptPrintMessageCenterTeam
|
void ScriptPrintMessageCenterTeam(int, string)
|
Prints an alert message in the center of the screen to the specified team. |
ScriptPrintMessageChatAll
|
void ScriptPrintMessageChatAll(string message)
|
Prints a message in chat to all players. |
ScriptPrintMessageChatTeam
|
void ScriptPrintMessageChatTeam(int team, string message)
|
Prints a message in chat to the specified team. |
ShowMessage
|
void ShowMessage(string)
|
Print a hud message on all clients. ![]() /scripts/titles.txt |
__DumpScope
|
void __DumpScope(int indentation, table scope)
|
Dumps the contents of scope. |
Training Course
Function | Signature | Description |
---|---|---|
ScriptGetBestTrainingCourseTime
|
int ScriptGetBestTrainingCourseTime()
|
Gets the player's best time for completing the timed course. |
ScriptGetPlayerCompletedTraining
|
bool ScriptGetPlayerCompletedTraining()
|
Returns true if the player has completed the initial portion of the training map. |
ScriptGetValveTrainingCourseTime
|
int ScriptGetValveTrainingCourseTime()
|
Gets Valve's best time for completing the timed course. |
ScriptHighlightAmmoCounter
|
void ScriptHighlightAmmoCounter()
|
Sends an event that is just used by the instructor system to show a hint highlighting the ammo counter. |
ScriptSetBestTrainingCourseTime
|
void ScriptSetBestTrainingCourseTime(int time)
|
Sets the player's best time for completing the timed course. |
ScriptSetMiniScoreHidden
|
void ScriptSetMiniScoreHidden(bool hide)
|
Toggles the visibility of the miniscoreboard hud element. |
ScriptSetPlayerCompletedTraining
|
void ScriptSetPlayerCompletedTraining(bool completed)
|
Sets whether the player has completed the initial portion of the training map. |
ScriptSetRadarHidden
|
void ScriptSetRadarHidden(bool hide)
|
Toggles the visibility of the radar hud element. |
ScriptShowExitDoorMsg
|
void ScriptShowExitDoorMsg()
|
Shows a message box in trainign when the player exits through the exit door |
ScriptShowFinishMsgBox
|
void ScriptShowFinishMsgBox()
|
Shows a message box to let players know what to do next after finishing the training course. |
ScriptTrainingGivePlayerAmmo
|
void ScriptTrainingGivePlayerAmmo()
|
Refills ammo to max for all weapons the player has (only works in training). |
Co-op Strike
Function | Signature | Description |
---|---|---|
ScriptCoopCollectBonusCoin
|
void ScriptCoopCollectBonusCoin()
|
Marks one of the bonus coins as collected. |
ScriptCoopGiveC4sToCTs
|
void ScriptCoopGiveC4sToCTs(int)
|
Will give the number of specified C4s to all alive CT players. |
ScriptCoopMissionGetMissionNumber
|
int ScriptCoopMissionGetMissionNumber()
|
Gets the mission number for the current map - maps can have multiple missions on them. |
ScriptCoopMissionRespawnDeadPlayers
|
void ScriptCoopMissionRespawnDeadPlayers()
|
Respawns players only. |
ScriptCoopMissionSetDeadPlayerRespawnEnabled
|
void ScriptCoopMissionSetDeadPlayerRespawnEnabled(bool)
|
Controls whether player respawns can happen. |
ScriptCoopMissionSetNextRespawnIn
|
void ScriptCoopMissionSetNextRespawnIn(float, bool)
|
Set the next respawn wave to happen in this many seconds. |
ScriptCoopMissionSpawnFirstEnemies
|
void ScriptCoopMissionSpawnFirstEnemies(int)
|
Spawns the first wave of enemies in coop. |
ScriptCoopMissionSpawnNextWave
|
void ScriptCoopMissionSpawnNextWave(int)
|
Tells the next wave of enemies to spawn in coop. Also respawns player. |
ScriptCoopResetRoundStartTime
|
void ScriptCoopResetRoundStartTime()
|
Resets the round time and starts the mission. |
ScriptCoopSetBotQuotaAndRefreshSpawns
|
void ScriptCoopSetBotQuotaAndRefreshSpawns(int)
|
Sets the bot quota considering the # of players connected and refreshes the spawns. |
ScriptCoopExtendRoundDurationTime
|
void ScriptCoopExtendRoundDurationTime(float)
|
Extends the round time after checkpoint during the mission. |
ScriptCoopToggleEntityOutlineHighlights
|
void ScriptCoopToggleEntityOutlineHighlights(bool)
|
Highlights all dropped weapons for players, or removes all highlights. |
ScriptMissionResetDangerZones
|
void ScriptMissionResetDangerZones()
|
Resets all danger zone entities. |
ScriptMissionCreateAndDetonateDangerZone
|
void ScriptMissionCreateAndDetonateDangerZone(Vector, Vector)
|
Creates and detonates a danger zone at the given location moving towards target location. |
Premier Mode
Function | Signature | Description |
---|---|---|
ScriptLobbyMapVetoFinished
|
void ScriptLobbyMapVetoFinished(string mapname, bool, bool, string)
|
Switch to the selected map after lobby map veto finished. |
Math
The built-in Squirrel math library.
Function | Signature | Description |
---|---|---|
abs
|
int abs(float x)
|
Returns the absolute value of x as an integer. |
acos
|
float acos(float x)
|
Returns the arccosine of x. |
asin
|
float asin(float x)
|
Returns the arcsine of x. |
atan
|
float atan(float x)
|
Returns the arctangent of x. |
atan2
|
float atan2(float x, float y)
|
Returns the arctangent of x/y. |
ceil
|
float ceil(float x)
|
Returns a float value representing the smallest integer that is greater than or equal to x. |
cos
|
float cos(float x)
|
Returns the cosine of x. |
exp
|
float exp(float x)
|
Returns the exponential value of the float parameter x. |
fabs
|
float fabs(float x)
|
Returns the absolute value of x as a float. |
floor
|
float floor(float x)
|
Returns a float value representing the largest integer that is less than or equal to x. |
log
|
float log(float x)
|
Returns the natural logarithm of x. |
log10
|
float log10(float x)
|
Returns the logarithm base-10 of x. |
pow
|
float pow(float x, float y)
|
Returns x raised to the power of y. |
rand
|
int rand()
|
Returns a pseudorandom integer in the range 0 to RAND_MAX. |
sin
|
float sin(float x)
|
Returns the sine of x. |
sqrt
|
float sqrt(float x)
|
Returns the square root of x. |
srand
|
void srand(float seed)
|
Sets the starting point for generating a series of pseudorandom integers. |
tan
|
float tan(float x)
|
Returns the tangent of x. |
Other
Function | Signature | Description |
---|---|---|
Assert
|
void Assert(exp, string message = null)
|
Throws an exception if exp equates to false, optionally with message. |
CreateProp
|
handle CreateProp(string classname, Vector origin, string model, int animation)
|
Create a prop with the specified class and model. Both prop_physics, prop_dynamic as well as some other entity classes with models work. Does not precache the model. |
CreateSceneEntity
|
CSceneEntity CreateSceneEntity(string scene)
|
Create a scene entity to play the specified scene .vcd file. |
DispatchParticleEffect
|
void DispatchParticleEffect(string particle, Vector position, Vector orientation)
|
Dispatches a one-off particle system. |
DoIncludeScript
|
bool DoIncludeScript(string filename, table scope)
|
Execute a script file in the scope of scope. |
IncludeScript
|
bool IncludeScript(string filename, table scope = null)
|
Execute a script file in the scope of scope, this by default.
|
DoEntFire
|
void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
|
Generate an entity I/O event. |
EntFire
|
void EntFire(string target, string action, string value = "", float delay = 0.0, handle activator = null)
|
Generate an entity I/O event. |
EntFireByHandle
|
void EntFireByHandle(handle target, string action, string value, float delay, handle activator, handle caller)
|
Generate an entity I/O event. |
FrameTime
|
float FrameTime()
|
Get the time spent on the server in the last frame |
GetDeveloperLevel
|
int GetDeveloperLevel()
|
Gets the level of the developer mode. Equivalent to developer()
|
GetMapName
|
string GetMapName()
|
Get the name of the map. |
LoopSinglePlayerMaps
|
bool LoopSinglePlayerMaps()
|
Run the single player maps in a continuous loop. |
PrintHelp
|
void PrintHelp(string string = "*", bool exact = false)
|
Output help for script functions, optionally with a search string |
RandomFloat
|
float RandomFloat(float min, float max)
|
Generate a random floating point number within a range, inclusive |
RandomInt
|
int RandomInt(int min, int max)
|
Generate a random integer within a range, inclusive |
RecordAchievementEvent
|
void RecordAchievementEvent(string, int)
|
Records achievement event or progress |
RetrieveNativeSignature
|
void RetrieveNativeSignature(string nativeFunction)
|
|
ScriptGetGameMode
|
int ScriptGetGameMode()
|
Gets the current game mode. See, reference. |
ScriptGetGameType
|
int ScriptGetGameType()
|
Gets the current game type. |
ScriptGetRoundsPlayed
|
int ScriptGetRoundsPlayed()
|
Get the number of rounds played so far. |
ScriptIsLocalPlayerUsingController
|
bool ScriptIsLocalPlayerUsingController()
|
Returns whether the player is playing with a controller or not. |
ScriptIsWarmupPeriod
|
bool ScriptIsWarmupPeriod()
|
Is it warmup or not. |
SendToConsole
|
void SendToConsole(string command)
|
Send a string to the console as a command. The command is executed through the local player. |
SendToConsoleServer
|
void SendToConsoleServer(string command)
|
Send a string that gets executed on the server as a ServerCommand |
Time
|
float Time()
|
Get the current server time |
TraceLine
|
float TraceLine(Vector start, Vector end, handle ignore)
|
Given 2 points and entity to ignore, return fraction along line that hits world or models |
UniqueString
|
string UniqueString(string suffix = "")
|
Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table. Equivalent to DoUniqueString(suffix)
|
DoUniqueString
|
string DoUniqueString(string suffix)
|
Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table. |
__ReplaceClosures
|
void __ReplaceClosures(function script, table scope)
|
Internal function called in script_reload_ server commands.
|