List of CS:GO Script Functions

From Valve Developer Community
< Ru
Jump to navigation Jump to search
English (en)한국어 (ko)Русский (ru)中文 (zh)Translate (Translate)
Icon-delisted.png
На этой странице представлена информация об игре или программном обеспечении, Counter-Strike: Global Offensive Counter-Strike: Global Offensive, которые более не доступны для покупки или загрузки в цифровом виде.
Здесь представлена историческая и техническая справка.

Squirrel Этот список содержит классы, функции и переменные, доступные для VScript'а(en) в Counter-Strike: Global Offensive Counter-Strike: Global Offensive. Некоторые из них можно найти, если в консоли поставить значение developer на 1 (или больше), загрузить карту, и написать script_help. Обратите внимание, что developer должен быть не нулевым только во время загрузки карты. Для "выгрузки" script_help в файл, напишите в консоль следующее:

developer 3
map de_nuke
developer 0
con_logfile dump.log
script_help
con_logfile ""

Переменные

Класс Тип Описание
Entities CEntities Предоставляет доступ к заспавненным энтити на сервере.

Константы

Переменная Тип Значение
_charsize_ integer 1
_floatsize_ integer 4
_intsize_ integer 4
_version_ string "Squirrel 2.2.3 stable"
RAND_MAX integer 32767
PI float 3.14159

Классы

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.

Методы

Функция Сигнатура Описание
__KeyValueFromInt bool __KeyValueFromInt(string key, int value) Sets an entity Keyvalue(en) from an integer. Это просто изменяет значение без выполнения какого-либо кода, который может потребоваться объекту для обработки KeyValue, поэтому могут возникнуть непредвиденные побочные эффекты.
__KeyValueFromFloat bool __KeyValueFromFloat(string key, float value) Устанавливает ключевое значение сущности из числа с плавающей запятой. Это просто изменяет значение без выполнения какого-либо кода, который может потребоваться объекту для обработки KeyValue, поэтому могут возникнуть непредвиденные побочные эффекты.
__KeyValueFromString bool __KeyValueFromString(string key, string value) Устанавливает ключевое значение сущности из строки. Это просто изменяет значение без выполнения какого-либо кода, который может потребоваться объекту для обработки KeyValue, поэтому могут возникнуть непредвиденные побочные эффекты.
__KeyValueFromVector bool __KeyValueFromVector(string key, Vector value) Sets an entity Keyvalue from a Vector. Это просто изменяет значение без выполнения какого-либо кода, который может потребоваться объекту для обработки KeyValue, поэтому могут возникнуть непредвиденные побочные эффекты.
ConnectOutput void ConnectOutput(string output, string function) Добавляет соединение ввода-вывода, которое будет вызывать указанную функцию при срабатывании указанного вывода.
DisconnectOutput void DisconnectOutput(string output, string function) Удаляет подключенную функцию сценария из события ввода-вывода.
Destroy void Destroy() Уничтожает энтити.
EmitSound void EmitSound(string soundScript) Проигрывает звук из места расположения энтити.
entindex int entindex() Возвращает индекс энтити.
EyePosition Vector EyePosition() Возвращает вектор направления взгляда - абсолютные координаты.
FirstMoveChild handle FirstMoveChild() Если в иерархии, получите первый дочерний элемент.
GetAngles Vector GetAngles() Возвращает pitch, yaw, roll энтити в форме Vector.
GetAngularVelocity Vector GetAngularVelocity() Получить локальную угловую скорость - возвращает Vector от pitch, yaw, roll.
GetBoundingMaxs Vector GetBoundingMaxs() Returns the maximum extent of the entity bounding box as a local vector.
GetBoundingMins Vector GetBoundingMins() Returns the maximum extent of the entity bounding box as a local vector.
GetCenter Vector GetCenter() Returns a local vector of the bounding box center.
GetClassname string GetClassname() Returns the entity class. This includes player.
GetForwardVector Vector GetForwardVector() Get the forward vector of the entity.
GetHealth int GetHealth() Возвращает текущее здоровье.
GetLeftVector Vector GetLeftVector() Get the left vector of the entity.
GetMaxHealth int GetMaxHealth() Возвращает максимальное здоровье.
GetModelKeyValues Keyvalues GetModelKeyValues() Returns the [$keyvalues] block of the entitys model as a #Keyvalues object. Note that this is not the keyvalues of the entity itself.
GetModelName string GetModelName() Возвращает имя модели энтити.
GetMoveParent CBaseEntity GetMoveParent() If in hierarchy, retrieves the entitys parent.
GetName string GetName() Возвращает имя энтити.
GetOrigin Vector GetOrigin() Возвращает позицию энтити.
GetOwner handle GetOwner() Gets this entity's owner. (seems to only be useful if you have used SetOwner() previously on this entity, could be wrong)
GetPreTemplateName string GetPreTemplateName() Get the entity name stripped of template unique decoration.
GetRootMoveParent handle GetRootMoveParent() If in hierarchy, walks up the hierarchy to find the root parent.
GetScriptId string GetScriptId() Retrieve the unique identifier used to refer to the entity within the scripting system.
GetScriptScope handle GetScriptScope() Retrieve the table storing the Entity Script data associated with this entity.
GetSoundDuration float GetSoundDuration(string soundName, string actorModelName = "") Returns float duration of the sound. Takes soundname and optional actormodelname.
GetTeam int GetTeam() Возвращает номер команды игрока. Т = 2, КТ = 3.
GetUpVector Vector GetUpVector() Get the up vector of the entity.
GetVelocity Vector GetVelocity() Returns a local velocity Vector.
IsValid bool IsValid() Whether the handle belongs to a valid entity.
NextMovePeer handle NextMovePeer()
PrecacheModel void PrecacheModel(string modelPath) Кэширует модель после загрузки карты.
PrecacheScriptSound void PrecacheScriptSound(string soundName)
PrecacheSoundScript void PrecacheSoundScript(string soundScript) Кэширует звук для дальнейшего использования.
SetAbsOrigin void SetAbsOrigin(Vector position) Same as SetOrigin().
SetAngles void SetAngles(float pitch, float yaw, float roll) Set entity pitch, yaw, roll. Note that it doesn't take a Vector object.
SetAngularVelocity void SetAngularVelocity(float pitch, float yaw, float roll) Set the local angular velocity - takes float pitch, yaw, roll velocities.
SetForwardVector void SetForwardVector(Vector forwardVector) Set the orientation of the entity to have this forward vector.
SetHealth void SetHealth(int newHealth) Устанавливает здоровье.
SetMaxHealth void SetMaxHealth(int maxHealth) Устанавливает максимальное здоровье.
SetModel void SetModel(string modelName) Изменяет модель энтити. Не кэширует модель.
SetOrigin void SetOrigin(Vector position) Moves the entity to this global position vector.
SetOwner void SetOwner(handle owner) Sets this entity's owner.
SetSize void SetSize(Vector, Vector) Sets the bounding box size.
SetTeam void SetTeam(int teamNumber) Instantly switches a players team. Terrorists = 2, CTs = 3.
SetVelocity void SetVelocity(Vector velocity) Gives the entity a new local velocity.
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.

