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
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-20-2020 , 13:01   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #151

Code:
1.18 (20-Aug-2020)
    - Thanks to "Forgetest" for reporting the following issues and testing multiple fixes.
    - Fixed natives using "L4D2CT_VersusStartTimer" from reading the incorrect address.
    - Fixed native "L4D2_IsValidWeapon" returning false when the classname is missing "weapon_".
    - Fixed address "g_pGameRules" being incorrect after certain map or mode changes, this broke the following natives:
        "L4D2_GetVersusCompletionPlayer", "L4D_GetVersusMaxCompletionScore" and "L4D_SetVersusMaxCompletionScore".

    - Note: native "L4D2_IsValidWeapon" and various "*WeaponAttribute" natives still returns invalid for CSS weapons.
        This only happens on the servers first load until map is changed and the CSS weapons are precached using whichever method
        your server uses to enable CSS weapons. Plugins using or modifying CSS weapons might need to be updated with this in mind.
Edit: CSS weapons do work after map change (required to precache them anyway with the currently public methods that enable CSS weapons). Until they are precached the plugin will return them as invalid.
__________________

Last edited by Silvers; 08-20-2020 at 20:13.
Silvers is offline
Forgetest
Member
Join Date: Aug 2020
Old 08-22-2020 , 16:35   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #152

1. The following forward seems to trigger earlier than the one from Downtown version does, and probably a few plugins are affected if they tend to set client's certain property inside it.

Code:
/**
 * @brief Called whenever CTerrorPlayer::OnEnterGhostState(CTerrorPlayer*) is invoked
 * @remarks This happens when a player enters ghost mode (or in finales auto-materialized)
 *
 * @param client		the client that has entered ghost mode
 */
forward void L4D_OnEnterGhostState(int client);
Code:
// despawn_health.smx

public L4D_OnEnterGhostState(client)
{
	RequestFrame(RestoreHealth, client);
}

public void RestoreHealth(int client)
{
    if (!IsClientInGame(client) || !IsPlayerAlive(client)) return;
	
    new CurrentHealth = GetClientHealth(client);
    new MaxHealth = GetEntProp(client, Prop_Send, "m_iMaxHealth");
    if (CurrentHealth != MaxHealth)
    {
        new MissingHealth = MaxHealth - CurrentHealth;
        new NewHP = RoundFloat(MissingHealth * GetConVarFloat(si_restore_ratio)) + CurrentHealth;
        SetEntityHealth(client, NewHP);
    }
}

2. The first two parameters are back to front ("client" should've been "victim", the same to victim)

Code:
/**
 * @brief Called whenever CTerrorPlayer::OnShovedBySurvivor(CTerrorPlayer, Vector&) is invoked
 * @remarks L4D2 only uses this on Special Infected
 * @remarks Blocks hunter dead stop
 *
 * @param client	the client that did the shoving
 * @param victim	the client that was shoved (CAUTION retrieved from function pointer, don't meddle with it)
 * @param vecDir	Vector Angle of Shoveforce
 *
 * @return			Plugin_Handled to block melee effect (staggering), Plugin_Continue otherwise.
 */
forward Action L4D_OnShovedBySurvivor(int client, int victim, const float vecDir[3]);


Code:
public Action:L4D_OnShovedBySurvivor(shover, shovee, const Float:vector[3])
{
    PrintToChatAll("L4D_OnShovedBySurvivor [shover: %N, shovee: %N]", shover, shovee);
}

public Action:L4D2_OnEntityShoved(shover, shovee, weapon, Float:vector[3], bool:bIsHunterDeadstop)
{
    PrintToChat(shover, "L4D2_OnEntityShoved [shover: %N, shovee: %N]", shover, shovee);
}

Last edited by Forgetest; 08-22-2020 at 17:40. Reason: addition
Forgetest is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 08-22-2020 , 19:32   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #153

Quote:
Originally Posted by Silvers View Post
Edit: CSS weapons do work after map change (required to precache them anyway with the currently public methods that enable CSS weapons). Until they are precached the plugin will return them as invalid.
People can always use this don't have this effect.
https://github.com/LuxLuma/Left-4-fi...l4d2_csweapons
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
crasx
Member
Join Date: May 2011
Location: Lakewood, CO
Old 08-23-2020 , 22:13   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #154

It looks like the signature for ClearTeamScores changed or something in L4D2. The first argument is actually a pointer to g_pGameRules and the second argument is the flag for newCampaign.
Interestingly the function symbol does not match how the function is called.

Edit: After testing this more it looks like this is actually not the case. My ASM is pretty weak so I could probably use a sanity check on this. The behavior I saw was that the newCampaign flag was sometimes true when it shouldn't be. Maybe it has to do with how the the variable is processed by dhooks?

Anyone else seeing this?

Last edited by crasx; 08-24-2020 at 09:59. Reason: comment incorrect
crasx is offline
Lux
Veteran Member
Join Date: Jan 2015
Location: Cat
Old 08-25-2020 , 19:48   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #155

Quote:
Originally Posted by crasx View Post
It looks like the signature for ClearTeamScores changed or something in L4D2. The first argument is actually a pointer to g_pGameRules and the second argument is the flag for newCampaign.
Interestingly the function symbol does not match how the function is called.

Edit: After testing this more it looks like this is actually not the case. My ASM is pretty weak so I could probably use a sanity check on this. The behavior I saw was that the newCampaign flag was sometimes true when it shouldn't be. Maybe it has to do with how the the variable is processed by dhooks?

Anyone else seeing this?
I tested it quick I can't seem to see anything strange however I do use this https://forums.alliedmods.net/showthread.php?p=2669850 signitures look correct for l4d2.

CTerrorGameRules::ClearTeamScores Is called from many different places.
For windows CTerrorGameRules::ClearTeamScores is called directly while with linux CDirector::ClearTeamScores is pretty much only thing calling it.

You can xref what functions call it since it's directly called.

Linux xref this "CDirector::ClearTeamScores"
Windows xref this "CTerrorGameRules::ClearTeamScores"

Helpful note
CDirector::OnChangeMissionVote is the only function that calls CDirector::ClearTeamScores in windows incase you get lost trying to match windows and linux.
__________________
Connect
My Plugins: KlickME
[My GitHub]

Commission me for L4D
Lux is offline
crasx
Member
Join Date: May 2011
Location: Lakewood, CO
Old 08-26-2020 , 00:37   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #156

Thanks for the info, The issue I'm having is linux based and have not tested this on windows. After digging through the functions I am wondering if the signature should actually be
Code:
_ZN19CDirectorVersusMode25ClearTeamScoresNonVirtualEb
crasx is offline
Pelee
Member
Join Date: May 2020
Old 08-26-2020 , 11:32   Re: [L4D & L4D2] Left 4 DHooks Direct (1.16) [05-Jun-2020]
Reply With Quote #157

Quote:
Originally Posted by Silvers View Post
Finally supporting [L4D(2)] Remove Lobby Reservation (When Full). Download latest version below.

You can thank "SilentBr" for pushing me to do it.

Code:
1.16 (05-Jun-2020)
    - Added native "L4D_LobbyUnreserve" finally, to support "Remove Lobby Reservation (When Full)" plugin.
    - Huge thanks to "GAMMACASE" and "Deathreus" for helping figure why the native was crashing.

    - Updated: L4D1 GameData file.
    - Updated: Plugin and Include file.

Attached is version 1.2 of "Remove Lobby Reservation" compiled against left4dhooks and updated syntax.
Code:
1.2 (05-Jun-2020)
    - Converted to the latest syntax.
    - Compiled using left4dhooks include file.
This plugin does not seem to automatically unreserve lobby when there are 8 players. We have to manually !unreserve. Tested with SM 1.10.0.6492 Meta 1.11.0-dev+1128
Pelee is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 08-26-2020 , 18:55   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #158

Quote:
Originally Posted by Forgetest View Post
1. The following forward seems to trigger earlier than the one from Downtown version does, and probably a few plugins are affected if they tend to set client's certain property inside it.

Code:
/**
 * @brief Called whenever CTerrorPlayer::OnEnterGhostState(CTerrorPlayer*) is invoked
 * @remarks This happens when a player enters ghost mode (or in finales auto-materialized)
 *
 * @param client		the client that has entered ghost mode
 */
forward void L4D_OnEnterGhostState(int client);
Code:
// despawn_health.smx

public L4D_OnEnterGhostState(client)
{
	RequestFrame(RestoreHealth, client);
}

public void RestoreHealth(int client)
{
    if (!IsClientInGame(client) || !IsPlayerAlive(client)) return;
	
    new CurrentHealth = GetClientHealth(client);
    new MaxHealth = GetEntProp(client, Prop_Send, "m_iMaxHealth");
    if (CurrentHealth != MaxHealth)
    {
        new MissingHealth = MaxHealth - CurrentHealth;
        new NewHP = RoundFloat(MissingHealth * GetConVarFloat(si_restore_ratio)) + CurrentHealth;
        SetEntityHealth(client, NewHP);
    }
}

2. The first two parameters are back to front ("client" should've been "victim", the same to victim)

Code:
/**
 * @brief Called whenever CTerrorPlayer::OnShovedBySurvivor(CTerrorPlayer, Vector&) is invoked
 * @remarks L4D2 only uses this on Special Infected
 * @remarks Blocks hunter dead stop
 *
 * @param client	the client that did the shoving
 * @param victim	the client that was shoved (CAUTION retrieved from function pointer, don't meddle with it)
 * @param vecDir	Vector Angle of Shoveforce
 *
 * @return			Plugin_Handled to block melee effect (staggering), Plugin_Continue otherwise.
 */
forward Action L4D_OnShovedBySurvivor(int client, int victim, const float vecDir[3]);


Code:
public Action:L4D_OnShovedBySurvivor(shover, shovee, const Float:vector[3])
{
    PrintToChatAll("L4D_OnShovedBySurvivor [shover: %N, shovee: %N]", shover, shovee);
}

public Action:L4D2_OnEntityShoved(shover, shovee, weapon, Float:vector[3], bool:bIsHunterDeadstop)
{
    PrintToChat(shover, "L4D2_OnEntityShoved [shover: %N, shovee: %N]", shover, shovee);
}
Will look into this at some point when I have time. From what I remember when I tested they were working as expected.




Quote:
Originally Posted by crasx View Post
It looks like the signature for ClearTeamScores changed or something in L4D2. The first argument is actually a pointer to g_pGameRules and the second argument is the flag for newCampaign.
Interestingly the function symbol does not match how the function is called.

Edit: After testing this more it looks like this is actually not the case. My ASM is pretty weak so I could probably use a sanity check on this. The behavior I saw was that the newCampaign flag was sometimes true when it shouldn't be. Maybe it has to do with how the the variable is processed by dhooks?

Anyone else seeing this?
The first arg for me returns "1" which is the bool expected, I don't know how you're getting the g_pGameRules pointer when that's the "this" pointer and being ignored. I don't know the specific conditions to test, if you can list the steps on how to replicate the problem I'll try. The windows and linux signature have not changed and is identical to what left4downtown used.




Quote:
Originally Posted by Pelee View Post
This plugin does not seem to automatically unreserve lobby when there are 8 players. We have to manually !unreserve. Tested with SM 1.10.0.6492 Meta 1.11.0-dev+1128
The unreserve plugin I provided is simply an updated syntax version of the previous existing plugin and afaik nothing else has changed (I haven't looked at the two or compared them since I released). I don't see why this would be any different.
__________________

Last edited by Silvers; 08-26-2020 at 18:57.
Silvers is offline
Pelee
Member
Join Date: May 2020
Old 08-26-2020 , 20:40   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #159

The original one had same issue. It doesn't auto unreserve at 8 players (full)
Pelee is offline
Dragokas
Veteran Member
Join Date: Nov 2017
Location: Ukraine on fire
Old 08-27-2020 , 08:34   Re: [L4D & L4D2] Left 4 DHooks Direct (1.18) [20-Aug-2020]
Reply With Quote #160

Pelee, Why it should auto un-reserve?
It is just a set of functions/forwards, not doing anything themselves without separate plugin that is using them.
__________________
Expert of CMD/VBS/VB6. Malware analyst. L4D fun (Bloody Witch & FreeZone)
[My plugins] [My tools] [GitHub] [Articles] [HiJackThis+] [Donate]
Dragokas 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 01:32.


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