Defines19
SymbolDescription
INVALID_ENT_REFERENCE
MOTDPANEL_TYPE_FILETreat msg as a filename to be opened
MOTDPANEL_TYPE_INDEXMsg is auto determined by the engine
MOTDPANEL_TYPE_TEXTTreat msg as plain text
MOTDPANEL_TYPE_URLTreat msg as an URL link
SOURCE_SDK_ALIENSWARMSDK+Engine released after Alien Swarm
SOURCE_SDK_BLOODYGOODTIMEModified version of ep2 engine used by Bloody Good Time (no SDK)
SOURCE_SDK_CSGOEngine released after CS:GO (no SDK yet)
SOURCE_SDK_CSSSometime-older version of Source 2009 SDK+Engine, used for Counter-Strike: Source
SOURCE_SDK_DARKMESSIAHModified version of original engine used by Dark Messiah (no SDK)
SOURCE_SDK_DOTAEngine released after Dota 2 (no SDK)
SOURCE_SDK_EPISODE1SDK+Engine released after Episode 1
SOURCE_SDK_EPISODE2SDK+Engine released after Episode 2/Orange Box
SOURCE_SDK_EPISODE2VALVESDK+Engine released after Episode 2/Orange Box, "Source 2009" or "Source MP"
SOURCE_SDK_EYEModified version of ep2 engine used by E.Y.E Divine Cybermancy (no SDK)
SOURCE_SDK_LEFT4DEADEngine released after Left 4 Dead (no SDK yet)
SOURCE_SDK_LEFT4DEAD2Engine released after Left 4 Dead 2 (no SDK yet)
SOURCE_SDK_ORIGINALOriginal Source engine (still used by "The Ship")
SOURCE_SDK_UNKNOWNCould not determine the engine version
Functions48
SymbolDescription
ClearSyncHudClears the text on a synchronized HUD channel. This is not the same as sending "" because it guarantees that it won't overwrite text on another channel. For example, consider the scenario: 1. Your synchronized message goes to channel 3. 2. Someone else's non-synchronized message goes to channel 3. If you were to simply send "" on your synchronized message, then someone else's text could be overwritten.
CreateDialogCreates different types of ingame messages. Note: On many newer games (Left 4 Dead/2008+), the display of this to clients is broken. Additionally, as of 2018, some games also require the client to have cl_showpluginmessages set to 1, a non-default value, for this to function.
CreateHudSynchronizerCreates a HUD synchronization object. This object is used to automatically assign and re-use channels for a set of messages. The HUD has a hardcoded number of channels (usually 6) for displaying text. You can use any channel for any area of the screen. Text on different channels can overlap, but text on the same channel will erase the old text first. This overlapping and overwriting gets problematic. A HUD synchronization object automatically selects channels for you based on the following heuristics: - If channel X was last used by the object, and hasn't been modified again, channel X gets re-used. - Otherwise, a new channel is chosen based on the least-recently-used channel. This ensures that if you display text on a sync object, that the previous text displayed on it will always be cleared first. This is because your new text will either overwrite the old text on the same channel, or because another channel has already erased your text. Note that messages can still overlap if they are on different synchronization objects, or they are displayed to manual channels. These are particularly useful for displaying repeating or refreshing HUD text, in addition to displaying multiple message sets in one area of the screen (for example, center-say messages that may pop up randomly that you don't want to overlap each other).
DisplayAskConnectBoxDisplays a panel asking the client to connect to a specified IP. Note: On many newer games (Left 4 Dead/2008+), the display of this to clients is broken. Additionally, as of 2018, some games also require the client to have cl_showpluginmessages set to 1, a non-default value, for this to function.
EntIndexToEntRefConverts an entity index into a serial encoded entity reference.
EntRefToEntIndexRetrieves the entity index from a reference or validates an entity index. The input ref is checked that it is still valid and refers to the same entity.
FindMapReturns whether a full or partial map name is found or can be resolved
GetClientsInRangeFind clients that are potentially in range of a position.
GetCurrentMapReturns the current map name.
GetEngineTimeReturns a high-precision time value for profiling the engine.
GetEngineVersionGets the engine version that the currently-loaded SM core was compiled against. The engine version values are not guaranteed to be in any particular order, and should only be compared by (in)equality.
GetGameDescriptionReturns the game description from the mod.
GetGameFolderNameReturns the name of the game's directory.
GetGameFrameTimeReturns the time the Game took processing the last frame.
GetGameTickCountReturns the game's internal tick count.
GetGameTimeReturns the game time based on the game tick.
GetMapDisplayNameGet the display name of a workshop map. Note: You do not need to call FindMap first. This native will call FindMap internally.
GetRandomFloatReturns a random floating point number from the Half-Life 2 Random Stream.
GetRandomIntReturns a random number from the Half-Life 2 Random Stream.
GetServerAuthIdRetrieves the server's authentication string (SteamID). Note: If called before server is connected to Steam, auth id will be invalid ([I:0:1], 1, etc.)
GetServerSteamAccountIdReturns the server's Steam account ID.
GuessSDKVersion
IsDecalPrecachedReturns if a given decal is precached.
IsDedicatedServerReturns whether the server is dedicated.
IsGenericPrecachedReturns if a given generic file is precached.
IsMapValidReturns whether a map is valid or not.
IsModelPrecachedReturns if a given model is precached.
IsSoundPrecached
LogToGameLogs a generic message to the HL2 logs.
MakeCompatEntRefConverts a reference into a backwards compatible version.
PrecacheDecalPrecaches a given decal.
PrecacheGenericPrecaches a given generic file.
PrecacheModelPrecaches a given model.
PrecacheSentenceFilePrecaches a given sentence file.
PrecacheSoundPrecaches a given sound.
PrintCenterTextPrints a message to a specific client in the center of the screen.
PrintCenterTextAllPrints a message to all clients in the center of the screen.
PrintHintTextPrints a message to a specific client with a hint box.
PrintHintTextToAllPrints a message to all clients with a hint box.
PrintToChatPrints a message to a specific client in the chat area.
PrintToChatAllPrints a message to all clients in the chat area.
SetHudTextParamsSets the HUD parameters for drawing text. These parameters are stored globally, although nothing other than this function and SetHudTextParamsEx modify them. You must call this function before drawing text. If you are drawing text to multiple clients, you can set the parameters once, since they won't be modified. However, as soon as you pass control back to other plugins, you must reset the parameters next time you draw.
SetHudTextParamsExSets the HUD parameters for drawing text. These parameters are stored globally, although nothing other than this function and SetHudTextParams modify them. This is the same as SetHudTextParams(), except it lets you set the alternate color for when effects require it.
SetRandomSeedSets the seed value for the global Half-Life 2 Random Stream.
ShowHudTextShows a HUD message to a client on the given channel. Note: while many games support HUD Text, not all do.
ShowMOTDPanelShows a MOTD panel to a specific client.
ShowSyncHudTextShows a synchronized HUD message to a client. As of this writing, only TF, HL2MP, and SourceForts support HUD Text.
ShowVGUIPanelShows a VGUI panel to a specific client.