RSSy MYGO.pl Opublikowano Luty 24, 2020 o 06:00 RSSy Udostępnij Opublikowano Luty 24, 2020 o 06:00 About: Originally two Extensions [L4D1] Left 4 Downtown and [L4D2] Left 4 Downtown 2 created by Downtown and maintained by various others, this is an all-in-one port to DHooks with many additions. This also merges natives from L4D2_Direct by "ProdigySim" and L4D_Direct port by "raziEiL". I done this to learn some stuff, add missing natives and forwards to L4D1 and add more features. Also because the extensions are often broken with SourceMod updates and confusing to find the latest gamedata or working version. Thanks to Lux and a conversation we had: using the plugin iterator and GetFunctionByName to detect which forwards are being used by plugins. This will only detour functions being used by other plugins. Plugins are rescanned on map change. Features: Many new forwards and natives in L4D1. Some new natives and forwards in L4D2. Additional features not present in the Extension versions. Addons Disabler (L4D2) included. Dynamic detouring - only detours forwards required by other plugins. Rescans on map change. Animation hooks to modify player animations. View the \addons\sourcemod\data\ folder for activity names and sequence numbers. Demo plugin demonstrating animation hooks + all forwards and natives capabilities. Bugs: Player slots is unsupported. Use the L4DToolZ Metamod plugin to increase player slots and unreserve your server. The native L4D_LobbyUnreserve is unsupported because SourceMod SDKCalls are unable to use uint64_t sized integers. Forwards L4D2_OnSendInRescueVehicle and L4D2_OnUseHealingItems are blocked in Linux L4D1/L4D2 to prevent crashes. Waiting for DHooks update to support object returns. Conflicts with Left4Downtown, remove the extension to run. Demo Plugin: There are multiple warnings when compiling, this is intentional to test everything. I've tried to test every native and forward on Windows and Linux in both games. Everything appears to be working but I might have missed something. Thanks: Lux - Lots of technical support and ideas + figuring out why some detours were broken. Peace-Maker - For the DHooks Dynamic Detour extension and various help. Dragokas - Server and support testing in Linux for both games. Spirit_12 - Various ideas and support. xZk - Support testing. Thanks to the following individuals for their contribution to the Extensions. This plugin was made using source code from the following plugins: Spoiler Code: * Original Left4Downtown extension: https://forums.alliedmods.net/showthread.php?t=91132 "Downtown1" and "XBetaAlpha" - authors of the original Left4Downtown. "pRED*" for his TF2 tools code, I looked at it a lot . and for answering questions on IRC "Fyren" for being so awesome and inspiring me from his sdktools patch to do custom |this| calls. "ivailosp" for providing the Windows addresses that needed to be patched to get player slot unlocking to work. "dvander" for making sourcemod and teaching me about the mod r/m bytes. "DDRKhat" for letting me use his Linux server to test this "Frustian" for being a champ and poking around random Linux sigs so I could the one native I actually needed. "XBetaAlpha" for making this a team effort rather than one guy writing all the code. * Original Left4Downtown2 extension: https://forums.alliedmods.net/showthread.php?t=134032 "Downtown1" and "XBetaAlpha" - authors of the original Left4Downtown. "ProdigySim" - Confogl developer interested in expanding and updating Left4Downtown. "AtomicStryker" - Sourcemod plugin developer, and part of the original Left4Downtown team. "psychonic" - Resident Sourcemod insider, started Left4Downtown2. "asherkin" - Hosting the autobuild server. "CanadaRox", "vintik", "rochellecrab", and anyone else who has submitted code in any way. * Left 4 Downtown 2 Extension updates: https://forums.alliedmods.net/showpost.php?p=1970730&postcount=397?p=1970730&postcount=397 "Visor" for "l4d2_addons_eclipse" cvar and new forwards. * Left 4 Downtown 2 Extension updates "Attano" for various github commits. * Left 4 Downtown 2 Extension updates "Accelerator74" for various github commits. * "ProdigySim" and the "ConfoglTeam" for "L4D2Direct" plugin: https://forums.alliedmods.net/showthread.php?t=180028 * "raziEiL" for "L4D_Direct Port" offsets and addresses: https://github.com/raziEiL/l4d_direct-port Admin Commands: (requires "z" flag) PHP Code: // Reloads the detour hooks, enabling or disabling depending if they're required by other plugins. // When adding or removing plugins that use any detours during gameplay. To optimize forwards by disabling unused or enabling required functions that were previously unused. sm_l4dhooks_reload CVars: PHP Code: l4d2_addons_eclipse "-1" // Addons Manager (-1: use addonconfig; 0/1: override addonconfig. left4dhooks_version // Left 4 Dhooks Direct plugin version. All Forwards and Natives: Assume everything is L4D1 and L4D2 compatible unless otherwise stated. View the include file for detailed descriptions. Forwards: (L4D1 = 31 & L4D2 = 42) Spoiler PHP Code: // ==================== // Various Forwards // ==================== // Called whenever ZombieManager::SpawnSpecial(ZombieClassType,Vector&,QAngle&) is invoked forward Action L4D_OnSpawnSpecial(int &zombieClass, const float vecPos[3], const float vecAng[3]); // Not invoked if z_spawn tank is used and it gives a ghosted/dead player tank forward Action L4D_OnSpawnTank(const float vecPos[3], const float vecAng[3]); // Called when a Witch spawns forward Action L4D_OnSpawnWitch(const float vecPos[3], const float vecAng[3]); // L4D2 only. Called when a Witch Bride spawns forward Action L4D_OnSpawnWitchBride(const float vecPos[3], const float vecAng[3]); // Called on random hordes, mini and finale hordes, and boomer hordes forward Action L4D_OnMobRushStart(); // Called on boomer hordes, increases Zombie Spawn Queue forward Action L4D_OnSpawnITMob(int &amount); // Called on natural hordes & z_spawn mob forward Action L4D_OnSpawnMob(int &amount); // This happens when a player enters ghost mode (or in finales auto-materialized) forward void L4D_OnEnterGhostState(int client); // Called when bots or players are joining a team forward Action L4D_OnIsTeamFull(int team, bool &full); // This resets the map score at the beginning of a map, and by checking forward Action L4D_OnClearTeamScores(bool newCampaign); // The campaign scores are updated after the 2nd round is completed forward Action L4D_OnSetCampaignScores(int &scoreA, int &scoreB); // A versus round is started when survivors leave the safe room, or force started after 90 seconds regardless forward Action L4D_OnFirstSurvivorLeftSafeArea(int client); // Constantly called to get players max Crouch speed forward Action L4D_OnGetCrouchTopSpeed(int target, float &retVal); // Constantly called to get players max Run speed forward Action L4D_OnGetRunTopSpeed(int target, float &retVal); // Constantly called to get players max Walk speed forward Action L4D_OnGetWalkTopSpeed(int target, float &retVal); // L4D2 only. A script value is map specific forward Action L4D_OnGetScriptValueInt(const char[] key, int &retVal); // L4D2 only. A script value is map specific forward Action L4D_OnGetScriptValueFloat(const char[] key, float &retVal); // L4D2 only. A script value is map specific forward Action L4D_OnGetScriptValueString(const char[] key, const char[] defaultVal, char retVal[128]); // L4D2 only. Used to deny/allow difficulty changes in different game modes forward Action L4D_OnHasConfigurableDifficulty(int &retVal); // L4D2 only. Constantly called to get the survivor character set forward Action L4D_OnGetSurvivorSet(int &retVal); // L4D2 only. Constantly called to get the survivor character set forward Action L4D_OnFastGetSurvivorSet(int &retVal); // Passed values are from the map's Mission Keyvalues. If those keyvalues don't exist, they are from cvar and other globals forward Action L4D_OnGetMissionVSBossSpawning(float &spawn_pos_min, float &spawn_pos_max, float &tank_chance, float &witch_chance); // Not invoked if tank is bot forward void L4D_OnReplaceTank(int tank, int newtank); // Is used for displaying the "X gets Tank" window and transferring Tank control forward Action L4D_OnTryOfferingTankBot(int tank_index, bool &enterStasis); // Called when a tank throws a rock. Blocking this call will keep the tank from throwing a rock forward Action L4D_OnCThrowActivate(int ability); // Called whenever a tank uses his primary (punch) or secondary (throw) attack forward Action L4D2_OnSelectTankAttack(int client, int &sequence); // L4D2 only. Called when a player uses his melee weapons primary attack forward Action L4D_OnStartMeleeSwing(int client, bool boolean); // Called when the last Finale stage is reached and the Rescue means becomes 'available'. forward Action L4D2_OnSendInRescueVehicle(); // L4D2 only. Called when the director stage changes forward Action L4D2_OnChangeFinaleStage(int &finaleType, const char[] arg); // Called before score calculations and the scoreboard display forward Action L4D2_OnEndVersusModeRound(bool countSurvivors); // Called after all score calculations are complete and the scoreboard shows forward void L4D2_OnEndVersusModeRound_Post(); // Called when a player is about to grab a ledge forward Action L4D_OnLedgeGrabbed(int client); // Called post-revive so all data values are post-revive status. forward void L4D2_OnRevived(int client); // Source is always null for Charger impacts (Valve) forward Action L4D2_OnStagger(int target, int source); // L4D2 only uses this on Special Infected. Blocks hunter dead stop forward Action L4D_OnShovedBySurvivor(int client, int victim, const float vecDir[3]); // Called for every single shovable and even some of the unshovable entities in the game forward Action L4D2_OnEntityShoved(int client, int entity, int weapon, float vecDir[3], bool bIsHighPounce); // The survivor that is about to get stumbled as a result of "attacker" capping someone in close proximity forward Action L4D2_OnPounceOrLeapStumble(int victim, int attacker); // Molotov and Spitter fire/goo spread forward Action L4D2_OnSpitSpread(int spitter, int projectile, float &x, float &y, float &z); // Causes bots to use or give healing items (except in safe room on non-expert) forward Action L4D2_OnUseHealingItems(int client); // Indicates which item the Survivor Bot will attempt to pick up forward Action L4D2_OnFindScavengeItem(int client, int &item); // Called when Special Infected are targeting a victim forward Action L4D2_OnChooseVictim(int specialInfected, int &curTarget); // L4D2 only. Called when the client's material system is expecting instructions from the server in regards to addons forward Action L4D2_OnClientDisableAddons(const char[] SteamID); // DEPRECATED - UNUSED // forward Action L4D_OnInfectedShoved(int infected, int entity); // forward void L4D2_OnWaterMove(int client); Natives: (L4D1 = 17 + 21 [direct] & L4D2 = 54 + 39 [direct]) Spoiler PHP Code: // ==================== // Animation Hook // View the data folder cfgs for a list of Activity strings and their related sequence numbers. // ==================== // AnimHookCallback callback called whenever animation is invoked. function Action(int client, int &sequence); // Add a client animation hook. native bool AnimHookEnable(int client, AnimHookCallback callback); // Remove a client animation hook. native bool AnimHookDisable(int client, AnimHookCallback callback); // Retrieves the activity string from it's relative animation number. native bool AnimGetActivity(int sequence, char[] activity, int maxlength); // Retrieves the animation activity sequence number from an activity string native int AnimGetFromActivity(char[] activity); // ==================== // Various Natives // ==================== // L4D2 only. Restarts the setup timer (when in scavenge mode) native int L4D_ScavengeBeginRoundSetupTime(); // L4D2 only. Resets the natural mob (horde) timer native void L4D_ResetMobTimer(); // L4D2 only. Get the remaining spawn time for an SI native float L4D_GetPlayerSpawnTime(int player); // Restarts the round, switching the map if necessary native int L4D_RestartScenarioFromVote(const char[] map); // L4D2 only. Gets the max versus completion score for the map native int L4D_GetVersusMaxCompletionScore(); // L4D2 only. Sets the max versus completion score for the map native int L4D_SetVersusMaxCompletionScore(int score); // L4D2 only. The campaign scores are not set until the end of round 2, use L4D_GetCampaignScores to get them earlier. native int L4D_GetTeamScore(int logical_team, bool campaign_score=false); // Tells if the Mission (map) is the first map of the campaign native bool L4D_IsFirstMapInScenario(); // Tells if the Mission (map) is the final map of the campaign native bool L4D_IsMissionFinalMap(); // Notifies the CGameRulesProxy that the game state has been changed native void L4D_NotifyNetworkStateChanged(); // Trigger's a target player's stagger behavior native void L4D_StaggerPlayer(int target, int source_ent, float vecSource[3]); // Calls in the rescue vehicle native void L4D2_SendInRescueVehicle(); // L4D2 only. Changes the Finale stage native void L4D2_ChangeFinaleStage(int finaleType, const char[] arg); // Replaces a players tank control with another player native void L4D_ReplaceTank(int tank, int newtank); // Spawns a Tank native int L4D2_SpawnTank(const float vecPos[3], const float vecAng[3]); // Spawns a Special Infected native int L4D2_SpawnSpecial(int zombieClass, const float vecPos[3], const float vecAng[3]); // Spawns a Witch native int L4D2_SpawnWitch(const float vecPos[3], const float vecAng[3]); // Spawns a Witch Bridge native int L4D2_SpawnWitchBride(const float vecPos[3], const float vecAng[3]); // Current Tank count native int L4D2_GetTankCount(); // Current Witch count native int L4D2_GetWitchCount(); // L4D2 only. These are the actual values used for campaign scores--not proxies native void L4D2_GetVersusCampaignScores(int scores[2]); // L4D2 only. These are the actual values used for campaign scores--not proxies native void L4D2_SetVersusCampaignScores(const int scores[2]); // L4D2 only. These values are checked against as the survivors move through the map. Once they are passed, the tank spawns. native void L4D2_GetVersusTankFlowPercent(float tankFlows[2]); // L4D2 only. These values are checked against as the survivors move through the map. Once they are passed, the tank spawns. native void L4D2_SetVersusTankFlowPercent(const float tankFlows[2]); // L4D2 only. These values are checked against as the survivors move through the map. Once they are passed, the witch spawns. native void L4D2_GetVersusWitchFlowPercent(float witchFlows[2]); // L4D2 only. These values are checked against as the survivors move through the map. Once they are passed, the witch spawns. native void L4D2_SetVersusWitchFlowPercent(const float witchFlows[2]); // DEPRECATED - UNUSED // The campaign scores are updated after L4D_OnSetCampaignScores // native int L4D_GetCampaignScores(int &scoreA, int &scoreB); // native void L4D_LobbyUnreserve(); // native bool L4D_LobbyIsReserved(); // ==================== // TIMERS - All are L4D2 only. // ==================== // Resets a given CountdownTimer native void L4D2_CTimerReset(L4D2CountdownTimer timer); // Starts a given CountdownTimer with a given duration native void L4D2_CTimerStart(L4D2CountdownTimer timer, float duration); // Invalidates a given CountdownTimer native void L4D2_CTimerInvalidate(L4D2CountdownTimer timer); // Tells if a given CountdownTimer has started native bool L4D2_CTimerHasStarted(L4D2CountdownTimer timer); // Tells if a given CountdownTimer is elapsed native bool L4D2_CTimerIsElapsed(L4D2CountdownTimer timer); // Gets elapsed time of a given CountdownTimer, from the timed it was started native float L4D2_CTimerGetElapsedTime(L4D2CountdownTimer timer); // Gets remaining time on a given CountdownTimer native float L4D2_CTimerGetRemainingTime(L4D2CountdownTimer timer); // Gets the duration of a given CountdownTimer native float L4D2_CTimerGetCountdownDuration(L4D2CountdownTimer timer); // Starts a given IntervalTimer native void L4D2_ITimerStart(L4D2IntervalTimer timer); // Invalidates a given IntervalTimer native void L4D2_ITimerInvalidate(L4D2IntervalTimer timer); // Tells whether a given IntervalTimer has started native bool L4D2_ITimerHasStarted(L4D2IntervalTimer timer); // Gets the elapsed time of a given IntervalTimer native float L4D2_ITimerGetElapsedTime(L4D2IntervalTimer timer); // ==================== // WEAPONS - All are L4D2 only. // ==================== // Checks for a given weapon string to exist in the WeaponInformationDatabase native bool L4D2_IsValidWeapon(const char[] weaponName); // Read an int-typed attribute for a given weapon from the WeaponInformationDatabase native int L4D2_GetIntWeaponAttribute(const char[] weaponName, L4D2IntWeaponAttributes attr); // Read a float-typed attribute for a given weapon from the WeaponInformationDatabase native float L4D2_GetFloatWeaponAttribute(const char[] weaponName, L4D2FloatWeaponAttributes attr); // Set an int-typed attribute for a given weapon from the WeaponInformationDatabase to a given value native void L4D2_SetIntWeaponAttribute(const char[] weaponName, L4D2IntWeaponAttributes attr, int value); // Set a float-typed attribute for a given weapon from the WeaponInformationDatabase to a given value native void L4D2_SetFloatWeaponAttribute(const char[] weaponName, L4D2FloatWeaponAttributes attr, float value); // Retrieve the index for a given melee weapon from the Melee Weapon Database native int L4D2_GetMeleeWeaponIndex(const char[] weaponName); // Read an int-typed attribute for a given id from the Melee Weapon Database native int L4D2_GetIntMeleeAttribute(int id, L4D2IntMeleeWeaponAttributes attr); // Read a float-typed attribute for a given id from the Melee Weapon Database native float L4D2_GetFloatMeleeAttribute(int id, L4D2FloatMeleeWeaponAttributes attr); // Read a bool-typed attribute for a given id from the Melee Weapon Database native bool L4D2_GetBoolMeleeAttribute(int id, L4D2BoolMeleeWeaponAttributes attr); // Set an int-typed attribute for a given id from the Melee Weapon Database to a given value native void L4D2_SetIntMeleeAttribute(int id, L4D2IntMeleeWeaponAttributes attr, int value); // Set a float-typed attribute for a given id from the Melee Weapon Database to a given value native void L4D2_SetFloatMeleeAttribute(int id, L4D2FloatMeleeWeaponAttributes attr, float value); // Set a bool-typed attribute for a given id from the Melee Weapon Database to a given value native void L4D2_SetBoolMeleeAttribute(int id, L4D2BoolMeleeWeaponAttributes attr, bool value); // DEPRECATED - UNUSED // native float L4D_GetMobSpawnTimerRemaining(); // native float L4D_GetMobSpawnTimerDuration(); // ==================== // L4D_DIRECT (some are duplicates of the above, ported to keep consistency and allow minimal modification of existing plugins) // ==================== // L4D2 only. Get the current Tank count stored by the director. native int L4D2Direct_GetTankCount(); // L4D2 only. Get a reference to the CDirector natural mob spawn CountdownTimer native CountdownTimer L4D2Direct_GetMobSpawnTimer(); // L4D2 only. Get a reference to a IntervalTimer that counts up from the last death of a given SI class native IntervalTimer L4D2Direct_GetSIClassDeathTimer(int class); // L4D2 only. Get a reference to a CountdownTimer that counts down from the last attempted director-controlled spawn of an SI native CountdownTimer L4D2Direct_GetSIClassSpawnTimer(int class); // Gets the number of times the tank has passed to a player. native int L4D2Direct_GetTankPassedCount(); // Sets the number of times the tank has passed to a player. native void L4D2Direct_SetTankPassedCount(int passes); // Reads the director's stored campaign score for a given team. native int L4D2Direct_GetVSCampaignScore(int teamNumber); // Set the director's stored campaign score for a given team. native void L4D2Direct_SetVSCampaignScore(int teamNumber, int score); // Reads the tank flow percent for a given round for versus mode native float L4D2Direct_GetVSTankFlowPercent(int roundNumber); // Sets the tank flow percent for a given round for versus mode native int L4D2Direct_SetVSTankFlowPercent(int roundNumber, float flow); // Is there going to be a tank spawned during the given round native bool L4D2Direct_GetVSTankToSpawnThisRound(int roundNumber); // Tell the director whether or not to spawn a(nother) flow distance-based tank for this round. native void L4D2Direct_SetVSTankToSpawnThisRound(int roundNumber, bool spawn); // Reads the witch flow percent for a given round for versus mode native float L4D2Direct_GetVSWitchFlowPercent(int roundNumber); // Sets the witch flow percent for a given round for versus mode native int L4D2Direct_SetVSWitchFlowPercent(int roundNumber, float flow); // Is there going to be a witch spawned during the given round native bool L4D2Direct_GetVSWitchToSpawnThisRound(int roundNumber); // Tell the director whether or not to spawn a(nother) flow distance-based witch for this round. native int L4D2Direct_SetVSWitchToSpawnThisRound(int roundNumber, bool spawn); // L4D2 only. Get a reference to the VersusStart CountdownTimer native CountdownTimer L4D2Direct_GetVSStartTimer(); // L4D2 only. Get a reference to the Scavenge Round Setup CountdownTimer native CountdownTimer L4D2Direct_GetScavengeRoundSetupTimer(); // L4D2 only. Get a reference to the Scavenge Overtime Grace CountdownTimer native CountdownTimer L4D2Direct_GetScavengeOvertimeGraceTimer(); // Get the max flow distance (in flow units) for the current map. native float L4D2Direct_GetMapMaxFlowDistance(); // L4D2 only. Get a reference to a CountdownTimer that tracks when an SI player can next spawn. native CountdownTimer L4D2Direct_GetSpawnTimer(int client); // Get a reference to a CountdownTimer that tracks when an survivor player is invulnerable due to "godframes". native CountdownTimer L4D2Direct_GetInvulnerabilityTimer(int client); // Looks up the number of tickets a client has for entry into the tank lottery. native int L4D2Direct_GetTankTickets(int client); // Sets the number of tickets a player has for entry into the tank lottery. native void L4D2Direct_SetTankTickets(int client, int tickets); // L4D2 only. Gets a client's shove penalty. native int L4D2Direct_GetShovePenalty(int client); // L4D2 only. Sets a client's shove penalty. native void L4D2Direct_SetShovePenalty(int client, int penalty); // L4D2 only. Gets the time at which a survivor can perform his next +attack2. native float L4D2Direct_GetNextShoveTime(int client); // L4D2 only. Sets the time at which a survivor can perform his next +attack2. native void L4D2Direct_SetNextShoveTime(int client, float time); // L4D2 only. Gets the health of the survivor from before they were incapacitated native int L4D2Direct_GetPreIncapHealth(int client); // L4D2 only. Sets the health of the survivor from before they were incapacitated native void L4D2Direct_SetPreIncapHealth(int client, int health); // L4D2 only. Gets the temporary health of the survivor from before they were incapacitated native int L4D2Direct_GetPreIncapHealthBuffer(int client); // L4D2 only. Sets the health of the survivor from before they were incapacitated native void L4D2Direct_SetPreIncapHealthBuffer(int client, int health); // L4D2 only. Gets the maximum number of flames a CInferno is allowed to spawn. native int L4D2Direct_GetInfernoMaxFlames(int entity); // L4D2 only. Sets the maximum number of flames a CInferno is allowed to spawn. native void L4D2Direct_SetInfernoMaxFlames(int entity, int flames); // Get the TerrorNavArea which holds a specific position. native Address L4D2Direct_GetTerrorNavArea(float pos[3], float beneathLimit = 120.0); // Find the distance through the map (in flow units) that a TerrorNavArea is located. native float L4D2Direct_GetTerrorNavAreaFlow(Address pTerrorNavArea); // Force the director to pass the tank. native bool L4D2Direct_TryOfferingTankBot(int entity, int bEnterStasis); // Gets a player's distance in flow units. native float L4D2Direct_GetFlowDistance(int client); // Plays the specified animation for a player native void L4D2Direct_DoAnimationEvent(int client, int event); Changes: Code: 1.0 (24-Feb-2020) - Initial release. Requirements: DHooks (Experimental Dynamic Detour support) extension. Requires SourceMod 1.10 due to various methodmaps. Done this to force servers to update. Can work on SM 1.9 but requires reverting methodmaps code and variable types. Instead you should just upgrade SM to benfit from fixes, improvements, and new features. Conflicts with Left4Downtown, remove the extension to run. Installation: Download the .zip and extract the files to their respective folders in your servers \addons\sourcemod\ folder. Attached Files left4dhooks.zip (125.3 KB) Wyświetl pełny artykuł Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi