### StartMessageAll - Start User Message for All Clients Source: https://sm.alliedmods.net/new-api/usermessages/__raw A stock function to start a user message that broadcasts to all currently connected clients. It iterates through all possible client slots, checks for connection, and then calls StartMessageEx. Returns a handle to a bit buffer or INVALID_HANDLE on failure. ```sm_stock stock Handle StartMessageAll(const char[] msgname, int flags=0) { int total = 0; int[] clients = new int[MaxClients]; for (int i = 1; i <= MaxClients; i++) { if (IsClientConnected(i)) { clients[total++] = i; } } return StartMessage(msgname, clients, total, flags); } ``` -------------------------------- ### StartMessageOne - Start User Message for a Single Client Source: https://sm.alliedmods.net/new-api/usermessages/__raw A stock function to start a user message intended for a single, specified client. It prepares an array with the single client's index and calls StartMessage. Returns a bit buffer handle or INVALID_HANDLE if the operation fails. ```sm_stock stock Handle StartMessageOne(const char[] msgname, int client, int flags=0) { int players[1]; players[0] = client; return StartMessage(msgname, players, 1, flags); } ``` -------------------------------- ### SourceMod: Display Menu Starting at Item Source: https://sm.alliedmods.net/new-api/menus/__raw Displays a menu to a client starting from a specific item. Requires menu handle, client index, first item index, and display time. Returns true on success, false on failure. ```sm_api native bool DisplayMenuAtItem(Handle menu, int client, int first_item, int time); ``` -------------------------------- ### TR_TraceRayEx Source: https://sm.alliedmods.net/new-api/sdktools_trace/__raw Starts up a new trace ray using a new trace result. ```APIDOC ## TR_TraceRayEx ### Description Starts up a new trace ray using a new trace result. ### Method NATIVE ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **pos** (float[3]) - Required - Starting position of the ray. - **vec** (float[3]) - Required - Depending on RayType, it will be used as the ending point, or the direction angle. - **flags** (int) - Required - Trace flags. - **rtype** (RayType) - Required - Method to calculate the ray direction. ### Request Example ```c // Example usage is not provided in the source material. ``` ### Response #### Success Response (Handle) - **Return Value** (Handle) - Ray trace handle, which must be closed via CloseHandle(). #### Response Example None ``` -------------------------------- ### SourceMod C++ Hook Setup from GameData Configuration Source: https://sm.alliedmods.net/new-api/dhooks/__raw Demonstrates setting up a hook using a game configuration file and a function name. This method relies on a pre-parsed 'Functions' section within the gamedata file for address lookup. It returns a setup handle for the detour or null if the offset is not found. ```SourcePawn public native DynamicHook FromConf(Handle gameconf, const char[] name); ``` -------------------------------- ### DHookSetup - AddParam Source: https://sm.alliedmods.net/new-api/dhooks/__raw Adds a parameter to a hook setup. ```APIDOC ## POST /api/dhoksetup/addparam ### Description Adds a parameter to a hook setup. ### Method POST ### Endpoint /api/dhoksetup/addparam ### Parameters #### Query Parameters - **type** (HookParamType) - Required - Parameter type. - **size** (int) - Optional - Used for Objects (not Object ptr) to define the size of the object. Defaults to -1. - **flag** (DHookPassFlag) - Optional - Used to change the pass type (ignored by detours). Defaults to DHookPass_ByVal. - **custom_register** (DHookRegister) - Optional - The register this argument is passed in instead of the stack (ignored by vhooks). Defaults to DHookRegister_Default. ### Response #### Success Response (200) This method does not return a value. #### Response Example ```json { "message": "Parameter added successfully." } ``` ``` -------------------------------- ### TR_TraceHullEx Source: https://sm.alliedmods.net/new-api/sdktools_trace/__raw Starts up a new trace hull using a new trace result. ```APIDOC ## TR_TraceHullEx ### Description Starts up a new trace hull using a new trace result. ### Method NATIVE ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **pos** (float[3]) - Required - Starting position of the ray. - **vec** (float[3]) - Required - Ending position of the ray. - **mins** (float[3]) - Required - Hull minimum size. - **maxs** (float[3]) - Required - Hull maximum size. - **flags** (int) - Required - Trace flags. ### Request Example ```c // Example usage is not provided in the source material. ``` ### Response #### Success Response (Handle) - **Return Value** (Handle) - Ray trace handle, which must be closed via CloseHandle(). #### Response Example None ``` -------------------------------- ### Get Trace Start Position (SourcePawn) Source: https://sm.alliedmods.net/new-api/sdktools_trace/__raw Retrieves the starting position of a trace. The position is stored in the provided vector buffer. It can use a specific trace handle or the global trace result. ```SourcePawn native void TR_GetStartPosition(Handle hndl, float pos[3]); ``` -------------------------------- ### Configuration and Initialization Forwards Source: https://sm.alliedmods.net/new-api/sourcemod/__raw Callbacks related to configuration loading and server initialization. ```APIDOC ## OnConfigsExecuted ### Description Called after servercfgfile (server.cfg), all plugin configs are done executing. Best place to initialize plugin functions based on cvar data. ### Method forward ### Endpoint N/A (Forward) ### Parameters N/A ### Request Example N/A ### Response N/A ## OnAutoConfigsBuffered ### Description Called after OnMapStart() but before OnConfigsExecuted(). Used to load per-map settings that override default values by adding commands to ServerCommand() buffer. ### Method forward ### Endpoint N/A (Forward) ### Parameters N/A ### Request Example N/A ### Response N/A ## OnServerCfg ### Description Deprecated. Use OnConfigsExecuted() instead. ### Method forward ### Endpoint N/A (Forward) ### Parameters N/A ### Request Example N/A ### Response N/A ## OnAllPluginsLoaded ### Description Called after all plugins have been loaded. Called once for every plugin. For late loads, called immediately after OnPluginStart(). ### Method forward ### Endpoint N/A (Forward) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Plugin Initialization and Loading Callbacks Source: https://sm.alliedmods.net/new-api/sourcemod/__raw Defines forward declarations for essential plugin lifecycle callbacks: `OnPluginStart` for full initialization and `AskPluginLoad` for plugin loading decisions. ```SourcePawn /** * Called when the plugin is fully initialized and all known external references * are resolved. This is only called once in the lifetime of the plugin, and is * paired with OnPluginEnd(). * * If any run-time error is thrown during this callback, the plugin will be marked * as failed. */ forward void OnPluginStart(); /** * @deprecated Use AskPluginLoad2() instead. * If a plugin contains both AskPluginLoad() and AskPluginLoad2(), the former will * not be called, but old plugins with only AskPluginLoad() will work. */ #pragma deprecated Use AskPluginLoad2() instead forward bool AskPluginLoad(Handle myself, bool late, char[] error, int err_max); ``` -------------------------------- ### GetPanelCurrentKey Source: https://sm.alliedmods.net/new-api/menus/__raw Gets the current key position within a menu panel. Key positions start at 1. ```APIDOC ## GET /api/menus/getPanelCurrentKey ### Description Gets the current key position within a menu panel. Key positions start at 1. ### Method GET ### Endpoint /api/menus/getPanelCurrentKey ### Parameters #### Path Parameters - **panel** (Handle) - Required - A MenuPanel Handle. #### Query Parameters None #### Request Body None ### Request Example ```json { "panel": "handle_value" } ``` ### Response #### Success Response (200) - **return** (int) - Current key position starting at 1. #### Response Example ```json { "return": 3 } ``` ### Error Handling - **Invalid Handle**: Indicates an invalid menu panel handle was provided. ``` -------------------------------- ### Map History Functions - SourcePawn Source: https://sm.alliedmods.net/new-api/nextmap/__raw Provides functions to get the size of the map history and retrieve details about specific entries in the history, including map name, reason for change, and start time. ```SourcePawn /** * Gets the current number of maps in the map history * * @return Number of maps. */ native int GetMapHistorySize(); /** * Retrieves a map from the map history list. * * @param item Item number. Must be 0 or greater and less than GetMapHistorySize(). * @param map Buffer to store the map name. * @param mapLen Length of map buffer. * @param reason Buffer to store the change reason. * @param reasonLen Length of the reason buffer. * @param startTime Time the map started. * @error Invalid item number. */ native void GetMapHistory(int item, char[] map, int mapLen, char[] reason, int reasonLen, int &startTime); ``` -------------------------------- ### TE_SetupBeamRing Function Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/TE_SetupBeamRing Sets up a beam ring effect with specified parameters. ```APIDOC ## TE_SetupBeamRing Function ### Description Sets up a beam ring effect. ### Method void (Function Signature) ### Endpoint N/A (This is a function signature, not a REST endpoint) ### Parameters #### Function Parameters - **StartEntity** (int) - Required - Entity index from where the ring starts. - **EndEntity** (int) - Required - Entity index from where the ring ends. - **ModelIndex** (int) - Required - Precached model index. - **HaloIndex** (int) - Required - Precached model index. - **StartFrame** (int) - Required - Initial frame to render. - **FrameRate** (int) - Required - Ring frame rate. - **Life** (float) - Required - Time duration of the ring. - **Width** (float) - Required - Beam width. - **Amplitude** (float) - Required - Beam amplitude. - **Color** (const int[4]) - Required - Color array (r, g, b, a). - **Speed** (int) - Required - Speed of the beam. - **Flags** (int) - Required - Beam flags. ``` -------------------------------- ### Get Fraction Left Solid (SourcePawn) Source: https://sm.alliedmods.net/new-api/sdktools_trace/__raw Retrieves the time fraction when the trace left a solid area. This is only valid if the trace started within a solid. It can use a specific trace handle or the global trace result. ```SourcePawn native float TR_GetFractionLeftSolid(Handle hndl=INVALID_HANDLE); ``` -------------------------------- ### Menu Creation and Display Source: https://sm.alliedmods.net/new-api/menus/__raw Covers the instantiation of a Menu object and methods for displaying menus to clients, including options for specifying the starting item and display duration. ```C++ public native Menu(MenuHandler handler, MenuAction actions=MENU_ACTIONS_DEFAULT); public native bool Display(int client, int time); public native bool DisplayAt(int client, int first_item, int time); ``` -------------------------------- ### Profiler Methodmap (SourcePawn) Source: https://sm.alliedmods.net/new-api/profiler/__raw Defines the 'Profiler' methodmap, which represents a handle for profiling objects. It includes methods to create, start, stop, and get the elapsed time of a profiling cycle. This is the primary interface for handle-based profiling. ```SourcePawn methodmap Profiler < Handle { // Creates a new profile object. The Handle must be freed // using delete or CloseHandle(). // // @return A new Profiler Handle. public native Profiler(); // Starts a cycle for profiling. public native void Start(); // Stops a cycle for profiling. // // @error Profiler was never started. public native void Stop(); // Returns the amount of high-precision time in seconds // that passed during the profiler's last start/stop // cycle. // // @return Time elapsed in seconds. property float Time { public native get(); } }; ``` -------------------------------- ### TE_SetupBeamLaser Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Sets up an entity-to-entity laser effect, connecting two entities with a beam. ```APIDOC ## TE_SetupBeamLaser ### Description Sets up an entity to entity laser effect. ### Method STOCK ### Endpoint N/A (Function Call) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **StartEntity** (int) - Required - Entity index from where the beam starts. - **EndEntity** (int) - Required - Entity index from where the beam ends. - **ModelIndex** (int) - Required - Precached model index. - **HaloIndex** (int) - Required - Precached model index. - **StartFrame** (int) - Required - Initial frame to render. - **FrameRate** (int) - Required - Beam frame rate. - **Life** (float) - Required - Time duration of the beam. - **Width** (float) - Required - Initial beam width. - **EndWidth** (float) - Required - Final beam width. - **FadeLength** (int) - Required - Beam fade time duration. - **Amplitude** (float) - Required - Beam amplitude. - **Color** (int[4]) - Required - Color array (r, g, b, a). - **Speed** (int) - Required - Speed of the beam. ### Request Example ```json { "example": "TE_SetupBeamLaser(StartEntity, EndEntity, ModelIndex, HaloIndex, StartFrame, FrameRate, Life, Width, EndWidth, FadeLength, Amplitude, Color, Speed);" } ``` ### Response #### Success Response (200) N/A (Function execution) #### Response Example ```json { "example": "BeamLaser effect setup successfully." } ``` ``` -------------------------------- ### Get Current Menu Panel Key Position - SourcePawn Source: https://sm.alliedmods.net/new-api/menus/__raw Returns the current key position within a menu panel, starting from 1. This function is useful for tracking user navigation. Errors if the provided handle is invalid. ```SourcePawn native int GetPanelCurrentKey(Handle panel); ``` -------------------------------- ### Setup Beam Laser Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Sets up an entity-to-entity laser effect. This function defines a laser beam that originates from one entity and terminates at another. Parameters include the start and end entity indices, model and halo indices, frame and rate settings, life, width, fade length, amplitude, color, and speed. ```sm stock void TE_SetupBeamLaser(int StartEntity, int EndEntity, int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life, float Width, float EndWidth, int FadeLength, float Amplitude, const int Color[4], int Speed) { TE_Start("BeamLaser"); TE_WriteEncodedEnt("m_nStartEntity", StartEntity); TE_WriteEncodedEnt("m_nEndEntity", EndEntity); TE_WriteNum("m_nModelIndex", ModelIndex); TE_WriteNum("m_nHaloIndex", HaloIndex); TE_WriteNum("m_nStartFrame", StartFrame); TE_WriteNum("m_nFrameRate", FrameRate); TE_WriteFloat("m_fLife", Life); TE_WriteFloat("m_fWidth", Width); TE_WriteFloat("m_fEndWidth", EndWidth); TE_WriteFloat("m_fAmplitude", Amplitude); TE_WriteNum("r", Color[0]); TE_WriteNum("g", Color[1]); TE_WriteNum("b", Color[2]); TE_WriteNum("a", Color[3]); TE_WriteNum("m_nSpeed", Speed); TE_WriteNum("m_nFadeLength", FadeLength); } ``` -------------------------------- ### TE_SetupExplosion Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Sets up an explosion effect with detailed parameters including position, model, scale, and more. ```APIDOC ## TE_SetupExplosion ### Description Sets up an explosion effect. ### Method STOCK ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **pos** (float[3]) - Required - Explosion position. - **Model** (int) - Required - Precached model index. - **Scale** (float) - Required - Explosion scale. - **Framerate** (int) - Required - Explosion frame rate. - **Flags** (int) - Required - Explosion flags. - **Radius** (int) - Required - Explosion radius. - **Magnitude** (int) - Required - Explosion size. - **normal** (float[3]) - Optional - Normal vector to the explosion. Defaults to [0.0, 0.0, 1.0]. - **MaterialType** (int) - Optional - Exploded material type. Defaults to 'C'. ### Request Example ```json { "example": "TE_SetupExplosion(pos, Model, Scale, Framerate, Flags, Radius, Magnitude, normal, MaterialType)" } ``` ### Response #### Success Response (200) N/A (This is a stock function, not an API endpoint). #### Response Example ```json { "example": "N/A" } ``` ``` -------------------------------- ### Setup Beam Points Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Configures a point-to-point beam effect in SourceMod. It takes start and end positions, model and halo indices, frame and rate information, life, width, fade length, amplitude, color, and speed as parameters. This function is used to draw a beam between two specific coordinates in the game world. ```sm stock void TE_SetupBeamPoints(const float start[3], const float end[3], int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life, float Width, float EndWidth, int FadeLength, float Amplitude, const int Color[4], int Speed) { TE_Start("BeamPoints"); TE_WriteVector("m_vecStartPoint", start); TE_WriteVector("m_vecEndPoint", end); TE_WriteNum("m_nModelIndex", ModelIndex); TE_WriteNum("m_nHaloIndex", HaloIndex); TE_WriteNum("m_nStartFrame", StartFrame); TE_WriteNum("m_nFrameRate", FrameRate); TE_WriteFloat("m_fLife", Life); TE_WriteFloat("m_fWidth", Width); TE_WriteFloat("m_fEndWidth", EndWidth); TE_WriteFloat("m_fAmplitude", Amplitude); TE_WriteNum("r", Color[0]); TE_WriteNum("g", Color[1]); TE_WriteNum("b", Color[2]); TE_WriteNum("a", Color[3]); TE_WriteNum("m_nSpeed", Speed); TE_WriteNum("m_nFadeLength", FadeLength); } ``` -------------------------------- ### TE_SetupBeamPoints Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Sets up a point-to-point beam effect with specified visual and temporal properties. ```APIDOC ## TE_SetupBeamPoints ### Description Sets up a point to point beam effect. ### Method STOCK ### Endpoint N/A (Function Call) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **start** (float[3]) - Required - Start position of the beam. - **end** (float[3]) - Required - End position of the beam. - **ModelIndex** (int) - Required - Precached model index. - **HaloIndex** (int) - Required - Precached model index. - **StartFrame** (int) - Required - Initial frame to render. - **FrameRate** (int) - Required - Beam frame rate. - **Life** (float) - Required - Time duration of the beam. - **Width** (float) - Required - Initial beam width. - **EndWidth** (float) - Required - Final beam width. - **FadeLength** (int) - Required - Beam fade time duration. - **Amplitude** (float) - Required - Beam amplitude. - **Color** (int[4]) - Required - Color array (r, g, b, a). - **Speed** (int) - Required - Speed of the beam. ### Request Example ```json { "example": "TE_SetupBeamPoints(start, end, ModelIndex, HaloIndex, StartFrame, FrameRate, Life, Width, EndWidth, FadeLength, Amplitude, Color, Speed);" } ``` ### Response #### Success Response (200) N/A (Function execution) #### Response Example ```json { "example": "BeamPoints effect setup successfully." } ``` ``` -------------------------------- ### StartMessageEx - Start User Message for Multiple Clients Source: https://sm.alliedmods.net/new-api/usermessages/__raw Initiates a user message to be sent to a specified list of clients. It takes a message identifier, an array of client indices, the number of clients, and optional flags. Returns a handle to a bit buffer for writing message data. ```sm_native native Handle StartMessageEx(UserMsg msg, const int[] clients, int numClients, int flags=0); ``` -------------------------------- ### Setup Beam Ring Point Effect Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Initializes a beam ring effect around a central point, defining its start and end radii, models for the beam and halo, frame rates, life duration, width, amplitude, color, speed, and flags. This is used for various beam-based effects like portals or energy rings. ```sm stock void TE_SetupBeamRingPoint(const float center[3], float Start_Radius, float End_Radius, int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life, float Width, float Amplitude, const int Color[4], int Speed, int Flags) { TE_Start("BeamRingPoint"); ``` -------------------------------- ### Setup Beam Ring Source: https://sm.alliedmods.net/new-api/sdktools_tempents_stocks/__raw Configures a beam ring effect. This function creates a circular beam effect, typically around an entity or between two entities. It requires start and end entities, model and halo indices, frame and rate settings, life, width, amplitude, color, speed, and flags to define the ring's appearance and behavior. ```sm stock void TE_SetupBeamRing(int StartEntity, int EndEntity, int ModelIndex, int HaloIndex, int StartFrame, int FrameRate, float Life, float Width, float Amplitude, const int Color[4], int Speed, int Flags) { TE_Start("BeamRing"); TE_WriteEncodedEnt("m_nStartEntity", StartEntity); TE_WriteEncodedEnt("m_nEndEntity", EndEntity); TE_WriteNum("m_nModelIndex", ModelIndex); TE_WriteNum("m_nHaloIndex", HaloIndex); TE_WriteNum("m_nStartFrame", StartFrame); TE_WriteNum("m_nFrameRate", FrameRate); TE_WriteFloat("m_fLife", Life); TE_WriteFloat("m_fWidth", Width); TE_WriteFloat("m_fEndWidth", Width); TE_WriteFloat("m_fAmplitude", Amplitude); TE_WriteNum("r", Color[0]); TE_WriteNum("g", Color[1]); TE_WriteNum("b", Color[2]); TE_WriteNum("a", Color[3]); TE_WriteNum("m_nSpeed", Speed); TE_WriteNum("m_nFlags", Flags); } ``` -------------------------------- ### Connect to Database via Key-Value Pairs (SourcePawn) Source: https://sm.alliedmods.net/new-api/dbi/__raw Connects to a database using key-value pairs, which should correspond to `databases.cfg` entries. This method is generally discouraged in favor of using `databases.cfg` directly. ```SourcePawn // Connects to a database using key value pairs containing the database info. // The key/value pairs should match what would be in databases.cfg. // // I.e. "driver" should be "default" or a driver name (or omitted for // the default). For SQLite, only the "database" parameter is needed in addition. // For drivers which require external connections, more of the parameters may be // needed. // // In general it is discouraged to use this function. Connections should go through // databases.cfg for greatest flexibility on behalf of users. ``` -------------------------------- ### Map Vote Started Forward Declaration (SourcePawn) Source: https://sm.alliedmods.net/new-api/mapchooser/__raw Declares a forward function that is called when the mapchooser starts a map vote. This allows other plugins to hook into this event. ```SourcePawn forward void OnMapVoteStarted(); ``` -------------------------------- ### SDK Call Preparation and Execution Source: https://sm.alliedmods.net/new-api/sdktools/__raw Functions to prepare and execute SDK calls, including setting function signatures, addresses, parameters, and return information. ```APIDOC ## PrepSDKCall_SetSignature ### Description Prepares an SDK call by setting the function signature. ### Method native bool ### Endpoint PrepSDKCall_SetSignature(SDKLibrary lib, const char[] signature, int bytes) ### Parameters #### Path Parameters - **lib** (SDKLibrary) - The SDK library. - **signature** (const char[]) - The function signature. - **bytes** (int) - The number of bytes. ### PrepSDKCall_SetAddress ### Description Sets the address of the function to use for the SDK call. ### Method native bool ### Endpoint PrepSDKCall_SetAddress(Address addr) ### Parameters #### Path Parameters - **addr** (Address) - The address of the function. ### PrepSDKCall_SetFromConf ### Description Finds an address or virtual function index in a GameConfig file and sets it as the calling information for the SDK call. ### Method native bool ### Endpoint PrepSDKCall_SetFromConf(Handle gameconf, SDKFuncConfSource source, const char[] name) ### Parameters #### Path Parameters - **gameconf** (Handle) - GameConfig Handle, or INVALID_HANDLE to use sdktools.games.txt. - **source** (SDKFuncConfSource) - Whether to look in Offsets or Signatures. - **name** (const char[]) - Name of the property to find. ### PrepSDKCall_SetReturnInfo ### Description Sets the return information of an SDK call. This must be called if there is a return value. ### Method native void ### Endpoint PrepSDKCall_SetReturnInfo(SDKType type, SDKPassMethod pass, int decflags = 0, int encflags = 0) ### Parameters #### Path Parameters - **type** (SDKType) - Data type to convert to/from. - **pass** (SDKPassMethod) - How the data is passed in C++. - **decflags** (int) - Flags on decoding from the plugin to C++. Defaults to 0. - **encflags** (int) - Flags on encoding from C++ to the plugin. Defaults to 0. ### PrepSDKCall_AddParameter ### Description Adds a parameter to the calling convention. This should be called in normal ascending order. ### Method native void ### Endpoint PrepSDKCall_AddParameter(SDKType type, SDKPassMethod pass, int decflags = 0, int encflags = 0) ### Parameters #### Path Parameters - **type** (SDKType) - Data type to convert to/from. - **pass** (SDKPassMethod) - How the data is passed in C++. - **decflags** (int) - Flags on decoding from the plugin to C++. Defaults to 0. - **encflags** (int) - Flags on encoding from C++ to the plugin. Defaults to 0. ### EndPrepSDKCall ### Description Finalizes an SDK call preparation and returns the resultant Handle. ### Method native Handle ### Endpoint EndPrepSDKCall() ### SDKCall ### Description Calls an SDK function with the given parameters. ### Method native any ### Endpoint SDKCall(Handle call, any ...) ### Parameters #### Path Parameters - **call** (Handle) - SDKCall Handle. - **...** (any) - Call Parameters. ### Request Example ```json { "call": "your_sdk_call_handle", "parameters": ["param1", "param2"] } ``` ### Success Response (200) - **returnValue** (any) - Simple return value, if any. ### Response Example ```json { "returnValue": "example_return_value" } ``` ``` -------------------------------- ### Create Admin Authentication Method (SourcePawn) Source: https://sm.alliedmods.net/new-api/admin/__raw Initializes a new admin authentication method. CreateAuthMethod should be called once per method name. ```SourcePawn /** * Creates an admin auth method. This does not need to be called more than once * per method, ever. * * @param method Name of the authentication method. * @return True on success, false on failure. */ native bool CreateAuthMethod(const char[] method); ``` -------------------------------- ### SourceMod: Push Float Reference Source: https://sm.alliedmods.net/new-api/functions/__raw Pushes a floating-point value by reference onto the current call stack. This function can only be used after a call has been started. An error will occur if no call has been started. ```sm native void Call_PushFloatRef(float &value); ``` -------------------------------- ### Get Players in Team Source: https://sm.alliedmods.net/new-api/sdktools_functions/__raw Retrieves the number of players currently in a specified team. This function is intended to be called after `OnMapStart` to get accurate player counts per team. ```SourcePawn native int GetPlayersInTeam(int index); ``` -------------------------------- ### Check if Trace Started in Solid (SourcePawn) Source: https://sm.alliedmods.net/new-api/sdktools_trace/__raw Determines whether the entire trace occurred within a solid area. This function checks the trace's starting condition relative to solid geometry. ```SourcePawn native bool TR_StartedInSolid(Handle hndl=INVALID_HANDLE); ``` -------------------------------- ### SourceMod TopMenu Positions (SourcePawn) Source: https://sm.alliedmods.net/new-api/topmenus/__raw Specifies the starting positions for displaying menu items within a TopMenu. These include the start of the menu, the last position in the root menu, and the last position in a category. ```SourcePawn /** * Top menu starting positions for display. */ enum TopMenuPosition { TopMenuPosition_Start = 0, /**< Start/root of the menu */ TopMenuPosition_LastRoot = 1, /**< Last position in the root menu */ TopMenuPosition_LastCategory = 3 /**< Last position in their last category */ }; ``` -------------------------------- ### PrintCenterTextAll Source: https://sm.alliedmods.net/new-api/halflife Prints a message to all clients in the center of the screen. ```APIDOC ## PrintCenterTextAll ### Description Prints a message to all connected clients in the center of their screens. ### Method N/A (SourcePawn function) ### Endpoint N/A (SourcePawn function) ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Get String Property for GameRules Source: https://sm.alliedmods.net/new-api/sdktools_gamerules/__raw Gets a gamerules property as a string and writes it to a provided buffer. Returns the number of non-null bytes written. Errors can occur if the property is not a string or lacks mod support. ```sourcemod native int GameRules_GetPropString(const char[] prop, char[] buffer, int maxlen, int element=0); ``` -------------------------------- ### Log to Open File Ex (SourcePawn) Source: https://sm.alliedmods.net/new-api/files/__raw An extended version of LogToOpenFile, logging a formatted message to an open file handle. Requires the file to be opened in text appending mode. Supports format parameters and throws errors for invalid handles. ```SourcePawn native void LogToOpenFileEx(Handle hndl, const char[] message, any ...); ``` -------------------------------- ### Get Native Array (SourcePawn) Source: https://sm.alliedmods.net/new-api/functions/__raw Gets an array from a native parameter (always by reference). It requires the parameter number, a local array to copy into, and the maximum size of the local array. It returns SP_ERROR_NONE on success. ```SourcePawn native int GetNativeArray(int param, any[] local, int size); ``` -------------------------------- ### StartPrepSDKCall Native Function Source: https://sm.alliedmods.net/new-api/sdktools/__raw Initializes the preparation of an SDK call, specifying the type of function call to be made. ```c /** * Starts the preparation of an SDK call. * * @param type Type of function call this will be. */ native void StartPrepSDKCall(SDKCallType type); ``` -------------------------------- ### Create Detour (SourcePawn) Source: https://sm.alliedmods.net/new-api/dhooks/__raw Creates a setup handle for a function detour. Requires the function's address, calling convention, return type, and 'this' pointer type. ```SourcePawn native DynamicDetour DHookCreateDetour(Address funcaddr, CallingConvention callConv, ReturnType returntype, ThisPointerType thisType); ``` -------------------------------- ### SourceMod C++ Adding Parameters to a Hook Setup Source: https://sm.alliedmods.net/new-api/dhooks/__raw Details the process of adding parameters to a hook setup. This function allows specifying the parameter type, size (for objects), passing flag, and custom register allocation. ```SourcePawn public native void AddParam(HookParamType type, int size=-1, DHookPassFlag flag=DHookPass_ByVal, DHookRegister custom_register=DHookRegister_Default); ``` -------------------------------- ### FindKey Method Signature (C++) Source: https://sm.alliedmods.net/new-api/entitylump/EntityLumpEntry/FindKey This C++ signature defines the FindKey method, which searches for a key within an entry list starting from a specified position. It takes a character array for the key and an integer for the starting position as input. ```cpp int FindKey(const char[] key, int start) ``` -------------------------------- ### Create Directory Source: https://sm.alliedmods.net/new-api/files/__raw Creates a directory at the specified path with given permissions, supporting the Valve file system. ```APIDOC ## CreateDirectory ### Description Creates a directory at the specified path. Directories are not created recursively by default unless `use_valve_fs` is used. Permissions can be specified. ### Method NATIVE ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **path** (const char[]) - Required - Path to the directory to create. - **mode** (int) - Optional - Permissions for the directory. Defaults to `FPERM_O_READ|FPERM_O_EXEC|FPERM_G_READ|FPERM_G_EXEC|FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC`. On Linux, the execute bit must be set for directories. Ignored on Windows. - **use_valve_fs** (bool) - Optional - If true, uses the Valve file system, allowing for recursive creation and use of `valve_path_id`. Defaults to false. - **valve_path_id** (const char[]) - Optional - If `use_valve_fs` is true, specifies a search path from gameinfo or `NULL_STRING` for default. In this case, `mode` is ignored. Defaults to "DEFAULT_WRITE_PATH". ### Request Example ``` native bool CreateDirectory(const char[] path, int mode=FPERM_O_READ|FPERM_O_EXEC|FPERM_G_READ|FPERM_G_EXEC|FPERM_U_READ|FPERM_U_WRITE|FPERM_U_EXEC, bool use_valve_fs=false, const char[] valve_path_id="DEFAULT_WRITE_PATH"); ``` ### Response #### Success Response (bool) - **return value** (bool) - True on success, false otherwise. #### Response Example ``` // Example usage: // bool created = CreateDirectory("new_folder"); // bool valve_created = CreateDirectory("assets/ui", true, "MOD_ASSETS"); ``` ### Constants `FPERM_U_READ` (0x0100): User can read. `FPERM_U_WRITE` (0x0080): User can write. `FPERM_U_EXEC` (0x0040): User can execute. `FPERM_G_READ` (0x0020): Group can read. `FPERM_G_WRITE` (0x0010): Group can write. `FPERM_G_EXEC` (0x0008): Group can execute. `FPERM_O_READ` (0x0004): Anyone can read. `FPERM_O_WRITE` (0x0002): Anyone can write. `FPERM_O_EXEC` (0x0001): Anyone can execute. ``` -------------------------------- ### GetMaxPageItems: Get Max Items Per Page for Style Source: https://sm.alliedmods.net/new-api/menus/__raw Retrieves the maximum number of items that can be displayed per page for a given MenuStyle. INVALID_HANDLE can be used to get the default style's maximum items. ```SourcePawn native int GetMaxPageItems(Handle hStyle=INVALID_HANDLE); ``` -------------------------------- ### Emit Sound to Client Wrapper (SourcePawn) Source: https://sm.alliedmods.net/new-api/sdktools_sound/__raw A stock function that acts as a wrapper to emit a sound to a single client. It simplifies the process by handling default parameters and converting SOUND_FROM_PLAYER. ```sourcepawn stock void EmitSoundToClient(int client, const char[] sample, int entity = SOUND_FROM_PLAYER, int channel = SNDCHAN_AUTO, int level = SNDLEVEL_NORMAL, int flags = SND_NOFLAGS, float volume = SNDVOL_NORMAL, int pitch = SNDPITCH_NORMAL, int speakerentity = -1, const float origin[3] = NULL_VECTOR, const float dir[3] = NULL_VECTOR, bool updatePos = true, float soundtime = 0.0) { int clients[1]; clients[0] = client; /* Save some work for SDKTools and remove SOUND_FROM_PLAYER references */ entity = (entity == SOUND_FROM_PLAYER) ? client : entity; EmitSound(clients, 1, sample, entity, channel, level, flags, volume, pitch, speakerentity, origin, dir, updatePos, soundtime); } ``` -------------------------------- ### SDK Call Preparation Source: https://sm.alliedmods.net/new-api/sdktools/__raw Functions for preparing and setting up calls to game engine functions using the SDK. ```APIDOC ## StartPrepSDKCall ### Description Starts the preparation of an SDK call. ### Method native ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) N/A #### Response Example N/A ## PrepSDKCall_SetVirtual ### Description Sets the virtual index of the SDK call if it is virtual. ### Method native ### Endpoint N/A ## PrepSDKCall_SetSignature ### Description Finds an address in a library using a signature and sets it as the address to use for the SDK call. ### Method native ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example N/A ### Response #### Success Response (200) - **true** (bool) - True on success, false if nothing was found. #### Response Example N/A ``` -------------------------------- ### Get Native Cell Reference (SourcePawn) Source: https://sm.alliedmods.net/new-api/functions/__raw Gets a cell value from a native parameter by reference. It requires the parameter number and returns the cell's value. Errors occur if the parameter number is invalid or called from a non-native function. ```SourcePawn native any GetNativeCellRef(int param); ``` -------------------------------- ### Cookie Methodmap: Constructor and Find (SourcePawn) Source: https://sm.alliedmods.net/new-api/clientprefs/__raw Defines the constructor for creating a new client preference cookie and a static method for finding an existing cookie by its name. Both return handles that should be closed when no longer needed. ```SourcePawn methodmap Cookie < Handle { // Creates a new Client preference cookie. // // Handles returned can be closed via CloseHandle() when // no longer needed. // // @param name Name of the new preference cookie. // @param description Optional description of the preference cookie. // @param access What CookieAccess level to assign to this cookie. // @return A handle to the newly created cookie. If the cookie already // exists, a handle to it will still be returned. // @error Cookie name is blank. public native Cookie(const char[] name, const char[] description, CookieAccess access); // Searches for a Client preference cookie. // // Handles returned by Cookie.Find can be closed via CloseHandle() when // no longer needed. // // @param name Name of cookie to find. // @return A handle to the cookie if it is found, null otherwise. public static native Cookie Find(const char[] name); // Set the value of a Client preference cookie. // // @param client Client index. // @param value String value to set. // @error Invalid cookie handle or invalid client index. public native void Set(int client, const char[] value); // Set the integer value of a Client preference cookie. // // @param client Client index. // @param value Integer value to set. ``` -------------------------------- ### Get Native Cell (SourcePawn) Source: https://sm.alliedmods.net/new-api/functions/__raw Gets a single cell (integer or float) value from a native parameter. It requires the parameter number and returns the cell's value. Errors occur if the parameter number is invalid or called from a non-native function. ```SourcePawn native any GetNativeCell(int param); ``` -------------------------------- ### GetMapTimeLeft - Get Map Time Remaining Source: https://sm.alliedmods.net/new-api/timers/__raw Gets an estimate of the time remaining before the current map ends. If the server hasn't processed any frames yet (e.g., no players joined), the time left is considered infinite. Returns true if the operation is supported. ```sm native bool GetMapTimeLeft(int &timeleft); ``` -------------------------------- ### SourcePawn DBDriver Methodmap for Database Backend Management Source: https://sm.alliedmods.net/new-api/dbi/__raw Defines the DBDriver methodmap for managing database drivers. It includes methods to find drivers by name, retrieve their identifiers, and get product information. ```SourcePawn // A Driver represents a database backend, currently MySQL or SQLite. // // Driver handles cannot be closed. methodmap DBDriver < Handle { // Finds the driver associated with a name. // // Supported driver strings: // mysql // sqlite // // @param name Driver identification string, or an empty string // to return the default driver. // @return Driver handle, or null on failure. public static native DBDriver Find(const char[] name = ""); // Retrieves a driver's identification string. // // Example: "mysql", "sqlite" // // @param ident Identification string buffer. // @param maxlength Maximum length of the buffer. public native void GetIdentifier(char[] ident, int maxlength); // Retrieves a driver's product string. // // Example: "MySQL", "SQLite" // // @param product Product string buffer. // @param maxlength Maximum length of the buffer. public native void GetProduct(char[] product, int maxlength); }; ``` -------------------------------- ### DHooks Extension Setup (SourcePawn) Source: https://sm.alliedmods.net/new-api/dhooks/__raw Configuration for the DHooks extension. Defines the extension name, file, and autoload/required settings based on preprocessor directives. ```SourcePawn public Extension __ext_dhooks = { name = "dhooks", file = "dhooks.ext", #if defined AUTOLOAD_EXTENSIONS autoload = 1, #else autoload = 0, #endif #if defined REQUIRE_EXTENSIONS required = 1, #else required = 0, #endif }; ``` -------------------------------- ### Get Client Preference Cookie (Integer) Source: https://sm.alliedmods.net/new-api/clientprefs/__raw Retrieves the integer value of a client preference cookie. It first gets the string value and then attempts to convert it to an integer, returning a default value if the conversion fails. Errors can occur if the cookie handle or client index is invalid. ```SourcePawn // @error Invalid cookie handle or invalid client index. public int GetInt(int client, int defaultValue = 0) { char buffer[12]; this.Get(client, buffer, sizeof(buffer)); int value; if (!StringToIntEx(buffer, value)) { value = defaultValue; } return value; } ```