Функция Сигнатура Описание
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. When the function is called, the activating and calling entities Script Handles are written to the receiving entitys Script Scope in the activator and caller variables. 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() Called immediately after the entity spawns. This could be used to have an entity register itself with a master script, or adjusting the entity parameters in a programmatic way.
Precache void Precache() Called after the script executes. Can be used to call precache functions for models and sounds on map load.

CBaseAnimating

Extends CBaseEntity

Script handle class for animating entities such as props.

Методы

Функция Сигнатура Описание
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.
Нужно сделать: How do you find the index?


CBaseFlex

Extends CBaseAnimating

Методы

Функция Сигнатура Описание
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

Методы

Функция Сигнатура Описание
IsNoclipping bool IsNoclipping() Возвращает true, если игрок в режиме noclip.

CBaseMultiplayerPlayer

Extends CBasePlayer

Script handle class for the CS:GO players. No additional methods.


CEnvEntityMaker

Extends CBaseEntity

Script handle class for env_entity_maker(en).

Методы

Функция Сигнатура Описание
SpawnEntity void SpawnEntity() Create an entity at the location of the maker
SpawnEntityAtEntityOrigin void SpawnEntityAtEntityOrigin(CBaseEntity 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(en).

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.
Note.pngПримечание:PostSpawn() will not be called unless the PreSpawnInstance() function is also defined in the script.
function PostSpawn( entities )
{
	foreach( targetname, handle in entities )
	{
		printl( targetname + ": " + handle )
	}
}

CSceneEntity

Extends CBaseEntity


Методы

Функция Сигнатура Описание
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


Методы

Функция Сигнатура Описание
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

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. [Нужно сделать]


CFuncTrackTrain

Extends CBaseEntity

Методы

Функция Сигнатура Описание
GetFuturePosition Vector GetFuturePosition(float x, float speed) Get a position on the track x seconds in the future.


CHostage

Extends CBaseEntity

Методы

Функция Сигнатура Описание
IsBeingCarried bool IsBeingCarried() Get whether the hostage is currently being carried or not.


CGameCoopMissionManager

Extends CBaseEntity

Методы

Функция Сигнатура Описание
GetWaveNumber int GetWaveNumber() Получает количество пройденных игроком волн.

CCallChainer

[Нужно сделать]

Методы

Функция Сигнатура Описание
constructor constructor(prefixString, scopeForThis = null)
PostScriptExecute PostScriptExecute()
Call Call(event, ...)

Members

Класс Тип Описание
chains null
prefix null
scope null


CEntities

Game 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.

Методы

Функция Сигнатура Описание
CreateByClassname handle CreateByClassname(string class) Создает энтити по названию класса.
FindByClassname handle FindByClassname(handle previous, string class) Находит энтити по названию класса.
FindByClassnameNearest handle FindByClassnameNearest(string class, Vector origin, float radius) Находит энтити по названию класса рядом с определенной точкой.
FindByClassnameWithin handle FindByClassnameWithin(handle previous, string class, Vector origin, float radius) Находит энтити по названию класа в определенном радиусе.
FindByModel handle FindByModel(handle previous, string filename) Находит энтити по названию модели.
FindByName handle FindByName(handle previous, string name) Находит энтити по имени.
FindByNameNearest handle FindByNameNearest(string name, Vector origin, float radius) Находит энтити по имени рядом с определенной точкой.
FindByNameWithin handle FindByNameWithin(handle previous, string name, Vector origin, float radius) Находит энтити по имени в определенном радиусе.
FindByTarget handle FindByTarget(handle previous, string targetname) Находит энтити по ее цели.
FindInSphere handle FindInSphere(handle previous, Vector origin, float radius) Находит энтити в радиусе.
First handle First() Begin an iteration over the list of entities.
Next handle Next(handle previous) Continue an iteration over the list of entities, providing reference to a previously found entity.
IsValid bool IsValid() Whether the handle belongs to a valid entity.

CPlayerVoiceListener

Нужно сделать: What is the int parameter to the methods.

Методы

Функция Сигнатура Описание
GetPlayerSpeechDuration float GetPlayerSpeechDuration(int) Returns the number of seconds the player has been continuously speaking.
IsPlayerSpeaking bool IsPlayerSpeaking(int) 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(en) block. Sub keys are instances of the same class.

Методы

Функция Сигнатура Описание
constructor
FindKey CScriptKeyValues FindKey(string keyName) Find a sub key by the key name.
GetFirstSubKey CScriptKeyValues GetFirstSubKey() Return the first sub key object.
GetKeyBool bool GetKeyBool(string keyName) Return the key value as a bool.
GetKeyFloat float GetKeyFloat(string keyName) Return the key value as a float.
GetKeyInt int GetKeyInt(string keyName) Return the key value as an integer.
GetKeyString string GetKeyString(string keyName) Return the key value as a string.
GetNextKey handle GetNextKey() Return the next neighbor key object to the one the method is called on.
IsKeyEmpty bool IsKeyEmpty(string keyName) Returns true if the named key has no value.
IsValid bool IsValid() Whether the handle belongs to a valid entity.
ReleaseKeyValues void ReleaseKeyValues() Releases the contents of the instance.


CSimpleCallChainer

Seems to have the same members as CCallChainer. [Нужно сделать]


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.

Методы

Функция Сигнатура Описание
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.

Методы

Функция Сигнатура Описание
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(en) class.

Three-dimensional vector.

Has overloaded arithmetic operations with both Vectors and scalar values.

Note.pngПримечание:Example declaration and manipulation of Vector

Методы

Функция Сигнатура Описание
constructor Vector(float x, float y, float z) 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() Magnitude of the vector.
LengthSqr float LengthSqr() The magnitude of the vector squared. Faster than the above method.
Length2D float Length2D() Returns the magnitude of the vector on the x-y plane.
Length2DSqr float Length2DSqr() Returns the square of the magnitude of the vector on the x-y plane. Faster than the above method.
Norm float Norm() Will return the vector length as a float. This function will also NORMALIZE the vector, the X, Y, and Z values will each be set to a number between -1 and 1. You can then multiply these values by, for example, 3000 to use the vector to set the velocity of something in game.
ToKVString string ToKVString() Returns a string without separations commas.

Members

Класс Тип Описание
x float Cartesian X axis.
y float Cartesian Y axis.
z float Cartesian Z axis.


Глобальные функции

Печать и Рисование

Функция Сигнатура Описание
DebugDrawBox void DebugDrawBox(vector origin, vector min, vector max, int r, int g, int b, int alpha, float duration) Draw a debug overlay box.
DebugDrawLine void DebugDrawLine(Vector start, Vector end, int red, int green, int blue', bool zTest, float time) 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 just like print but also appends a newline.
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. param1, param2, param3. Can pass null if you need less than 3.
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 teamNumber, string message) Prints a message in chat to the specified team.
ShowMessage void ShowMessage(string) Print a hud message on all clients.
Icon-Bug.pngБаг:Non-functional  [todo tested in?]
__DumpScope void __DumpScope(int indentation, handle scope) Dumps contents of everything in the scope.


Связанное с курсом тренировки

Функция Сигнатура Описание
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 bestTime) Sets the player's best time for completing the timed course.
ScriptSetMiniScoreHidden void ScriptSetMiniScoreHidden(bool scoreHidden) Toggles the visibility of the miniscoreboard hud element.
ScriptSetPlayerCompletedTraining void ScriptSetPlayerCompletedTraining(bool trainingCompleted) Sets whether the player has completed the initial portion of the training map.
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

Функция Сигнатура Описание
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.
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.

Связанное с математикой

Встроенные в Библиотеку Squirrel математические функции.

Функция Сигнатура Описание
abs int abs(float x) Возвращает абсолютное значение x как integer.
acos float acos(float x) Возвращает arccos числа x.
asin float asin(float x) Возвращает arcsin числа x.
atan float atan(float x) Возвращает arctg числа x.
atan2 float atan2(float x, float y) Возвращает arctg числа x/y.
ceil float ceil(float x) Возвращает наименьшее integer число (в виде float), которое больше или равно числу x.
cos float cos(float x) Возвращает косинус числа x.
exp float exp(float x) Возвращает экспоненту числа x.
fabs float fabs(float x) Возвращает абсолютное значение x как float.
floor float floor(float x) Возвращает наибольшее integer число (в виде float), которое меньше или равно числу x.
log float log(float x) Возвращает натуральный логарифм числа x.
log10 float log10(float x) Возвращает десятичный логарифм x.
pow float pow(float x, float y) Возвращает число x в степени y.
rand int rand() Возвращает псевдослучайное integer от 0 до RAND_MAX.
sin float sin(float x) Возвращает синус числа x.
sqrt float sqrt(float x) Возвращает квадратный корень числа x.
srand void srand(float seed) Устанавливает начальную точку для генерации серии псевдослучайных чисел.
tan float tan(float x) Возвращает тангенс числа x.

Другое

Функция Сигнатура Описание
Assert void Assert(bool value, string optional message) Test value and if not true, throws exception, optionally with message.
CreateProp handle CreateProp(string class, 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.
Icon-Bug.pngБаг:Does not initialize the physics of the prop.  [todo tested in?]
CreateSceneEntity CSceneEntity CreateSceneEntity(string scene) Create a scene entity to play the specified scene .vcd file.
DispatchParticleEffect void DispatchParticleEffect(string particleName, Vector, Vector) Dispatches a one-off particle system.
DoIncludeScript bool DoIncludeScript(string filename, table scope) Execute a script with the script scope set to the specified table.
DoEntFire void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller) Generate an entity I/O event. The caller argument takes a script handle, so it can be used with target set to !self to fire inputs to entities without usable targetnames.
EntFire function 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. The first parameter is an entity instance, so the handles of nameless or script generated entities can be passed easily.
FrameTime float FrameTime() Get the time spent on the server in the last frame
GetDeveloperLevel int GetDeveloperLevel() Gets the level of the developer mode.
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() Generate a random floating point number.
RandomFloat float RandomFloat(float min, float max) Generate a random floating point number within a range, inclusive
RandomInt int RandomInt() Generate a random integer.
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 or func) Name suggests it would print the calling format for a native function, but I can't get it to output anything other than <unnamed>
ScriptGetGameMode int ScriptGetGameMode() Retrieves the set game_mode. See this list for a settings vs modes overview.
ScriptGetGameType int ScriptGetGameType() Retrieves the set game_type. See this list for a settings vs modes overview.
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.
ScriptSetRadarHidden void ScriptSetRadarHidden(bool hideRadar) Toggles the visibility of the radar hud element. Only works in training mode (game_type 2, game_mode 0) and only for the first person connected.
SendToConsole void SendToConsole(string command) Send a string to the console as a command.
SendToConsoleServer void SendToConsoleServer(string) Send a string that gets executed on the server as a ServerCommand
Time float Time() Get the current server time
TraceLine float TraceLine(Vector, Vector, handle) given 2 points & ent to ignore, return fraction along line that hits world or models
UniqueString function UniqueString(string) 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.

Смотрите также