### Execute VScript Example Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt An example script demonstrating the use of VScript execution, originally posted on AlliedMods forums. ```javascript // Example script for VScript execution // (Actual code not provided in source, only reference to forum post) ``` -------------------------------- ### InstallBotControl Function Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Function to install bot control logic. ```APIDOC ## InstallBotControl Function ### Description This function is used for finding the ZombieManager on Windows and is related to installing bot control functionalities. It may be called in conjunction with level changes. ### Method Not Applicable (Function Signature) ### Endpoint Not Applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### CDirectorScavengeMode_OnBeginRoundSetupTime Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Used to reset the setup timer during scavenge mode. ```text "CDirectorScavengeMode_OnBeginRoundSetupTime" { "library" "server" "linux" "@_ZN21CDirectorScavengeMode21OnBeginRoundSetupTimeEv" "windows" "\x55\x8B\xEC\x83\xEC\x10\x56\x8B\xF1\xE8\x2A\x2A\x2A\x2A\x84\xC0\x74\x2A\xF3" } ``` -------------------------------- ### Director::ForceVersusStart Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Forces the start of a versus game mode. ```APIDOC ## Director::ForceVersusStart ### Description Forces the start of a versus game, allowing PZs to spawn. ### Library server ### Signatures - **Linux**: @_ZN8Director16ForceVersusStartEv - **Windows**: \x83\x2A\x2A\x53\x55\x56\x8B\x2A\x57\x89\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B ``` -------------------------------- ### CBaseBackpackItem Function Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Function for handling the start of an action for backpack items. ```APIDOC ## CBaseBackpackItem::StartAction ### Description Initiates an action for a backpack item. This can be used as a pre-hook to modify item use durations or as a post-hook to reset them. ### Method thiscall ### Endpoint N/A ### Arguments - **actionType** (int) - The type of action being performed (e.g., using a first aid kit, ammo pack). - **actionTrigger** (int) - The trigger for the action. ### Return Value - int - Result of starting the action. ``` -------------------------------- ### Script_ForceSurvivalStart API Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt This function forces the start of a survival mode in the game. It is available on both Linux and Windows platforms. ```APIDOC ## Script_ForceSurvivalStart ### Description Forces the start of a survival mode. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ### Platform Specifics - **Linux**: `@_ZL25Script_ForceSurvivalStartv` - **Windows**: `\xE8\x2A\x2A\x2A\x2A\x84\x2A\x74\x2A\xA1\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x80\x2A\x00\x75` ``` -------------------------------- ### CTerrorWeapon::OnSwingStart Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Handles the event when a Terror Weapon swing starts. ```APIDOC ## CTerrorWeapon::OnSwingStart ### Description Handles the event when a Terror Weapon swing starts. ### Method Not specified (likely internal C++ method) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **return** (int) - An integer indicating the result of the operation. #### Response Example None ``` -------------------------------- ### Core Setup and Initialization Source: https://context7.com/silvdev/left4dhooks/llms.txt This section details how to include the Left 4 DHooks library and handle its loading to ensure it's available for use in your SourceMod plugins. ```APIDOC ## Core Setup and Initialization ### Description This section details how to include the Left 4 DHooks library and handle its loading to ensure it's available for use in your SourceMod plugins. ### Request Example ```sourcepawn #include #include #include public Plugin myinfo = { name = "My L4D Plugin", author = "Author", description = "Example plugin using Left 4 DHooks", version = "1.0", url = "" }; bool g_bLeft4Dead2; bool g_bLibraryActive; public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { EngineVersion test = GetEngineVersion(); if (test == Engine_Left4Dead) g_bLeft4Dead2 = false; else if (test == Engine_Left4Dead2) g_bLeft4Dead2 = true; else { strcopy(error, err_max, "Plugin only supports Left 4 Dead 1 & 2."); return APLRes_SilentFailure; } return APLRes_Success; } public void OnLibraryAdded(const char[] name) { if (strcmp(name, "left4dhooks") == 0) g_bLibraryActive = true; } public void OnAllPluginsLoaded() { if (!g_bLibraryActive) LogError("Required plugin left4dhooks is missing."); } ``` ### Response #### Success Response (200) This code snippet demonstrates successful library loading and initialization checks. #### Response Example No direct response example, but successful execution means `g_bLibraryActive` will be true if the library is loaded. ``` -------------------------------- ### Core Setup and Initialization Source: https://context7.com/silvdev/left4dhooks/llms.txt Includes necessary headers and handles library loading to ensure Left 4 DHooks Direct is available. Checks for L4D1 or L4D2 compatibility. ```sourcepawn #include #include #include public Plugin myinfo = { name = "My L4D Plugin", author = "Author", description = "Example plugin using Left 4 DHooks", version = "1.0", url = "" }; bool g_bLeft4Dead2; bool g_bLibraryActive; public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { EngineVersion test = GetEngineVersion(); if (test == Engine_Left4Dead) g_bLeft4Dead2 = false; else if (test == Engine_Left4Dead2) g_bLeft4Dead2 = true; else { strcopy(error, err_max, "Plugin only supports Left 4 Dead 1 & 2."); return APLRes_SilentFailure; } return APLRes_Success; } public void OnLibraryAdded(const char[] name) { if (strcmp(name, "left4dhooks") == 0) g_bLibraryActive = true; } public void OnAllPluginsLoaded() { if (!g_bLibraryActive) LogError("Required plugin left4dhooks is missing."); } ``` -------------------------------- ### CTerrorWeapon::OnSwingStart Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Hook for the start of a weapon swing action. Provides Linux and Windows specific implementations. ```APIDOC ## CTerrorWeapon::OnSwingStart ### Description Callback function executed when a weapon swing begins. This hook is intended for use with the `server` library. ### Method N/A (Hook) ### Endpoint N/A (Hook) ### Parameters * `CTerrorWeapon *this`: Pointer to the `CTerrorWeapon` instance. ### Request Example None ### Response None ``` -------------------------------- ### CDirector::IsAnySurvivorInStartArea Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Checks if any survivor is currently in the start area. This signature is for the server library. ```APIDOC ## CDirector::IsAnySurvivorInStartArea ### Description Checks if any survivor is currently in the start area. ### Method N/A (Function Signature) ### 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 ### Signatures - **Linux**: `@_ZNK9CDirector24IsAnySurvivorInStartAreaEv` - **Windows**: `U‹*ƒ**ó********Pó` ``` -------------------------------- ### CDirectorMusicBanks::OnRoundStart Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for CDirectorMusicBanks::OnRoundStart. Has a unique string "Event.Reveal". Used solely to get the offset for TheDirector. ```json { "library" "server" "windows" "\x55\x8B\xEC\x83\xEC\x2A\x56\x57\x8B\xF9\x8B\x0D\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x84\xC0\x0F" } ``` -------------------------------- ### CThrow::ActivateAbililty Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt This function is related to starting a tank rock throw. It has 2 references within its function. ```APIDOC ## CThrow::ActivateAbililty ### Description Starts a tank rock throw. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ## Implementation Details ### Library server ### Linux @_ZN6CThrow15ActivateAbilityEv ### Windows \x83\x2A\x2A\x55\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\xC1\x2A\x2A\x8D\x2A\x2A\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\xC1\x2A\x2A\x39\x2A\x2A\x0F\x85\x2A\x2A\x2A\x2A\x53 ``` -------------------------------- ### CDirector::OnMobRushStart Function Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for the mob rush start event, used to reset the natural horde timer. ```text "CDirector::OnMobRushStart" { "library" "server" "linux" "@_ZN9CDirector14OnMobRushStartEv" "windows" "\x55\x8B\xEC\x83\xEC\x08\xA1\x2A\x2A\x2A\x2A\xD9\x40\x2C\x56\x57\x51" } ``` -------------------------------- ### Get CGameRulesProxy::NotifyNetworkStateChanged Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Called before changing networked game state data. Find "Going to intermission...\n" in CGameRules::GoToIntermission. ```Assembly /* CGameRulesProxy::NotifyNetworkStateChanged() This function is called before changing a variety of pieces of networked data (data which is reflected in network game states). - Find "Going to intermission...\n" in CGameRules::GoToIntermission - Last call in the func */ "CGameRulesProxy::NotifyNetworkStateChanged" { "library" "server" "linux" "@_ZN15CGameRulesProxy25NotifyNetworkStateChangedEv" "windows" "\xA1\x2A\x2A\x2A\x2A\x85\xC0\x74\x2A\x80\x78" /* A1 ? ? ? ? 85 C0 74 ? 80 78 */ } ``` -------------------------------- ### Execute VScript and Get Output (L4D2) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt Allows executing VScript code and retrieving its return value. The buffer size can be small for short returns, with a maximum code length of 1006 characters. Optimized to reuse the same entity for multiple calls within a frame. ```cpp native L4D2_GetVScriptOutput(entity owner, const char* script, char* buffer, int bufferSize); ``` -------------------------------- ### Start Tank Rock Throw Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Signature for starting a tank rock throw. Used for hooking into the CThrow::ActivateAbility function. ```json { "library" "server" "linux" "@_ZN6CThrow15ActivateAbilityEv" "windows" "\x83\x2A\x2A\x55\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x81\x2A\x2A\x2A\x2A\x2A\xC1\x2A\x2A\x8D\x2A\x2A\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\xC1\x2A\x2A\x39\x2A\x2A\x0F\x85\x2A\x2A\x2A\x2A\x53" } ``` -------------------------------- ### Check Survivor Start Area (L4D1 & L4D2) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt Natives to check if any survivor is in the start area or if the game is in the first or last checkpoint. ```cpp native L4D_IsAnySurvivorInStartArea(); ``` ```cpp native L4D_IsInFirstCheckpoint(); ``` ```cpp native L4D_IsInLastCheckpoint(); ``` -------------------------------- ### CBaseBackpackItem::StartAction Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for the CBaseBackpackItem::StartAction method. ```APIDOC ## CBaseBackpackItem::StartAction ### Description Initiates an action for a backpack item. ### Library server ### Signatures - **Linux**: @_ZN17CBaseBackpackItem11StartActionENS_22BackpackItemActionTypeENS_25BackpackItemActionTriggerE - **Windows**: \x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x85\x2A\x75\x2A\x5F\x32\x2A\x5E\x8B ``` -------------------------------- ### CDirector::OnFinishIntro Function Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for the intro finish event, identified by searching for 'hostfile' references. ```text "CDirector::OnFinishIntro" { "library" "server" "linux" "@_ZN9CDirector13OnFinishIntroEv" "windows" "\x55\x8B\x2A\x51\x8B\x2A\x2A\x2A\x2A\x2A\x56\x8B\x2A\x2A\x2A\x2A\x2A\x6A\x2A\xE8\x2A\x2A\x2A\x2A\x80" } ``` -------------------------------- ### GET /signatures/CDirectorScavengeMode_OnBeginRoundSetupTime Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves the memory signature for the CDirectorScavengeMode_OnBeginRoundSetupTime hook. ```APIDOC ## GET /signatures/CDirectorScavengeMode_OnBeginRoundSetupTime ### Description Retrieves the memory signature for the CDirectorScavengeMode_OnBeginRoundSetupTime hook, used to reset the setup timer during scavenge mode. ### Method GET ### Endpoint /signatures/CDirectorScavengeMode_OnBeginRoundSetupTime ### Response #### Success Response (200) - **library** (string) - The target library (server) - **linux** (string) - Symbol name for Linux - **windows** (string) - Hex signature for Windows ``` -------------------------------- ### Find nav_update_lighting Offset (Linux and Windows) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Provides offsets for the nav_update_lighting function in the server library for Linux and Windows. The Windows offset is a byte signature, and a search string is provided for context. ```json "nav_update_lighting" { "library" "server" "linux" "@_ZL19nav_update_lightingRK8CCommand" "windows" "\x55\x8B\x2A\x8B\x2A\x2A\x57\x33\x2A\x83\x2A\x2A\x75" /* 55 8B ? 8B ? ? 57 33 ? 83 ? ? 75 */ /* Search: "Computed lighting for %d/%d areas\n" */ } ``` -------------------------------- ### CBaseAbility::CreateForPlayer Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Creates a CBaseAbility instance for a given TerrorPlayer. ```APIDOC ## CBaseAbility::CreateForPlayer ### Description Creates a CBaseAbility for a TerrorPlayer. ### Library server ``` -------------------------------- ### GET /offsets/timers Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves memory offsets for L4D2 countdown and interval timers. ```APIDOC ## GET /offsets/timers ### Description Provides memory offsets for various countdown and interval timers used by the game director and survival mode. ### Method GET ### Response #### Success Response (200) - **L4D2CountdownTimer_*** (object) - Offsets for various spawn and survival timers. - **L4D2IntervalTimer_*** (object) - Offsets for death timers. - **CDirectorSurvivalMode::m_iSetupNotifyTime** (object) - Offset for survival setup notification time. ``` -------------------------------- ### Script_ForceScavengeStart API Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt This function initiates a scavenge mode. It is implemented for both Linux and Windows. ```APIDOC ## Script_ForceScavengeStart ### Description Initiates a scavenge mode. ### Method N/A (Function Call) ### Endpoint N/A ### Parameters None ### Request Example None ### Response None ### Platform Specifics - **Linux**: `@_ZL25Script_ForceScavengeStartv` - **Windows**: `\xE8\x2A\x2A\x2A\x2A\x84\x2A\x74\x2A\xA1\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x80\x2A\x2A\x00\x75\x2A\xE8` ``` -------------------------------- ### CSpitterProjectile::Create Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Hook definition for creating a Spitter projectile, including library, Linux mangled name, and Windows memory signature. ```APIDOC ## CSpitterProjectile::Create ### Description Defines the memory signature and symbol for the CSpitterProjectile::Create function. ### Library server ### Linux Symbol @_ZN18CSpitterProjectile6CreateERK6VectorRK6QAngleS2_S2_P20CBaseCombatCharacter ### Windows Signature \x55\x8B\x2A\x8B\x2A\x2A\x8B\x2A\x2A\x53\x8B\x2A\x2A\x56\x57\x50\x51\x53\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xD9\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x8B\x2A\xD9\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x57\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x57\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x57 ``` -------------------------------- ### CVomitJarProjectile::Create Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Creates a Vomit Jar projectile. ```APIDOC ## CVomitJarProjectile::Create ### Description Creates a Vomit Jar projectile. ### Method cdecl ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **return** (cbaseentity) - The created Vomit Jar projectile entity. #### Response Example None ``` -------------------------------- ### Check Player Saferoom Status Source: https://context7.com/silvdev/left4dhooks/llms.txt Determines if a player is currently within the starting or ending saferoom area. ```sourcepawn void CheckPlayerSaferoom(int client) { if (L4D_IsInFirstCheckpoint(client)) PrintToChat(client, "You are in the starting saferoom"); else if (L4D_IsInLastCheckpoint(client)) PrintToChat(client, "You are in the ending saferoom"); else PrintToChat(client, "You are outside saferooms"); } ``` -------------------------------- ### Find NextBotManager::StartAssault Offset (Linux and Windows) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Details the offsets for the NextBotManager::StartAssault function in the server library for both Linux and Windows. The Windows offset is a byte signature. ```json "NextBotManager::StartAssault" { "library" "server" "linux" "@_ZN14NextBotManager12StartAssaultEv" "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x3D\x2A\x2A\x2A\x2A\x74\x2A\x56\x57\x0F\x2A\x2A\x8B\x2A\x2A\x03\x2A\x03\x2A\x03\x2A\x8B\x2A\x2A\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xFF\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x83" /* ? ? ? ? ? ? ? 3D ? ? ? ? 74 ? 56 57 0F ? ? 8B ? ? 03 ? 03 ? 03 ? 8B ? ? 8B ? 8B ? ? ? ? ? 8B ? FF ? 8B ? E8 ? ? ? ? 83 */ } ``` -------------------------------- ### GET /signatures/HumanPlayerLimitReached Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves the memory signature for the HumanPlayerLimitReached hook, used to manage player rejection logic. ```APIDOC ## GET /signatures/HumanPlayerLimitReached ### Description Retrieves the memory signature for the HumanPlayerLimitReached hook, which rejects players when the human player limit is reached. ### Method GET ### Endpoint /signatures/HumanPlayerLimitReached ### Response #### Success Response (200) - **library** (string) - The target library (server) - **windows** (string) - Hex signature for Windows ``` -------------------------------- ### GET /signatures/ConnectClientLobbyCheck Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves the memory signature for the ConnectClientLobbyCheck hook, used to manage lobby connection logic. ```APIDOC ## GET /signatures/ConnectClientLobbyCheck ### Description Retrieves the memory signature for the ConnectClientLobbyCheck hook, which is used to remove skippable code when sv_allow_lobby_connect is disabled. ### Method GET ### Endpoint /signatures/ConnectClientLobbyCheck ### Response #### Success Response (200) - **library** (string) - The target library (engine) - **linux** (string) - Hex signature for Linux - **windows** (string) - Hex signature for Windows ``` -------------------------------- ### Define NavMesh and TheNavAreas Library Offsets Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Configuration blocks for mapping server library symbols to Linux memory addresses. ```text "TheNavAreas" { "library" "server" "linux" "@TheNavAreas" } "TheNavMesh" { "library" "server" "linux" "@TheNavMesh" } ``` -------------------------------- ### Get Highest Flow Survivor Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt Fixes errors in L4D_GetHighestFlowSurvivor, ensuring it functions correctly in version 1.11. ```cpp native L4D_GetHighestFlowSurvivor(); ``` -------------------------------- ### Define InstallBotControl Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Used for finding the ZombieManager on Windows. ```text "InstallBotControl" { "library" "server" "linux" "@_ZN15InfoChangelevel16StartChangeLevelEPK10Checkpoint" "windows" "\x8B\x0D\x2A\x2A\x2A\x2A\x85\x2A\x74\x2A\x8B\x2A\x8B\x2A\x6A\x01\xFF\x2A\xA1" } ``` -------------------------------- ### Check Survivor Game Progress Source: https://context7.com/silvdev/left4dhooks/llms.txt Detects if any survivor has left a safe area or if any survivor is still in the starting area. ```sourcepawn // Check any survivor has left safe area void CheckGameProgress() { if (L4D_HasAnySurvivorLeftSafeArea()) PrintToChatAll("The game has begun - survivors left the safe area!"); if (L4D_IsAnySurvivorInStartArea()) PrintToChatAll("Some survivors are still in the start area"); } ``` -------------------------------- ### CTerrorPlayer::StartUseAction Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for the CTerrorPlayer::StartUseAction method. ```APIDOC ## CTerrorPlayer::StartUseAction ### Description Initiates a use action for a player character. ### Library server ### Signatures - **Linux**: @_ZN13CTerrorPlayer14StartUseActionE21TerrorPlayerUseActionP11CBaseEntityfb - **Windows**: \x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x8B\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x84 ``` -------------------------------- ### Get CTerrorPlayer::SetNextShoveTime Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Sets the next shove time for a CTerrorPlayer. Found by "Psyk0tik". ```Assembly /** * Thanks to "Psyk0tik" from: https://github.com/Psykotikism/L4D1-2_Signatures * CTerrorPlayer::SetNextShoveTime(float) * * How to find on Windows: * 1. Find the function's offsets with asherkin's VTable dump. * 2. In IDA Pro, go to the ".rdata" section of the Windows binary. * 3. Search for "CTerrorPlayer::`vftable'" to jump to the "CTerrorPlayer" vtable. * 4. Compare your dump's offsets with asherkin's dump's offsets to find the target function. * 5. Look for the target function in the Windows binary. **/ "CTerrorPlayer::SetNextShoveTime" { "library" "server" "linux" "@_ZN13CTerrorPlayer16SetNextShoveTimeEf" ``` -------------------------------- ### GET /offsets/weapons Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves memory offsets for weapon properties including damage, clip size, and spread mechanics. ```APIDOC ## GET /offsets/weapons ### Description Provides memory offsets for weapon-related data structures, including integer-based properties like damage and clip size, and float-based properties like spread and movement speed. ### Method GET ### Response #### Success Response (200) - **L4D2IntWeapon_*** (object) - Offsets for integer weapon properties. - **L4D2FloatWeapon_*** (object) - Offsets for float weapon properties. ``` -------------------------------- ### Hook CBaseBackpackItem::StartAction Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for hooking CBaseBackpackItem::StartAction on Linux and Windows. This is used for detouring the function, often for backpack item interactions. ```c++ "CBaseBackpackItem::StartAction" { "library" "server" "linux" "@_ZN17CBaseBackpackItem11StartActionENS_22BackpackItemActionTypeENS_25BackpackItemActionTriggerE" "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x85\x2A\x75\x2A\x5F\x32\x2A\x5E\x8B" } ``` -------------------------------- ### CBaseAbility CreateForPlayer Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Signature for the CBaseAbility::CreateForPlayer function. ```text "CBaseAbility::CreateForPlayer" { "library" "server" "linux" "@_ZN12CBaseAbility15CreateForPlayerEP13CTerrorPlayer" "windows" "\x83\x2A\x2A\x56\x8B\x2A\x2A\x2A\x85\x2A\x0F\x84\x2A\x2A\x2A\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x83" /* 83 ? ? 56 8B ? ? ? 85 ? 0F 84 ? ? ? ? 8B ? E8 ? ? ? ? 83 */ // Updated by SilverShot. } ``` -------------------------------- ### GET /offsets/game-entities Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves memory offsets for core game entities such as flames, flow distance, and player attributes. ```APIDOC ## GET /offsets/game-entities ### Description Provides memory offsets for internal game engine variables including flame counts, map flow distances, and navigation attributes. ### Method GET ### Response #### Success Response (200) - **m_maxFlames** (object) - Windows/Linux offsets for max flames. - **m_fMapMaxFlowDistance** (object) - Windows/Linux offsets for map flow distance. - **m_flow** (object) - Windows/Linux offsets for flow. - **m_intensity** (object) - Windows/Linux offsets for intensity. - **m_chapter** (object) - Windows/Linux offsets for chapter. - **m_attributeFlags** (object) - Windows/Linux offsets for navigation attribute flags. - **m_spawnAttributes** (object) - Windows/Linux offsets for spawn attributes. ``` -------------------------------- ### TerrorNavMesh::GetInitialCheckpoint Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves the initial checkpoint for TerrorNavMesh. ```APIDOC ## TerrorNavMesh::GetInitialCheckpoint ### Description Retrieves the initial checkpoint for TerrorNavMesh. ### Method N/A (Function Symbol) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Error Handling N/A ``` -------------------------------- ### Get Current Finale Stage (L4D2) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt Native to retrieve the current stage of the finale sequence. Available only for L4D2. ```cpp native L4D2_GetCurrentFinaleStage(); ``` -------------------------------- ### StartChangeLevel Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for InfoChangelevel::StartChangeLevel. Used for finding ZombieManager on Windows. Contains the unique string "Would change level, but not going to!\n". ```json { "library" "server" "linux" "@_ZN15InfoChangelevel16StartChangeLevelEPK10Checkpoint" "windows" "\x55\x8B\xEC\xA1\x2A\x2A\x2A\x2A\x83\x78\x30\x00\x56\x8B\xF1\x74" } ``` -------------------------------- ### Get CTerrorPlayer::SetShovePenalty Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Sets the shove penalty for a CTerrorPlayer. Search for "Claw.Swing" and xref to VTable. ```Assembly /** * CTerrorPlayer::SetShovePenalty(CTerrorPlayer *this, int) * * 1. Search for "Claw.Swing" and enter the longer function. * 2. XRef this function to the VTable. * 3. Above 2 entries is "CTerrorWeapon::TrySwing" that calls target function. * 4. Compare with Linux. **/ "CTerrorPlayer::SetShovePenalty" { "library" "server" "linux" "@_ZN13CTerrorPlayer15SetShovePenaltyEi" "windows" "\x55\x8B\xEC\x56\x57\x8B\x2A\x2A\x8B\x2A\x39\x2A\xF0\x2C\x00\x00" /* 55 8B EC 56 57 8B ? ? 8B ? 39 ? F0 2C 00 00 */ } ``` -------------------------------- ### CSpitterProjectile::Create Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Memory signature for the CSpitterProjectile::Create function on Windows. ```text "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x53\x8B\x2A\x2A\x56\x57\x50\x51\x53\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B" ``` ```text "windows" "\x55\x8B\x2A\x8B\x2A\x2A\x8B\x2A\x2A\x53\x8B\x2A\x2A\x56\x57\x50\x51\x53\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x68\x2A\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\xD9\x2A\x2A\x2A\x2A\x2A\x83\x2A\x2A\x8B\x2A\xD9\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x57\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x57\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x57" ``` -------------------------------- ### Hook CGasCan::ShouldStartAction Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for hooking CGasCan::ShouldStartAction on Linux and Windows. Useful for intercepting the start of a gas can pouring action. ```c++ "CGasCan::ShouldStartAction" { "library" "server" "linux" "@_ZN7CGasCan17ShouldStartActionEN17CBaseBackpackItem22BackpackItemActionTypeEP13CTerrorPlayerP11CBaseEntity" "windows" "\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x57\x8B\x2A\x85\x2A\x74\x2A\x8B\x2A\xE8\x2A\x2A\x2A\x2A\x84\x2A\x75" } ``` -------------------------------- ### Signature: CTerrorAmmoDefSystem::Init Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for the CTerrorAmmoDefSystem::Init function. ```APIDOC ## Signature: CTerrorAmmoDefSystem::Init ### Description Signature for the CTerrorAmmoDefSystem::Init function. ### library - server ### windows - \xD9\x05\x2A\x2A\x2A\x2A\x6A\x0E\x6A\x0A\x6A\x08\x2A\xD9\x2A\x2A\x68\x2A\x2A\x2A\x2A\x6A\x00\x6A\x00\x6A\x01\x68\x02\x00\x00\x80 ### Notes Not actual function beginning, starts at the second call. Hex: D9 05 ? ? ? ? 6A 0E 6A 0A 6A 08 ? D9 ? ? 68 ? ? ? ? 6A 00 6A 00 6A 01 68 02 00 00 80 ``` -------------------------------- ### Director::ForceVersusStart Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d1.txt Signature for the Director::ForceVersusStart function. Used to force the start of a versus game, allowing PZs to spawn. ```json "Script_ForceVersusStart" { "library" "server" "linux" "@_ZN8Director16ForceVersusStartEv" "windows" "\x83\x2A\x2A\x53\x55\x56\x8B\x2A\x57\x89\x2A\x2A\x2A\xE8\x2A\x2A\x2A\x2A\x8B" } ``` -------------------------------- ### Get CTerrorPlayer::GetFlowDistance Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Retrieves the flow distance for a TerrorPlayer. Search for "Director state change SUSTAIN_PEAK". ```Assembly /* * CTerrorPlayer::GetFlowDistance(TerrorNavArea::FlowType) */ "CTerrorPlayer::GetFlowDistance" { "library" "server" "linux" "@_ZNK13CTerrorPlayer15GetFlowDistanceEN13TerrorNavArea8FlowTypeE" "windows" "\x55\x8B\x2A\x8B\x2A\x8B\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x85\x2A\x74" /* 55 8B ? 8B ? 8B ? ? ? ? ? ? ? 85 ? 74 */ /* Search: "Director state change SUSTAIN_PEAK" few calls below */ /* Found by "SilverShot" */ } ``` -------------------------------- ### ZombieManager::SpawnITMob Function Signature Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Signature for spawning bile hordes, identified by the 'SpawnITMob' string. ```text "ZombieManager::SpawnITMob" { "library" "server" "linux" "@_ZN13ZombieManager10SpawnITMobEi" "windows" "\x55\x8B\xEC\xA1\x2A\x2A\x2A\x2A\xD9\x40\x0C\x56\x57" } ``` -------------------------------- ### Get Scripted Event Manager Pointer (L4D2) Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/scripting/l4dd/left4dhooks_changelog.txt Replicates L4D2_GetCDirectorScriptedEventManager to return the scripted event manager pointer. Available only for L4D2. ```cpp native L4D2Direct_GetScriptedEventManager(); ``` -------------------------------- ### Function Signatures and Pointers Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Definitions for game engine functions and global pointers including their library, Linux mangled names, and Windows byte signatures. ```APIDOC ## Function Signatures ### CTerrorGameRules::RecordInfectedDamageForVersus - **Library**: server - **Linux**: @_ZN16CTerrorGameRules29RecordInfectedDamageForVersusEi - **Windows**: \x55\x8B\x2A\xF7\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x53\x56 ### CNavArea::IsBlocked - **Library**: server - **Linux**: @_ZNK8CNavArea9IsBlockedEib - **Windows**: \x55\x8B\x2A\x80\x2A\x2A\x2A\x74\x2A\x8B\x2A\x2A\x85\x2A\x79 ### NavAreaBuildPath_ShortestPathCost - **Library**: server - **Linux**: @_Z16NavAreaBuildPathI16ShortestPathCostEbP8CNavAreaS2_PK6VectorS5_RT_PS2_fib - **Windows**: \x53\x8B\x2A\x83\x2A\x2A\x83\x2A\x2A\x83\x2A\x2A\x55\x8B\x2A\x2A\x89\x2A\x2A\x2A\x8B\x2A\x83\x2A\x2A\xA1\x2A\x2A\x2A\x2A\x33\x2A\x56\x89 ## Pointers ### TheDirector - **Library**: server - **Linux**: @TheDirector ### TheZombieManager - **Library**: server - **Linux**: @TheZombieManager ### g_pGameRules - **Library**: server - **Linux**: @g_pGameRules ### gEntList - **Library**: server - **Linux**: @gEntList - **Windows**: \x2A\x2A\x2A\x2A\x2A\x8B\x2A\x2A\x57\x8B\x2A\x68\x2A\x2A\x2A\x2A\x57\xE8\x2A\x2A\x2A\x2A\x83 ``` -------------------------------- ### Respawn All Dead Survivors Source: https://context7.com/silvdev/left4dhooks/llms.txt Iterates through all connected players and respawns any dead survivors. This is useful for quickly getting the team back into the game. ```sourcepawn // Respawn all dead survivors void RespawnAllDead() { for (int i = 1; i <= MaxClients; i++) { if (IsClientInGame(i) && GetClientTeam(i) == 2 && !IsPlayerAlive(i)) { L4D_RespawnPlayer(i, false); } } } ``` -------------------------------- ### g_pScriptVM Pointer Source: https://github.com/silvdev/left4dhooks/blob/main/sourcemod/gamedata/left4dhooks.l4d2.txt Pointer to the script virtual machine. ```APIDOC ## g_pScriptVM Pointer ### Description This is a pointer to the script virtual machine. ### Method N/A (Variable Pointer) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Pointer Signature - **linux**: `@g_pScriptVM` ``` -------------------------------- ### L4D_GetTempHealth / L4D_SetTempHealth - Temporary Health Management Source: https://context7.com/silvdev/left4dhooks/llms.txt Functions to get and set temporary (decaying) health on survivors. Useful for buffs or special abilities. ```APIDOC ## L4D_GetTempHealth / L4D_SetTempHealth - Temporary Health Management ### Description Get and set temporary (decaying) health on survivors. ### Functions - **L4D_GetTempHealth(int client)**: Returns the current temporary health of the player. - **L4D_SetTempHealth(int client, float amount)**: Sets the temporary health of the player. ### Example Usage ```sourcepawn // Give a player temporary health void GiveTempHealth(int client, float amount) { float current = L4D_GetTempHealth(client); L4D_SetTempHealth(client, current + amount); PrintToChat(client, "Received %.0f temp health (Total: %.0f)", amount, current + amount); } // Transfer temp health between players void TransferTempHealth(int from, int to) { float temp = L4D_GetTempHealth(from); if (temp > 0.0) { L4D_SetTempHealth(from, 0.0); float existing = L4D_GetTempHealth(to); L4D_SetTempHealth(to, existing + temp); PrintToChatAll("%N transferred %.0f temp health to %N", from, temp, to); } } ``` ```