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

[L4D & L4D2] Left 4 DHooks Direct (1.146) [21-Apr-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Forgetest
Member
Join Date: Aug 2020
Old 03-26-2022 , 13:57   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #661

Mostly it is intuitive that post-hooks don't get fired if functions are completely skipped, though guess there's still a need for it. Perhaps it's better to reach for the DHooks authors, as I do remember the invalid index error had never happened until some updates.
Yet this one isn't quite breaking for scripting, except some really redundant-like checks need to be in post-hooks (checking "m_isGhost" in OnEnterGhostState )
Forgetest is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-27-2022 , 03:56   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #662

Quote:
Originally Posted by Silvers View Post
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?
The only reason any developer want a post is for successful flings. It would be a lie to fire L4D2_OnPlayerFlingPost if the player wasn't flung after the checker. This should mimic Sourcemod's SDKHooks because otherwise it creates confusion for no reason.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 03-27-2022 at 03:56.
eyal282 is offline
LordVGames
Junior Member
Join Date: Mar 2021
Old 03-28-2022 , 02:38   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #663

Getting an error on the latest left4dhooks when trying to use L4D_IsAnySurvivorInStartArea(). A similar error also happens when using L4D_HasAnySurvivorLeftSafeArea().

Code:
L 03/28/2022 - 02:24:27: [SM] Exception reported: g_pDirector not available ().
L 03/28/2022 - 02:24:27: [SM] Blaming: left4dhooks.smx
L 03/28/2022 - 02:24:27: [SM] Call stack trace:
L 03/28/2022 - 02:24:27: [SM]   [0] ThrowNativeError
L 03/28/2022 - 02:24:27: [SM]   [1] Line 5394, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::ValidateAddress
L 03/28/2022 - 02:24:27: [SM]   [2] Line 6131, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::Native_CDirector_IsAnySurvivorInStartArea
L 03/28/2022 - 02:24:27: [SM]   [4] L4D_IsAnySurvivorInStartArea
L 03/28/2022 - 02:24:27: [SM]   [5] Line 172, f:\Stuff\EVERYTHING ELSE\Left 4 Dead 2 Dedicated Servers\left4dead2\addons\sourcemod\scripting\all4dead2.sp::OnPluginStart
LordVGames is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-28-2022 , 03:16   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #664

Quote:
Originally Posted by LordVGames View Post
Getting an error on the latest left4dhooks when trying to use L4D_IsAnySurvivorInStartArea(). A similar error also happens when using L4D_HasAnySurvivorLeftSafeArea().

Code:
L 03/28/2022 - 02:24:27: [SM] Exception reported: g_pDirector not available ().
L 03/28/2022 - 02:24:27: [SM] Blaming: left4dhooks.smx
L 03/28/2022 - 02:24:27: [SM] Call stack trace:
L 03/28/2022 - 02:24:27: [SM]   [0] ThrowNativeError
L 03/28/2022 - 02:24:27: [SM]   [1] Line 5394, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::ValidateAddress
L 03/28/2022 - 02:24:27: [SM]   [2] Line 6131, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::Native_CDirector_IsAnySurvivorInStartArea
L 03/28/2022 - 02:24:27: [SM]   [4] L4D_IsAnySurvivorInStartArea
L 03/28/2022 - 02:24:27: [SM]   [5] Line 172, f:\Stuff\EVERYTHING ELSE\Left 4 Dead 2 Dedicated Servers\left4dead2\addons\sourcemod\scripting\all4dead2.sp::OnPluginStart
Try the latest version, seems you're using an old one. Although this hasn't changed afaik, maybe issue with the map or something.
__________________
Silvers is offline
LordVGames
Junior Member
Join Date: Mar 2021
Old 03-28-2022 , 15:08   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #665

Quote:
Originally Posted by Silvers View Post
Try the latest version, seems you're using an old one. Although this hasn't changed afaik, maybe issue with the map or something.
I found out through a bit of testing that the error only happens when either of those functions are called before anyone joins the server. Once I joined the server and reloaded the plugin that tried the function it worked fine.
LordVGames is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-28-2022 , 21:57   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #666

Quote:
Originally Posted by LordVGames View Post
I found out through a bit of testing that the error only happens when either of those functions are called before anyone joins the server. Once I joined the server and reloaded the plugin that tried the function it worked fine.
It seems this had been called before left4dhooks had even initialized from OnPluginStart, which is very strange. The string "not available ()." between the () should contain details on game/OS/plugin version, but this is empty. The field is populated in "LoadGameData" which is called from "OnPluginStart". No idea how that could have happened, maybe some rare bug, or left4dhooks was taking a while to load and still able to call the related native since those are created before "OnPluginStart". I would leave the plugin(s) as is and check if the error occurs again, please report if it does. Then maybe the plugin using these natives should add a slight delay, maybe only calling the function after "OnAllPluginsLoaded".
__________________
Silvers is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-28-2022 , 23:00   Re: [L4D & L4D2] Left 4 DHooks Direct (1.94) [29-Mar-2022]
Reply With Quote #667

Code:
1.94 (29-Mar-2022)
	- Added natives "L4D_GetReserveAmmo" and "L4D_SetReserveAmmo" to get and set a players weapons reserve ammo.

	- Changed forward "L4D2_CGasCan_ShouldStartAction" swapping the nozzle and gascan params - to keep consistency with "L4D2_CGasCan_ActionComplete". Thanks to "Eyal282" for reporting.

	- Fixed forward "L4D2_OnPlayerFling" not firing. Thanks to "Forgetest" for reporting.

	- The follow forwards will no longer fire their post hook counterparts when blocked in the pre-hook (this allows using the post hooks to guarantee the forwards detoured function is invoked):
		"L4D2_OnHitByVomitJar", "L4D_OnVomitedUpon", "L4D2_CInsectSwarm_CanHarm", "L4D2_OnStartCarryingVictim", "L4D2_OnStartCarryingVictim", "L4D2_OnJockeyRide", "L4D_OnGrabWithTongue",
		"L4D2_CGasCan_ActionComplete", "L4D2_CGasCan_ShouldStartAction", "L4D_PipeBombProjectile_Pre", "L4D_OnMaterializeFromGhostPre", "L4D2_OnPlayerFling", "L4D2_OnThrowImpactedSurvivor",
		"L4D2_OnPummelVictim", "L4D_OnKnockedDown", "L4D2_OnPounceOrLeapStumble", "L4D2_OnEndVersusModeRound", "L4D_OnTryOfferingTankBot", "L4D_TankClaw_OnPlayerHit_Pre", "L4D_OnGetMissionVSBossSpawning",
		"L4D_OnEnterGhostState", "L4D_OnSpawnMob", "L4D_OnSpawnITMob", "L4D_OnMobRushStart", "L4D_OnFirstSurvivorLeftSafeArea", "L4D_OnSpawnWitch", "L4D2_OnSpawnWitchBride", "L4D_OnSpawnTank" and "L4D_OnSpawnSpecial".
__________________
Silvers is offline
LordVGames
Junior Member
Join Date: Mar 2021
Old 03-28-2022 , 23:49   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #668

Quote:
Originally Posted by Silvers View Post
It seems this had been called before left4dhooks had even initialized from OnPluginStart, which is very strange. The string "not available ()." between the () should contain details on game/OS/plugin version, but this is empty. The field is populated in "LoadGameData" which is called from "OnPluginStart". No idea how that could have happened, maybe some rare bug, or left4dhooks was taking a while to load and still able to call the related native since those are created before "OnPluginStart". I would leave the plugin(s) as is and check if the error occurs again, please report if it does. Then maybe the plugin using these natives should add a slight delay, maybe only calling the function after "OnAllPluginsLoaded".
It worked fine when calling the function in OnAllPluginsLoaded. I guess it error-ed out previously since the plugin file I was working on started with an 'a', so it loaded before left4dhooks and broke when trying to use a function from it.
LordVGames is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 03-29-2022 , 00:02   Re: [L4D & L4D2] Left 4 DHooks Direct (1.93) [25-Mar-2022]
Reply With Quote #669

Quote:
Originally Posted by LordVGames View Post
It worked fine when calling the function in OnAllPluginsLoaded. I guess it error-ed out previously since the plugin file I was working on started with an 'a', so it loaded before left4dhooks and broke when trying to use a function from it.
The filename does not determine the load order, it could be any random order which cannot be defined, so for early things relying on other plugins you must use something like OnAllPluginsLoaded.
__________________
Silvers is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 04-09-2022 , 03:57   Re: [L4D & L4D2] Left 4 DHooks Direct (1.94) [29-Mar-2022]
Reply With Quote #670

can you add OnWitchSetHarasser forward? idk why witch_harasser_set event not fire sometimes.
ProjectSky 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 03:38.


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