Counter-Strike: Global Offensive script functions

From Source Entities
Jump to navigation Jump to search

This table is adapted from the list generated by the script_help console command. Any changes are welcome.

Function Signature Description
CBaseAnimating::GetAttachmentAngles Vector CBaseAnimating::GetAttachmentAngles(int) Get the attachement id's angles as a p,y,r vector
CBaseAnimating::GetAttachmentOrigin Vector CBaseAnimating::GetAttachmentOrigin(int) Get the attachement id's origin vector
CBaseAnimating::IsSequenceFinished bool CBaseAnimating::IsSequenceFinished() Ask whether the main sequence is done playing
CBaseAnimating::LookupAttachment int CBaseAnimating::LookupAttachment(string) Get the named attachement id
CBaseAnimating::SetBodygroup void CBaseAnimating::SetBodygroup(int, int) Sets a bodygroup
CBaseEntity::ConnectOutput void CBaseEntity::ConnectOutput(string, string) Adds an I/O connection that will call the named function when the specified output fires
CBaseEntity::Destroy void CBaseEntity::Destroy()
CBaseEntity::DisconnectOutput void CBaseEntity::DisconnectOutput(string, string) Removes a connected script function from an I/O event.
CBaseEntity::EmitSound void CBaseEntity::EmitSound(string) Plays a sound from this entity.
CBaseEntity::EyePosition Vector CBaseEntity::EyePosition() Get vector to eye position - absolute coords
CBaseEntity::FirstMoveChild handle CBaseEntity::FirstMoveChild()
CBaseEntity::GetAngles Vector CBaseEntity::GetAngles() Get entity pitch, yaw, roll as a vector
CBaseEntity::GetAngularVelocity Vector CBaseEntity::GetAngularVelocity() Get the local angular velocity - returns a vector of pitch,yaw,roll
CBaseEntity::GetBoundingMaxs Vector CBaseEntity::GetBoundingMaxs() Get a vector containing max bounds, centered on object
CBaseEntity::GetBoundingMins Vector CBaseEntity::GetBoundingMins() Get a vector containing min bounds, centered on object
CBaseEntity::GetCenter Vector CBaseEntity::GetCenter() Get vector to center of object - absolute coords
CBaseEntity::GetClassname string CBaseEntity::GetClassname()
CBaseEntity::GetForwardVector Vector CBaseEntity::GetForwardVector() Get the forward vector of the entity
CBaseEntity::GetHealth int CBaseEntity::GetHealth()
CBaseEntity::GetLeftVector Vector CBaseEntity::GetLeftVector() Get the left vector of the entity
CBaseEntity::GetMaxHealth int CBaseEntity::GetMaxHealth()
CBaseEntity::GetModelKeyValues handle CBaseEntity::GetModelKeyValues() Get a KeyValue class instance on this entity's model
CBaseEntity::GetModelName string CBaseEntity::GetModelName() Returns the name of the model
CBaseEntity::GetMoveParent handle CBaseEntity::GetMoveParent() If in hierarchy, retrieves the entity's parent
CBaseEntity::GetName string CBaseEntity::GetName()
CBaseEntity::GetOrigin Vector CBaseEntity::GetOrigin()
CBaseEntity::GetOwner handle CBaseEntity::GetOwner() Gets this entity's owner
CBaseEntity::GetPreTemplateName string CBaseEntity::GetPreTemplateName() Get the entity name stripped of template unique decoration
CBaseEntity::GetRootMoveParent handle CBaseEntity::GetRootMoveParent() If in hierarchy, walks up the hierarchy to find the root parent
CBaseEntity::GetScriptId string CBaseEntity::GetScriptId() Retrieve the unique identifier used to refer to the entity within the scripting system
CBaseEntity::GetScriptScope handle CBaseEntity::GetScriptScope() Retrieve the script-side data associated with an entity
CBaseEntity::GetSoundDuration float CBaseEntity::GetSoundDuration(string, string) Returns float duration of the sound. Takes soundname and optional actormodelname.
CBaseEntity::GetTeam int CBaseEntity::GetTeam()
CBaseEntity::GetUpVector Vector CBaseEntity::GetUpVector() Get the up vector of the entity
CBaseEntity::GetVelocity Vector CBaseEntity::GetVelocity()
CBaseEntity::NextMovePeer handle CBaseEntity::NextMovePeer()
CBaseEntity::PrecacheModel void CBaseEntity::PrecacheModel(string)
CBaseEntity::PrecacheScriptSound void CBaseEntity::PrecacheScriptSound(string)
CBaseEntity::PrecacheSoundScript void CBaseEntity::PrecacheSoundScript(string) Precache a sound for later playing.
CBaseEntity::SetAbsOrigin void CBaseEntity::SetAbsOrigin(Vector) SetAbsOrigin
CBaseEntity::SetAngles void CBaseEntity::SetAngles(float, float, float) Set entity pitch, yaw, roll
CBaseEntity::SetAngularVelocity void CBaseEntity::SetAngularVelocity(float, float, float) Set the local angular velocity - takes float pitch,yaw,roll velocities
CBaseEntity::SetForwardVector void CBaseEntity::SetForwardVector(Vector) Set the orientation of the entity to have this forward vector
CBaseEntity::SetHealth void CBaseEntity::SetHealth(int)
CBaseEntity::SetMaxHealth void CBaseEntity::SetMaxHealth(int)
CBaseEntity::SetModel void CBaseEntity::SetModel(string)
CBaseEntity::SetOrigin void CBaseEntity::SetOrigin(Vector)
CBaseEntity::SetOwner void CBaseEntity::SetOwner(handle) Sets this entity's owner
CBaseEntity::SetSize void CBaseEntity::SetSize(Vector, Vector)
CBaseEntity::SetTeam void CBaseEntity::SetTeam(int)
CBaseEntity::SetVelocity void CBaseEntity::SetVelocity(Vector)
CBaseEntity::StopSound void CBaseEntity::StopSound(string) Stops a sound on this entity.
CBaseEntity::ValidateScriptScope bool CBaseEntity::ValidateScriptScope() Ensure that an entity's script scope has been created
CBaseEntity::entindex int CBaseEntity::entindex()
CBaseFlex::GetCurrentScene handle CBaseFlex::GetCurrentScene() Returns the instance of the oldest active scene entity (if any).
CBaseFlex::GetSceneByIndex handle CBaseFlex::GetSceneByIndex(int) Returns the instance of the scene entity at the specified index.
CBasePlayer::IsNoclipping bool CBasePlayer::IsNoclipping() Returns true if the player is in noclip mode.
CEntities::CreateByClassname handle CEntities::CreateByClassname(string) Creates an entity by classname
CEntities::FindByClassname handle CEntities::FindByClassname(handle, string) Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindByClassnameNearest handle CEntities::FindByClassnameNearest(string, Vector, float) Find entities by class name nearest to a point.
CEntities::FindByClassnameWithin handle CEntities::FindByClassnameWithin(handle, string, Vector, float) Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindByModel handle CEntities::FindByModel(handle, string) Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindByName handle CEntities::FindByName(handle, string) Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindByNameNearest handle CEntities::FindByNameNearest(string, Vector, float) Find entities by name nearest to a point.
CEntities::FindByNameWithin handle CEntities::FindByNameWithin(handle, string, Vector, float) Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindByTarget handle CEntities::FindByTarget(handle, string) Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::FindInSphere handle CEntities::FindInSphere(handle, Vector, float) Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
CEntities::First handle CEntities::First() Begin an iteration over the list of entities
CEntities::Next handle CEntities::Next(handle) Continue an iteration over the list of entities, providing reference to a previously found entity
CEnvEntityMaker::SpawnEntity void CEnvEntityMaker::SpawnEntity() Create an entity at the location of the maker
CEnvEntityMaker::SpawnEntityAtEntityOrigin void CEnvEntityMaker::SpawnEntityAtEntityOrigin(handle) Create an entity at the location of a specified entity instance
CEnvEntityMaker::SpawnEntityAtLocation void CEnvEntityMaker::SpawnEntityAtLocation(Vector, Vector) Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string) Create an entity at the location of a named entity
CFuncTrackTrain::GetFuturePosition Vector CFuncTrackTrain::GetFuturePosition(float, float) Get a position on the track x seconds in the future
CGameCoopMissionManager::GetWaveNumber int CGameCoopMissionManager::GetWaveNumber() Get the number of waves the players have completed
CHostage::IsBeingCarried bool CHostage::IsBeingCarried() Get whether the hostage is currently being carried or not
CPlayerVoiceListener::GetPlayerSpeechDuration float CPlayerVoiceListener::GetPlayerSpeechDuration(int) Returns the number of seconds the player has been continuously speaking.
CPlayerVoiceListener::IsPlayerSpeaking bool CPlayerVoiceListener::IsPlayerSpeaking(int) Returns whether the player specified is speaking.
CSceneEntity::AddBroadcastTeamTarget void CSceneEntity::AddBroadcastTeamTarget(int) Adds a team (by index) to the broadcast list
CSceneEntity::EstimateLength float CSceneEntity::EstimateLength() Returns length of this scene in seconds.
CSceneEntity::FindNamedEntity handle CSceneEntity::FindNamedEntity(string) given an entity reference, such as !target, get actual entity from scene object
CSceneEntity::IsPaused bool CSceneEntity::IsPaused() If this scene is currently paused.
CSceneEntity::IsPlayingBack bool CSceneEntity::IsPlayingBack() If this scene is currently playing.
CSceneEntity::LoadSceneFromString bool CSceneEntity::LoadSceneFromString(string, string) given a dummy scene name and a vcd string, load the scene
CSceneEntity::RemoveBroadcastTeamTarget void CSceneEntity::RemoveBroadcastTeamTarget(int) Removes a team (by index) from the broadcast list
CScriptKeyValues::FindKey handle CScriptKeyValues::FindKey(string) Given a KeyValues object and a key name, find a KeyValues object associated with the key name
CScriptKeyValues::GetFirstSubKey handle CScriptKeyValues::GetFirstSubKey() Given a KeyValues object, return the first sub key object
CScriptKeyValues::GetKeyBool bool CScriptKeyValues::GetKeyBool(string) Given a KeyValues object and a key name, return associated bool value
CScriptKeyValues::GetKeyFloat float CScriptKeyValues::GetKeyFloat(string) Given a KeyValues object and a key name, return associated float value
CScriptKeyValues::GetKeyInt int CScriptKeyValues::GetKeyInt(string) Given a KeyValues object and a key name, return associated integer value
CScriptKeyValues::GetKeyString string CScriptKeyValues::GetKeyString(string) Given a KeyValues object and a key name, return associated string value
CScriptKeyValues::GetNextKey handle CScriptKeyValues::GetNextKey() Given a KeyValues object, return the next key object in a sub key group
CScriptKeyValues::IsKeyEmpty bool CScriptKeyValues::IsKeyEmpty(string) Given a KeyValues object and a key name, return true if key name has no value
CScriptKeyValues::ReleaseKeyValues void CScriptKeyValues::ReleaseKeyValues() Given a root KeyValues object, release its contents
CTriggerCamera::GetFov int CTriggerCamera::GetFov() get camera's current fov setting as integer
CTriggerCamera::SetFov void CTriggerCamera::SetFov(int, float) set camera's current fov in integer degrees and fov change rate as float
CreateProp handle CreateProp(string, Vector, string, int) Create a physics prop
CreateSceneEntity handle CreateSceneEntity(string) Create a scene entity to play the specified scene.
DebugDrawBox void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float) Draw a debug overlay box
DebugDrawLine void DebugDrawLine(Vector, Vector, int, int, int, bool, float) Draw a debug overlay box
DispatchParticleEffect void DispatchParticleEffect(string, Vector, Vector) Dispatches a one-off particle system
DoIncludeScript bool DoIncludeScript(string, handle) Execute a script (internal)
EntFire function EntFire(target, action, value, delay, activator) Generate and entity i/o event
EntFireByHandle void EntFireByHandle(handle, string, string, float, handle, handle) Generate and entity i/o event. First parameter is an entity instance.
FrameTime float FrameTime() Get the time spent on the server in the last frame
GetDeveloperLevel int GetDeveloperLevel() Gets the level of 'developer'
GetMapName string GetMapName() Get the name of the map.
LoopSinglePlayerMaps bool LoopSinglePlayerMaps() Run the single player maps in a continuous loop.
RandomFloat float RandomFloat(float, float) Generate a random floating point number within a range, inclusive
RandomInt int RandomInt(int, int) Generate a random integer within a range, inclusive
RecordAchievementEvent void RecordAchievementEvent(string, int) Records achievement event or progress
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.
ScriptGetBestTrainingCourseTime int ScriptGetBestTrainingCourseTime() Gets the player's best time for completing the timed course.
ScriptGetGameMode int ScriptGetGameMode() Gets the current game mode.
ScriptGetGameType int ScriptGetGameType() Gets the current game type.
ScriptGetPlayerCompletedTraining bool ScriptGetPlayerCompletedTraining() Returns true if the player has completed the initial portion of the training map.
ScriptGetRoundsPlayed int ScriptGetRoundsPlayed() Get the number of rounds played so far.
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.
ScriptIsLocalPlayerUsingController bool ScriptIsLocalPlayerUsingController() Returns whether the player is playing with a controller or not.
ScriptIsWarmupPeriod bool ScriptIsWarmupPeriod() Is it warmup or not.
ScriptPrintMessageCenterAll void ScriptPrintMessageCenterAll(string) Prints an alert message in the center print method to all players.
ScriptPrintMessageCenterAllWithParams void ScriptPrintMessageCenterAllWithParams(string, string, string, string) 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 print method to the specified team.
ScriptPrintMessageChatAll void ScriptPrintMessageChatAll(string) Prints a message in chat to all players.
ScriptPrintMessageChatTeam void ScriptPrintMessageChatTeam(int, string) Prints a message in chat to the specified team.
ScriptSetBestTrainingCourseTime void ScriptSetBestTrainingCourseTime(int) Sets the player's best time for completing the timed course.
ScriptSetMiniScoreHidden void ScriptSetMiniScoreHidden(bool) Toggles the visibility of the miniscoreboard hud element.
ScriptSetPlayerCompletedTraining void ScriptSetPlayerCompletedTraining(bool) Sets whether the player has completed the initial portion of the training map.
ScriptSetRadarHidden void ScriptSetRadarHidden(bool) 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).
SendToConsole void SendToConsole(string) 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
ShowMessage void ShowMessage(string) Print a hud message on all clients
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.