Raised This Month: $12 Target: $400
 3% 

[L4D & L4D2] Left 4 DHooks Direct (1.150) [06-May-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
NoroHime
Veteran Member
Join Date: Aug 2016
Location: bed
Old 03-18-2022 , 03:42   Re: [L4D & L4D2] Left 4 DHooks Direct (1.89) [02-Mar-2022]
Reply With Quote #651

looks L4D2_FullRestart() work like mp_restartgame rather than Game Restart Vote
that mean if server map start as "map c1m2" etc, he wont change to first level
but usually not problem normal play
__________________
NoroHime is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-20-2022 , 05:14   Re: [L4D & L4D2] Left 4 DHooks Direct (1.90) [20-Mar-2022]
Reply With Quote #652

Code:
1.90 (20-Mar-2022)
    - Added forwards "L4D_OnKnockedDown" and "L4D_OnKnockedDown_Post" to trigger when a Survivor is being thrown by a Tank rock or Hunter lung.
    - Added forwards "L4D2_OnThrowImpactedSurvivor" and "L4D2_OnThrowImpactedSurvivor_Post" to trigger when a Survivor is impacted by a Charger.
    - Added forwards "L4D2_OnPummelVictim" and "L4D2_OnPummelVictim_Post" to trigger when a Survivor is about to be pummelled by a Charger.
    - Added native "L4D_EstimateFallingDamage" to check a players estimated falling damage. Requested by "Eyal282".
    - Added stocks "L4D_GetPinnedSurvivor" and "L4D2_IsMultiCharged" in the "left4dhooks_silver.inc" include file. Requested by "Eyal282".
    - Changed stock "L4D_IsPlayerStaggering" in the "left4dhooks_silver.inc" include file to add better thanks. Thanks to "HarryPotter" for modifying.
    - Changed forward "L4D_OnMaterializeFromGhost" from "Action" type to "void". Thanks to "Eyal282" for reporting.

    - Updated: Plugin and test plugin.
    - Updated: "left4dhooks.inc" and "left4dhooks_silver.inc" Include files.
    - Updated: "left4dhooks.l4d1.txt" and "left4dhooks.l4d2.txt" GameData files.

Quote:
Originally Posted by sorallll View Post
Yes, Linux
Has been changed to 864. Can someone please confirm L4D_GetCurrentChapter is working on linux L4D2. - looks like it works for me
__________________

Last edited by Silvers; 03-24-2022 at 13:41.
Silvers is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-24-2022 , 13:41   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #653

Code:
1.91 (24-Mar-2022)
    - Added post hook forwards:
        "L4D2_CGasCan_ShouldStartAction_Post", "L4D2_CGasCan_ActionComplete_Post", "L4D2_CInsectSwarm_CanHarm_Post",
        "L4D_OnMobRushStart_Post", "L4D_OnSpawnITMob_Post", "L4D_OnSpawnMob_Post", "L4D2_OnStagger_Post", "L4D2_OnPounceOrLeapStumble_Post",
        "L4D_OnSetCampaignScores_Post", "L4D_OnRecalculateVersusScore_Post", "L4D_OnHasConfigurableDifficulty_Post",
        "L4D_OnVomitedUpon_Post", "L4D2_OnHitByVomitJar_Post", "L4D2_OnJockeyRide_Post" and "L4D2_OnStartCarryingVictim_Post".

    - Changed forward "L4D2_CGasCan_ShouldStartAction" params to include the nozzle entity.

    - Added some missing "MarkNativeAsOptional" lines to the include file.
    - Cleaned and tidied up some code.

    - Fixed forward "L4D_OnSpawnSpecial" firing when the client index is -1. Thanks to "Marttt" for reporting.
    - Fixed forward "L4D2_CGasCan_ShouldStartAction" crashing. Thanks to "Eyal282" for reporting.
    - Fixed native "L4D_GetCurrentChapter" sometimes reporting the wrong chapter number.

    - Updated: Plugin and test plugin.
    - Updated: "left4dhooks.inc" and "left4dhooks_silver.inc" Include files.
    - Updated: "left4dhooks.l4d2.txt" GameData file.
__________________
Silvers is offline
Red Flame
Junior Member
Join Date: Jan 2012
Old 03-24-2022 , 14:48   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #654

Hello, there is a problem with L4D_OnSpawnSpecial forward.
It seems like L4D_OnSpawnSpecial forward can fire even if game prevented special infected spawn because of SI limits (dead SI counts too). Is it possible to make this forward not to fire when SI limits exceeded?
I tried to resolve the problem of missing special infected without modifying SI limits using HookEvent("player_death") and kicking killed SI on next frame, but I think it's wrong solution according to fact that some plugins use Timers when someone is killed.

Last edited by Red Flame; 03-24-2022 at 15:01. Reason: provided additional info
Red Flame is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-24-2022 , 17:52   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #655

Quote:
Originally Posted by Red Flame View Post
Hello, there is a problem with L4D_OnSpawnSpecial forward.
It seems like L4D_OnSpawnSpecial forward can fire even if game prevented special infected spawn because of SI limits (dead SI counts too). Is it possible to make this forward not to fire when SI limits exceeded?
I tried to resolve the problem of missing special infected without modifying SI limits using HookEvent("player_death") and kicking killed SI on next frame, but I think it's wrong solution according to fact that some plugins use Timers when someone is killed.
Unless your intent is to modify the zombieClass spawing, use the "L4D_OnSpawnSpecial_Post" forward instead and check the client index, as the include file describes "The client index who spawned. Can be 0 if spawning failed" - so I guess it would be 0 in those cases? Please report back if that's true. Thanks.
__________________
Silvers is offline
Red Flame
Junior Member
Join Date: Jan 2012
Old 03-24-2022 , 23:45   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #656

Quote:
Originally Posted by Silvers View Post
Unless your intent is to modify the zombieClass spawing, use the "L4D_OnSpawnSpecial_Post" forward instead and check the client index, as the include file describes "The client index who spawned. Can be 0 if spawning failed" - so I guess it would be 0 in those cases? Please report back if that's true. Thanks.
Hello, thank you for your advice but I use L4D_OnSpawnSpecial forward to modify or prevent zombieClass spawning.
Here are some notes from testing L4D_OnSpawnSpecial_Post forward. I used "L4D_SetClass()" and "SetClientName()" to change SI class and its name. As you said client index is equal to 0 but only when we block SI spawn in L4D_OnSpawnSpecial forward. Unfortunetely, I can't tell what client index is equal when game blocks SI spawn by itself because I'm not at home right now but it's > 0 for sure.

Last edited by Red Flame; 03-24-2022 at 23:48. Reason: Rephrasing...
Red Flame is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-25-2022 , 07:06   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #657

Quote:
Originally Posted by Red Flame View Post
Hello, thank you for your advice but I use L4D_OnSpawnSpecial forward to modify or prevent zombieClass spawning.
Here are some notes from testing L4D_OnSpawnSpecial_Post forward. I used "L4D_SetClass()" and "SetClientName()" to change SI class and its name. As you said client index is equal to 0 but only when we block SI spawn in L4D_OnSpawnSpecial forward. Unfortunetely, I can't tell what client index is equal when game blocks SI spawn by itself because I'm not at home right now but it's > 0 for sure.
Instead of using "L4D_OnSpawnSpecial" to change class, try using "L4D_OnSpawnSpecial_Post" to change the class with "L4D_SetClass" as you were saying, if a client index is valid. If you want to block then use the pre-hook forward. You can post the code or PM me the code and I'll look at it when I get a chance.

With that being said, you should be able to change or block the zombie in "L4D_OnSpawnSpecial" and use the "L4D_OnSpawnSpecial_Post" to get the valid bot index spawning. If at that point the game still spawns but kicks or blocks the SI from spawning due to limits then you would have to add your own test into the function to check limits. This is not something I would like to add into the forward itself because that would be restricting other plugins who may want to detect the limit being reached and temporarily change it to allow the bots to spawn. If you write this limit check code, please share it for others to see.
__________________

Last edited by Silvers; 03-25-2022 at 07:12.
Silvers is offline
Red Flame
Junior Member
Join Date: Jan 2012
Old 03-25-2022 , 11:09   Re: [L4D & L4D2] Left 4 DHooks Direct (1.91) [24-Mar-2022]
Reply With Quote #658

Quote:
Originally Posted by Silvers View Post
Instead of using "L4D_OnSpawnSpecial" to change class, try using "L4D_OnSpawnSpecial_Post" to change the class with "L4D_SetClass" as you were saying, if a client index is valid. If you want to block then use the pre-hook forward. You can post the code or PM me the code and I'll look at it when I get a chance.

With that being said, you should be able to change or block the zombie in "L4D_OnSpawnSpecial" and use the "L4D_OnSpawnSpecial_Post" to get the valid bot index spawning. If at that point the game still spawns but kicks or blocks the SI from spawning due to limits then you would have to add your own test into the function to check limits. This is not something I would like to add into the forward itself because that would be restricting other plugins who may want to detect the limit being reached and temporarily change it to allow the bots to spawn. If you write this limit check code, please share it for others to see.
L4D_OnSpawnSpecial_Post forward has the same issue, bot index is valid when AI director blocks SI spawn.
The main problem is How to get proper SIs limit value to compare with current spawned/dead SIs (that is the first thing I thought about). Using L4D_OnGetScriptValueInt forward with "MaxSpecials" or "cm_MaxSpecials" keys doesn't provide the value I need.

Last edited by Red Flame; 03-25-2022 at 11:22.
Red Flame is offline
Forgetest
Member
Join Date: Aug 2020
Old 03-26-2022 , 11:58   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #659

Hello, got some reports here.
  • Seems like some return values as CBaseEntity are not changed to "-1" if plugins decide to block the function. For example, L4D_OnSpawnTank_Post is forwarded with client 0 when L4D_OnSpawnTank gets Plugin_Handled ([SM] Exception reported: Client index 0 is invalid).
  • ^, but it's L4D_OnEnterGhostState. I have no idea why when L4D_OnEnterGhostStatePre is Plugin_Handled the post hook is still invoked. Maybe it's a move by DHooks.

And a weird one where I cannot get L4D2_OnPlayerFling detoured by your plugin last time testing a plugin. No further confirming it's an actual issue, maybe SM1.11 is to blame.
Forgetest is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-26-2022 , 12:28   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #660

Quote:
Originally Posted by Forgetest View Post
Hello, got some reports here.
  • Seems like some return values as CBaseEntity are not changed to "-1" if plugins decide to block the function. For example, L4D_OnSpawnTank_Post is forwarded with client 0 when L4D_OnSpawnTank gets Plugin_Handled ([SM] Exception reported: Client index 0 is invalid).
  • ^, but it's L4D_OnEnterGhostState. I have no idea why when L4D_OnEnterGhostStatePre is Plugin_Handled the post hook is still invoked. Maybe it's a move by DHooks.

And a weird one where I cannot get L4D2_OnPlayerFling detoured by your plugin last time testing a plugin. No further confirming it's an actual issue, maybe SM1.11 is to blame.
Ahh I see "L4D2_OnPlayerFling" line was missing to detect it. Thanks.

Post hooks will always fire as that's the end of the function being detoured. Will set some indexes to 0 or -1 where applicable, hopefully those can be checked in post to validate it's not being blocked. Was possibly thinking of setting a flag if a pre hook is blocked so the post would never fire. Thoughts?
__________________
Silvers is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 09:41.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode