Zh/List of CS:GO Script Functions
 这份清单包含了Template:Game link中的与引擎相关的可用于VScript的Squirrel类、函数以及可用的变量. 加载一个地图然后执行script_help, 并且将developer的级别设置为至少1, 可以把这份清单中的部分内容显示于控制台中.  值得一提的是, developer的级别只要不为0, 且加载了任意的地图, 就可以把script_help指令所显示的内容转存到文件中. 步骤如下(请一步一步地在控制台中键入每一行指令):
developer 3
map de_nuke
developer 0
con_logfile dump.txt
script_help
con_logfile ""
这条内容由Dazai Nerau译自英文版页面. 欢迎任何人补充新内容或者修改其中的错误.
变量
| 实例 | 类型 | 描述 | 
|---|---|---|
Entities
 | 
CEntities
 | 
提供一个对当前已生成的实体的访问方式. | 
常量
| 实例 | 类型 | 描述 | 
|---|---|---|
_charsize_
 | 
integer | |
_floatsize_
 | 
integer | |
_intsize_
 | 
integer | |
_version_
 | 
string | Squirrel的版本号. | 
_versionnumber_
 | 
integer | Squirrel的版本号的整数形式. | 
RAND_MAX
 | 
integer | 
类
CBaseEntity
CBaseEntity是实体的脚本句柄类. 所有已生成的实体都有一个使用CBaseEntity或者其子类的的脚本句柄.
所有游戏中的脚本句柄都可以从Entities中访问. 实体脚本可以通过 self来访问它们自身的脚本句柄.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
__KeyValueFromInt
 | 
void __KeyValueFromInt(string key, int value)
 | 
以整数设置实体的键值(KeyValue). 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. | 
__KeyValueFromFloat
 | 
void __KeyValueFromFloat(string key, float value)
 | 
以浮点数设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. | 
__KeyValueFromString
 | 
void __KeyValueFromString(string key, string value)
 | 
以字符串设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. | 
__KeyValueFromVector
 | 
void __KeyValueFromVector(string key, Vector value)
 | 
以向量(Vector)设置实体的KeyValue. 这个函数只修改数值而不执行实体处理KeyValue所需要的任何代码, 所以可能会有令人意想不到的副作用. | 
ConnectOutput
 | 
void ConnectOutput(string output, string function)
 | 
添加一个I/O关联, 当指定的输出触发时将调用指定的函数. | 
DisconnectOutput
 | 
void DisconnectOutput(string output, string function)
 | 
从I/O事件中删除一个已关联的脚本函数. | 
Destroy
 | 
void Destroy()
 | 
删除实体. | 
EmitSound
 | 
void EmitSound(string soundScript)
 | 
在这个实体上播放声音. | 
entindex
 | 
int entindex()
 | 
返回实体的索引. | 
EyePosition
 | 
Vector EyePosition()
 | 
获取眼睛位置的向量(备注:绝对坐标). | 
FirstMoveChild
 | 
handle FirstMoveChild()
 | 
无 | 
GetAngles
 | 
Vector GetAngles()
 | 
以向量形式获取实体的欧拉角(pitch, yaw, roll). | 
GetAngularVelocity
 | 
Vector GetAngularVelocity()
 | 
获取实体的角速度(备注:返回pitch、yaw、roll的向量). | 
GetBoundingMaxs
 | 
Vector GetBoundingMaxs()
 | 
将实体边界框的最大范围以向量返回。 | 
GetBoundingMins
 | 
Vector GetBoundingMins()
 | 
将实体边界框的最小范围以向量返回. | 
GetCenter
 | 
Vector GetCenter()
 | 
返回边界框中心位置的向量. | 
GetClassname
 | 
string GetClassname()
 | 
返回实体的种类名. (备注:包含player).
 | 
GetForwardVector
 | 
Vector GetForwardVector()
 | 
返回实体的前向量. | 
GetHealth
 | 
int GetHealth()
 | 
返回实体当前的生命值. | 
GetLeftVector
 | 
Vector GetLeftVector()
 | 
返回实体的左向量. | 
GetMaxHealth
 | 
int GetMaxHealth()
 | 
返回实体的最大生命值. | 
GetModelKeyValues
 | 
Keyvalues GetModelKeyValues()
 | 
返回实体模型的[$keyvalues]块作为一个#Keyvalues对象. 请注意, 这并非实体自身的keyvalues. | 
GetModelName
 | 
string GetModelName()
 | 
返回实体模型的文件名. | 
GetMoveParent
 | 
CBaseEntity GetMoveParent()
 | 
如果实体位于层次结构(hierarchy)中, 检索实体的父级(parent). | 
GetName
 | 
string GetName()
 | 
返回实体的targetname. | 
GetOrigin
 | 
Vector GetOrigin()
 | 
返回实体的位置. | 
GetOwner
 | 
handle GetOwner()
 | 
获取实体的所有者(owner). (备注:似乎只有当需要在这个实体上使用SetOwner()时这个函数才有用, 可能也不尽然) | 
GetPreTemplateName
 | 
string GetPreTemplateName()
 | 
获取去除独特模版装饰的实体名. | 
GetRootMoveParent
 | 
handle GetRootMoveParent()
 | 
如果实体位于层次结构中,顺着层次结构检索实体的根父级. | 
GetScriptId
 | 
string GetScriptId()
 | 
检索用于引用脚本系统中的实体的唯一标识符. | 
GetScriptScope
 | 
handle GetScriptScope()
 | 
检索存储与此实体关联的实体脚本数据的表. | 
GetSoundDuration
 | 
float GetSoundDuration(string soundName, string actorModelName = "")
 | 
以浮点数返回声音的持续时间. (备注:采用"soundName"和可选的"actorModelName"作为搜索参数) | 
GetTeam
 | 
int GetTeam()
 | 
返回玩家的队伍. (备注:观察者 = 1, 恐怖分子 = 2, 反恐精英 = 3). | 
GetUpVector
 | 
Vector GetUpVector()
 | 
获取实体的顶向量. | 
GetVelocity
 | 
Vector GetVelocity()
 | 
返回实体的速度向量. | 
IsValid
 | 
bool IsValid()
 | 
句柄是否属于有效的实体. | 
NextMovePeer
 | 
handle NextMovePeer()
 | 
无 | 
PrecacheModel
 | 
void PrecacheModel(string modelPath)
 | 
在地图加载完成后预缓存一个模型. | 
PrecacheScriptSound
 | 
void PrecacheScriptSound(string soundName)
 | 
无 | 
PrecacheSoundScript
 | 
void PrecacheSoundScript(string soundScript)
 | 
预缓存一个将会被播放的声音. | 
SetAbsOrigin
 | 
void SetAbsOrigin(Vector position)
 | 
与SetOrigin()功能相同. | 
SetAngles
 | 
void SetAngles(float pitch, float yaw, float roll)
 | 
设置实体的pitch, yaw, roll. 请注意, 这里并不使用向量. | 
SetAngularVelocity
 | 
void SetAngularVelocity(float pitch, float yaw, float roll)
 | 
设置实体的角速度.(备注:采用pitch, yaw和roll的浮点数形式的角速度). | 
SetForwardVector
 | 
void SetForwardVector(Vector forwardVector)
 | 
设置实体的前向量. | 
SetHealth
 | 
void SetHealth(int newHealth)
 | 
设置实体的生命值. | 
SetMaxHealth
 | 
void SetMaxHealth(int maxHealth)
 | 
设置实体的最大生命值. | 
SetModel
 | 
void SetModel(string modelName)
 | 
改变实体的模型, 这个函数并不预缓存模型!  待完善: 检查副作用 
 | 
SetOrigin
 | 
void SetOrigin(Vector position)
 | 
将实体移动到指定位置. | 
SetOwner
 | 
void SetOwner(handle owner)
 | 
设置实体的所有者. | 
SetSize
 | 
void SetSize(Vector, Vector)
 | 
无 | 
SetTeam
 | 
void SetTeam(int teamNumber)
 | 
立即转换玩家的团队. (备注:观察者 = 1, 恐怖分子 = 2, 反恐精英 = 3) | 
SetVelocity
 | 
void SetVelocity(Vector velocity)
 | 
设置实体的速度向量. | 
ValidateScriptScope
 | 
bool ValidateScriptScope()
 | 
实体的脚本数据是否已被创建. | 
Hooks
如果其中一个函数在实体脚本中被声明, 实体将在适当的情况下自动运行此函数.
| 函数 | 签名 | 描述 | 
|---|---|---|
InputInputName
 | 
bool InputInputName()
 | 
当实体从I/O系统中接收到输入时调用. 此函数的名称必须是实体input列表中的Input, 例如表示FireUser1的InputFireUser1. 当这个函数被调用时, 激活和调用的实体的脚本句柄会被写入接收输入的实体的脚本数据的activator和caller变量中. 这个函数必须返回一个布尔值. 将布尔值设定为true允许实体来处理输入, 否则用false阻止之.
 | 
OnPostSpawn
 | 
void OnPostSpawn()
 | 
在实体生成时立即被调用. 这个函数可以用于让实体向主脚本注册自身,或以编程方式调整实体参数. | 
Precache
 | 
void Precache()
 | 
在脚本执行后调用. 可用于在地图加载时调用模型和声音的预缓存函数. | 
CBaseAnimating
Extends CBaseEntity
动画实体(如props)的脚本句柄类.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
GetAttachmentAngles
 | 
Vector GetAttachmentAngles(int id)
 | 
以pitch, yaw, roll向量的形式获取附件ID的角度. | 
GetAttachmentOrigin
 | 
Vector GetAttachmentOrigin(int 'id')
 | 
获取附件ID的位置向量. | 
IsSequenceFinished
 | 
bool IsSequenceFinished()
 | 
主序列是否已经播放完成. | 
LookupAttachment
 | 
int LookupAttachment(string attachmentName)
 | 
获取指定名字的附件ID. | 
SetBodygroup
 | 
void SetBodygroup(int groupIndex, int value)
 | 
通过索引设置模型的bodygroup的值.  待完善: 那么问题来了,要如何才能找到索引??? 
 | 
CBaseFlex
Extends CBaseAnimating
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
GetCurrentScene
 | 
handle GetCurrentScene()
 | 
返回最早的活动场景实体的实例 (备注:如果有的话). | 
GetSceneByIndex
 | 
handle GetSceneByIndex(int index)
 | 
返回制定索引的场景实体的实例. | 
CBasePlayer
Extends CBaseAnimating
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
IsNoclipping
 | 
bool IsNoclipping()
 | 
玩家是否处于noclip状态. | 
CBaseMultiplayerPlayer
Extends CBasePlayer
CSGO玩家的脚本句柄类,无附带方法。
CEnvEntityMaker
Extends CBaseEntity
env_entity_maker的脚本句柄类.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
SpawnEntity
 | 
void SpawnEntity()
 | 
在制造器的位置上创建一个实体 | 
SpawnEntityAtEntityOrigin
 | 
void SpawnEntityAtEntityOrigin(CBaseEntity entity)
 | 
在指定实体实例的位置上创建一个实体. | 
SpawnEntityAtLocation
 | 
void SpawnEntityAtLocation(Vector origin, Vector orientation)
 | 
在指定的位置和方向上创建一个实体,方向为以度为单位的欧拉角(pitch, yaw, roll). | 
SpawnEntityAtNamedEntityOrigin
 | 
void SpawnEntityAtNamedEntityOrigin(string targetName)
 | 
在一个指定名字的实体的位置上创建一个实体。 | 
CPointTemplate
Extends CBaseEntity
point_template的脚本句柄类.
Hooks
table PreSpawnInstance(string entityClass, string entityName)- 如果定义了此Hook,它将在实体创建之前被调用,并且返回的任何KeyValues都将被分配给该实体。
 
function PreSpawnInstance( entityClass, entityName )
{
	local keyvalues =
	{ 
   		rendercolor = "0 255 0"
   		targetname = "mySpawnedEntity"
	}
	return keyvalues
	
}
void PostSpawn(table entities)- 在实体生成后调用. 具有按名称索引的已生成的实体句柄的表被传递给该函数. 可以使用它来关联输出或在创建实体后做任何你想做的事情.
 
function PostSpawn( entities )
{
	foreach( name, handle in entities )
	{
		printl( name + ": " + handle )
	}
}
CSceneEntity
Extends CBaseEntity
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
AddBroadcastTeamTarget
 | 
void AddBroadcastTeamTarget(int index)
 | 
添加一个队伍(通过索引)到广播列表中. | 
EstimateLength
 | 
float EstimateLength()
 | 
以秒为单位返回此场景的长度. | 
FindNamedEntity
 | 
handle FindNamedEntity(string reference)
 | 
给定一个实体参照, 比如 !target, 以从场景对象中获取真正的实体. | 
IsPaused
 | 
bool IsPaused()
 | 
这个场景是否暂停. | 
IsPlayingBack
 | 
bool IsPlayingBack()
 | 
这个场景是否正在播放. | 
LoadSceneFromString
 | 
bool LoadSceneFromString(string sceneName, string scene)
 | 
给定一个虚拟的场景名和vcd的字符串, 以加载场景. | 
RemoveBroadcastTeamTarget
 | 
void RemoveBroadcastTeamTarget(int index)
 | 
从广播列表中删除一个队伍(通过索引). | 
CTriggerCamera
Extends CBaseEntity
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
GetFov
 | 
int GetFov()
 | 
以整数获取当前相机的FOV设置. | 
SetFov
 | 
void SetFov(int fov, float rate)
 | 
用整数的度数设置相机的FOV, 用浮点数设置FOV的变化率. | 
Hooks
void ScriptStartCameraShot(string shotType, handle sceneEntity, handle actor1, handle actor2, float duration)- 由SceneEntity调用以响应由一个VCD发送来的CChoreoEvent::CAMERA. [待完善]
 
CCallChainer
[待完善]
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
constructor
 | 
[待完善] constructor()
 | 
|
PostScriptExecute
 | 
[待完善] PostScriptExecute()
 | 
|
Call
 | 
[待完善] Call()
 | 
Members
| 实例 | 类型 | 描述 | 
|---|---|---|
chains
 | 
null
 | 
|
prefix
 | 
null
 | 
|
scope
 | 
null
 | 
CEntities
游戏实例: Entities
一个用于查找和遍历所有游戏中的实体的脚本句柄的接口.
要遍历一组实体, 请将null传递给适当方法中的前置参数以开始遍历, 或引用先前找到的实体以继续搜索.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
CreateByClassname
 | 
handle CreateByClassname(string class)
 | 
通过种类名(class name)创建一个实体. | 
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)
 | 
通过targetname查找一个实体. | 
FindByNameNearest
 | 
handle FindByNameNearest(string name, Vector origin, float radius)
 | 
查找最接近指定点的指定targetname的实体. | 
FindByNameWithin
 | 
handle FindByNameWithin(handle previous, string name, Vector origin, float radius)
 | 
在一个范围内查找一个指定targetname的实体. | 
FindByTarget
 | 
handle FindByTarget(handle previous, string targetname)
 | 
通过实体自身的target查找一个实体. | 
FindInSphere
 | 
handle FindInSphere(handle previous, Vector origin, float radius)
 | 
在一个范围内查找一个实体. | 
First
 | 
handle First()
 | 
开始遍历的实体列表. | 
Next
 | 
handle Next(handle previous)
 | 
继续遍历实体列表, 为先前找到的实体提供参照. | 
IsValid
 | 
bool IsValid()
 | 
句柄是否属一个有效的实体. | 
CPlayerVoiceListener
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
GetPlayerSpeechDuration
 | 
float GetPlayerSpeechDuration(int)
 | 
返回玩家持续说话的秒数. | 
IsPlayerSpeaking
 | 
bool IsPlayerSpeaking(int)
 | 
指定玩家是否正在说话. | 
IsValid
 | 
bool IsValid()
 | 
句柄是否属于一个有效的实体. | 
CScriptKeyValues
代表一个模型的$keyvalues块的脚本句柄. 子键是同一类的实例.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
constructor
 | ||
FindKey
 | 
CScriptKeyValues FindKey(string keyName)
 | 
通过键名找到一个子键. | 
GetFirstSubKey
 | 
CScriptKeyValues GetFirstSubKey()
 | 
返回第一个子键对象. | 
GetKeyBool
 | 
bool GetKeyBool(string keyName)
 | 
以布尔形式返回一个键值. | 
GetKeyFloat
 | 
float GetKeyFloat(string keyName)
 | 
以浮点数返回一个键值. | 
GetKeyInt
 | 
int GetKeyInt(string keyName)
 | 
以整数返回一个键值. | 
GetKeyString
 | 
string GetKeyString(string keyName)
 | 
以字符串形式返回一个键值. | 
GetNextKey
 | 
handle GetNextKey()
 | 
将下一个相邻的键对象返回到调用该方法的对象. | 
IsKeyEmpty
 | 
bool IsKeyEmpty(string keyName)
 | 
如果指定的键是空值返回真. | 
IsValid
 | 
bool IsValid()
 | 
句柄是否属于一个有效的实体. | 
ReleaseKeyValues
 | 
void ReleaseKeyValues()
 | 
释放实例的内容. | 
CSimpleCallChainer
看上去似乎和 CCallChainer 有相同的Members. [待完善]
LateBinder
后期绑定:允许表引用自身的部分, 它是子级, 是所有者, 然后在完全分析后修复参照.
// 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;
当调用End()时, 表和数组中的所有未解析的符号将被解析, 任何未解析的左边将变成一个以'〜'为前缀的可供之后的代码处理的字符串.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
Begin
 | ||
End
 | ||
EstablishDelegation
 | ||
HookRootMetamethod
 | ||
Log
 | ||
m_bindNamesStack
 | ||
m_fixupSet
 | ||
m_log
 | ||
m_logIndent
 | ||
m_targetTable
 | ||
RemoveDelegation
 | ||
Resolve
 | ||
UnhookRootMetamethod
 | 
regexp
正则表达式的内置Squirrel 类.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
constructor
 | 
regexp()
 | 
|
capture
 | 
 [table] capture(str, [start])
 | 
返回在字符串str中的一个正则表达式的第一个匹配的包含2个索引("begin"和"end")的表的数组.为每个捕获的子表达式创建一个数组条目, 如果不匹配, 则返回null. 搜索从字符串的索引开始处开始, 如果忽略start, 则搜索从字符串的起始处开始. | 
match
 | 
 bool match(str)
 | 
如果正则表达式匹配字符串str, 则返回true, 否则返回false. | 
search
 | 
table search(str, [start])
 | 
返回包含字符串"str"中正则表达式第一个匹配的两个索引("begin"和"end")的表, 如果不匹配, 则返回null. 搜索从字符串的索引开始处开始, 如果忽略start, 则搜索从字符串的起始处开始. | 
subexpcount
 | 
Vector
Squirrel的Vector类与C++相当.
三维向量用向量值和标量值重载了算术运算.
Methods
| 函数 | 签名 | 描述 | 
|---|---|---|
constructor
 | 
Vector(float x, float y, float z)
 | 
用指定的笛卡尔坐标创建一个新的向量. | 
Cross
 | 
float Cross(Vector factor)
 | 
两个向量的向量乘积. 返回与输入向量正交的向量. | 
Dot
 | 
float Dot(Vector factor)
 | 
两个向量的标量积. | 
Length
 | 
float Length()
 | 
向量的幅度. | 
LengthSqr
 | 
float LengthSqr()
 | 
向量的幅度的平方. 比上一个方法更快. | 
Length2D
 | 
float Length2D()
 | 
返回x-y平面上向量的幅度. | 
Length2DSqr
 | 
float Length2DSqr()
 | 
返回x-y平面上向量幅度的平方. 比上一个方法更快. | 
Norm
 | 
float Norm()
 | 
以浮点数返回向量的长度. 这个函数同时也会将向量规范化, X, Y和Z值将被设置为-1和1之间的数字. 然后你可以将这些值乘以例如3000, 以使用该向量来设置游戏中某物的速度. | 
ToKVString
 | 
string ToKVString()
 | 
返回一个没有分隔符的字符串. | 
Members
| 实例 | 类型 | 描述 | 
|---|---|---|
x
 | 
float
 | 
笛卡尔x轴. | 
y
 | 
float
 | 
笛卡尔y轴. | 
z
 | 
float
 | 
笛卡尔z轴. | 
全局函数
打印与绘制
| 函数 | 签名 | 描述 | 
|---|---|---|
DebugDrawBox
 | 
void DebugDrawBox(vector origin, vector min, vector max, int r, int g, int b, int alpha, float duration)
 | 
绘制一个调试覆盖框(debug overlay box). | 
DebugDrawLine
 | 
void DebugDrawLine(Vector start, Vector end, int red, int green, int blue', bool zTest, float time)
 | 
在两点间绘制一根调试线(debug line). | 
Msg
 | 
void Msg(string message)
 | 
相当于print
 | 
print
 | 
void print(string message)
 | 
将给定的消息打印到开发人员控制台. | 
printl
 | 
void printl(string message)
 | 
功能同上, 但会在最后附加一个换行符. | 
ScriptPrintMessageCenterAll
 | 
void ScriptPrintMessageCenterAll(string message)
 | 
在屏幕中央向所有玩家打印警告消息. | 
ScriptPrintMessageCenterTeam
 | 
void ScriptPrintMessageCenterTeam(int, string)
 | 
在屏幕中央向指定队伍的玩家打印警告消息. | 
ScriptPrintMessageChatAll
 | 
void ScriptPrintMessageChatAll(string message)
 | 
在聊天框中向所有玩家打印消息. | 
ScriptPrintMessageChatTeam
 | 
void ScriptPrintMessageChatTeam(int teamNumber, string message)
 | 
在聊天框中向指定队伍的玩家打印消息. | 
ShowMessage
 | 
void ShowMessage(string)
 | 
打印一条HUD消息给所有玩家.  | 
__DumpScope
 | 
void __DumpScope(int indentation, handle scope)
 | 
转储数据范围内的所有内容. | 
训练课程相关
| 函数 | 签名 | 描述 | 
|---|---|---|
ScriptGetBestTrainingCourseTime
 | 
int ScriptGetBestTrainingCourseTime()
 | 
获取玩家完成计时课程的最佳时间. | 
ScriptGetPlayerCompletedTraining
 | 
bool ScriptGetPlayerCompletedTraining()
 | 
如果玩家已完成训练地图的初始部分, 则返回true. | 
ScriptGetValveTrainingCourseTime
 | 
int ScriptGetValveTrainingCourseTime()
 | 
获得Valve完成计时课程的最佳时间。 | 
ScriptHighlightAmmoCounter
 | 
void ScriptHighlightAmmoCounter()
 | 
发送一个刚被指导系统用于显示一个用于突出弹药计数器的提示的事件. | 
ScriptSetBestTrainingCourseTime
 | 
void ScriptSetBestTrainingCourseTime(int bestTime)
 | 
设置玩家完成计时课程的最佳时间. | 
ScriptSetMiniScoreHidden
 | 
void ScriptSetMiniScoreHidden(bool scoreHidden)
 | 
切换迷你记分牌HUD元素的可见性. | 
ScriptSetPlayerCompletedTraining
 | 
void ScriptSetPlayerCompletedTraining(bool trainingCompleted)
 | 
设置玩家是否完成了训练地图的初始部分. | 
ScriptShowExitDoorMsg
 | 
void ScriptShowExitDoorMsg()
 | 
当玩家通过出口门退出时, 在训练课程中显示一个消息框. | 
ScriptShowFinishMsgBox
 | 
void ScriptShowFinishMsgBox()
 | 
显示一个消息框,让玩家在完成训练课程后知道下一步该怎么做. | 
ScriptTrainingGivePlayerAmmo
 | 
void ScriptTrainingGivePlayerAmmo()
 | 
对玩家拥有的所有武器重新装填弹药(只在训练模式中有用). | 
合作模式相关
| 函数 | 签名 | 描述 | 
|---|---|---|
ScriptCoopCollectBonusCoin
 | 
void ScriptCoopCollectBonusCoin()
 | 
将其中一个奖励币标记为已收集. | 
ScriptCoopGiveC4sToCTs
 | 
void ScriptCoopGiveC4sToCTs(int)
 | 
将指定数量的C4给予所有活着的CT玩家. | 
ScriptCoopMissionGetMissionNumber
 | 
int ScriptCoopMissionGetMissionNumber()
 | 
获取当前地图的任务编号(备注:地图可以有多个任务). | 
ScriptCoopMissionRespawnDeadPlayers
 | 
void ScriptCoopMissionRespawnDeadPlayers()
 | 
仅用于重生玩家. | 
ScriptCoopMissionSetNextRespawnIn
 | 
void ScriptCoopMissionSetNextRespawnIn(float, bool)
 | 
设置下一波重生的发生时间. | 
ScriptCoopMissionSpawnFirstEnemies
 | 
void ScriptCoopMissionSpawnFirstEnemies(int)
 | 
在合作模式中生成第一波敌人. | 
ScriptCoopMissionSpawnNextWave
 | 
void ScriptCoopMissionSpawnNextWave(int)
 | 
告知合作模式中下一波将要出生的敌人. 此函数也会复活玩家. | 
ScriptCoopResetRoundStartTime
 | 
void ScriptCoopResetRoundStartTime()
 | 
重设回合时间并开始任务. | 
ScriptCoopSetBotQuotaAndRefreshSpawns
 | 
void ScriptCoopSetBotQuotaAndRefreshSpawns(int)
 | 
通过考量在线玩家数量来设置机器人数量并刷新复活. | 
其他
| 函数 | 签名 | 描述 | 
|---|---|---|
Assert
 | 
void Assert(bool value, string optional message)
 | 
检测布尔值, 如果不是true, 则显示异常, 可附带消息. | 
CreateProp
 | 
handle CreateProp(string class, Vector origin, string model, int animation)
 | 
通过指定的类型和模型创建一个prop. 对于prop_physics, prop_dynamic 和其他一些带模型的实体都有效. 这个函数不会预缓存模型.  | 
CreateSceneEntity
 | 
CSceneEntity CreateSceneEntity(string scene)
 | 
创建一个场景实体来播放指定的场景.vcd文件. | 
DispatchParticleEffect
 | 
void DispatchParticleEffect(string particleName, Vector, Vector)
 | 
调用一个一次性粒子系统. | 
DoIncludeScript
 | 
bool DoIncludeScript(string filename, table scope)
 | 
执行脚本数据范围设定为指定的表的脚本. | 
DoEntFire
 | 
void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller)
 | 
生成一个实体I/O事件. caller参数为句柄, 所以 target 可以设置成!self 来触发没有targetname的实体的输出. | 
EntFire
 | 
function EntFire(string target, string action, string value, float delay = 0.0, handle activator = null)
 | 
生成一个实体I/O事件. | 
EntFireByHandle
 | 
void EntFireByHandle(handle target, string action, string 'value, float delay, handle activator, handle caller)
 | 
生成一个实体I/O事件. 第一个参数是一个实体实例, 所以无名的或者由脚本创建的实体的句柄可以被轻松地传递. | 
FrameTime
 | 
float FrameTime()
 | 
获取上一帧在服务器上花费的时间. | 
GetDeveloperLevel
 | 
int GetDeveloperLevel()
 | 
获取developer模式的级别. | 
GetMapName
 | 
string GetMapName()
 | 
获取地图名. | 
LoopSinglePlayerMaps
 | 
bool LoopSinglePlayerMaps()
 | 
连续循环运行单人游戏地图. | 
PrintHelp
 | 
[待完善] | |
RandomFloat
 | 
float RandomFloat()
 | 
生成一个随机浮点数 | 
RandomFloat
 | 
float RandomFloat(float min, float max)
 | 
在一个给定范围内生成随机浮点数, 范围边界包括在内. | 
RandomInt
 | 
int RandomInt()
 | 
生成一个随机整数. | 
RandomInt
 | 
int RandomInt(int min, int max)
 | 
在一个给定范围内生成随机整数, 范围边界包括在内. | 
RecordAchievementEvent
 | 
void RecordAchievementEvent(string, int)
 | 
录制成就事件或者进程. | 
RetrieveNativeSignature
 | 
void RetrieveNativeSignature(string or func)
 | 
理论上这是用来打印本地函数的调用格式的函数, 但它实际上似乎只能输出 <unnamed>
 | 
ScriptGetGameMode
 | 
int ScriptGetGameMode()
 | 
返回game_mode的设置. 请查阅 CSGODS # 建立服务器 了解更多信息. | 
ScriptGetGameType
 | 
int ScriptGetGameType()
 | 
返回game_type的设置. 请查阅 CSGODS # 建立服务器 了解更多信息. | 
ScriptGetRoundsPlayed
 | 
int ScriptGetRoundsPlayed()
 | 
获取从游戏开始迄今所经历的回合数. | 
ScriptIsLocalPlayerUsingController
 | 
bool ScriptIsLocalPlayerUsingController()
 | 
返回玩家是否在使用控制器玩游戏. | 
ScriptIsWarmupPeriod
 | 
bool ScriptIsWarmupPeriod()
 | 
是否是热身时间. | 
ScriptSetRadarHidden
 | 
void ScriptSetRadarHidden(bool hideRadar)
 | 
切换雷达HUD元素的可见性. 仅适用于训练模式(game_type 2且game_mode 0)并且仅适用于连接的第一个人. | 
SendToConsole
 | 
void SendToConsole(string command)
 | 
将一串命令以字符串形式发送到控制台. | 
SendToConsoleServer
 | 
void SendToConsoleServer(string)
 | 
发送一个字符串, 作为服务器命令在服务器上执行. | 
Time
 | 
float 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)
 | 
使用可选的根字符串生成一个字符串, 该字符串在脚本VM的整个生命周期中保证是唯一的. 当不知道该表中已经使用了哪些密钥时,对于向表中添加数据来说作用很大. | 
__ReplaceClosures
 |