Raised This Month: $32 Target: $400
 8% 

[L4D & L4D2] Left 4 DHooks Direct (1.145) [03-Apr-2024]


Post New Thread Reply   
 
Thread Tools Display Modes
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 05-29-2023 , 11:11   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #911

Thank you Silvers for this fantastic plugin!

I am using L4D_Molotov_Detonate and when I return Plugin_Handled, the molotov does not detonate, which is expected behavior. However, the molotov still exists but cannot be picked up. I am guessing the system changes some entity property when thrown because I do not have this issue with L4D2_CGasCan_EventKilled. Is this something you want to address in your plugin? If not, could you guide me on what I need to change for the molotov so it can be picked up again?
Mystik Spiral is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-29-2023 , 11:48   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #912

Quote:
Originally Posted by Mystik Spiral View Post
Thank you Silvers for this fantastic plugin!

I am using L4D_Molotov_Detonate and when I return Plugin_Handled, the molotov does not detonate, which is expected behavior. However, the molotov still exists but cannot be picked up. I am guessing the system changes some entity property when thrown because I do not have this issue with L4D2_CGasCan_EventKilled. Is this something you want to address in your plugin? If not, could you guide me on what I need to change for the molotov so it can be picked up again?
The behavior is expected and won't be changed. Retrieve the molotov position/angle, delete the projectile entity and create a molotov in its place.
__________________
Silvers is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 05-29-2023 , 20:25   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #913

Code:
"CCSPlayer::ChangeTeam"
{
	"signature"  "CCSPlayer::ChangeTeam"
	"callconv"  "thiscall"
	"return"  "void"
	"this"  "entity"
	"arguments"
	{
		"team"
		{
			"type"	"int"
		}
	}

}
This function maybe useful.
It fire when player change team and faster than player_team event(even than pre-hook).
By using pre-hook in detour, it can change the new team actually. If someone want to change to team survivor from spector, we can block it or change it to another team.

Since it is faster than player_team, the plugin use this event can still get the correct number if change team is block or override.

This is what i do in my server:
PHP Code:
public MRESReturn OnClientChangeTeam(int pThisDHookParam hParams)
{
    
// ptr = client, int bot.
    
int client pThis;
    
int new_team hParams.Get(1);

    
int result;
    
/* Start function call */
    
Call_StartForward(g_hGF_ClientChangeTeam);
    
Call_PushCell(client);
    
Call_PushCell(new_team);
    
/* Finish the call */
    
Call_Finish(result);

    if( 
result <= || result >= 4)
        return 
MRES_Ignored;
    
    else
    {
        
hParams.Set(1,result);
        return 
MRES_ChangedOverride;
    }
    

When to use
PHP Code:
public int M_OnClientChangeTeam(int clientint new_team)
{
    if( 
GetClientTeam(client) == TEAM_SPEACTOR && new_team == TEAM_SURVIVOR )
    {
        
PrintToServer("[miuwiki_multislot]: Hook %N change team. old team = %d, new team = %d",client,GetClientTeam(client),new_team);
        if( 
player[client].is_autojoin )
            return 
TEAM_SPEACTOR;

        return 
0;
    }


Last edited by LinLinLin; 05-29-2023 at 20:33.
LinLinLin is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-30-2023 , 05:11   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #914

Pre/Post hooks on Events are before/after the event is fired, not before/after the function is called. There are use cases for these types of hooks but this is not it.

I think detouring is extreme, you can get the same result using "AddCommandListener" on "jointeam" command and "return Plugin_Handled" to block team change. You could probably call "jointeam" from inside to change the team, just set a global bool to prevent an infinite loop occurring.

I won't be adding this detour to left4dhooks as it's not necessary.
__________________

Last edited by Silvers; 05-30-2023 at 05:15.
Silvers is offline
LinLinLin
Senior Member
Join Date: Sep 2021
Old 05-30-2023 , 06:52   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #915

As far as i know, AddCommandListener(jointeam) only fired when player types jointeam in his console. This doesn't fire when player team is changed by server or other situation.
And it actually doesn't change the player team.

I make this detour for the reason that it just like the player_team event, and the different between detour and event is detour can change the new team and event is not. ChangeClientTeam() in player_team event doesn't work correctly. Using RequestFrame will make it work but player will change to another team first and then change to the team we want. I think it is not good and this is why i make this detour.

Click image for larger version

Name:	JM0YJ87VZ79Q)$}DHH7G8BS.png
Views:	94
Size:	3.2 KB
ID:	200729
Test in these code.
PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(CMDLienter_Callback,"jointeam");
}

Action CMDLienter_Callback(int client, const char[] commandint argc)
{
    
// if( !IsValidClient(client) || IsFakeClient(client) )
    //     return Plugin_Continue;
    
PrintToServer("%N is changing to %d",clientGetCmdArgInt(1));
    return 
Plugin_Continue;


Last edited by LinLinLin; 05-30-2023 at 06:54.
LinLinLin is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-30-2023 , 14:52   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #916

Who is Lux? I need him to fix Terror_GetAdrenalineTime so it accounts for m_bAdrenalineActive.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 05-30-2023 , 15:57   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #917

Quote:
Originally Posted by LinLinLin View Post
As far as i know, AddCommandListener(jointeam) only fired when player types jointeam in his console. This doesn't fire when player team is changed by server or other situation.
And it actually doesn't change the player team.

I make this detour for the reason that it just like the player_team event, and the different between detour and event is detour can change the new team and event is not. ChangeClientTeam() in player_team event doesn't work correctly. Using RequestFrame will make it work but player will change to another team first and then change to the team we want. I think it is not good and this is why i make this detour.

Attachment 200729
Test in these code.
PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(CMDLienter_Callback,"jointeam");
}

Action CMDLienter_Callback(int client, const char[] commandint argc)
{
    
// if( !IsValidClient(client) || IsFakeClient(client) )
    //     return Plugin_Continue;
    
PrintToServer("%N is changing to %d",clientGetCmdArgInt(1));
    return 
Plugin_Continue;


They are right and this is the reason why pressing M is disabled on most servers, that and full team.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 06-06-2023 , 13:27   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #918

Quote:
Originally Posted by LinLinLin View Post
-
I sent you a PM, please check your messages.
__________________
Silvers is offline
Uncle Jessie
Member
Join Date: May 2016
Location: Mind Prison
Old 06-07-2023 , 10:15   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #919

Quote:
Originally Posted by eyal282 View Post
Who is Lux? I need him to fix Terror_GetAdrenalineTime so it accounts for m_bAdrenalineActive.
I think Vodka Lux, i have one to fix

Last edited by Uncle Jessie; 06-07-2023 at 10:16.
Uncle Jessie is offline
Mika Misori
Senior Member
Join Date: Sep 2022
Old 06-08-2023 , 06:03   Re: [L4D & L4D2] Left 4 DHooks Direct (1.132) [25-May-2023]
Reply With Quote #920

Quote:
Originally Posted by Silvers View Post
...
My servers recently had several crashes in a row with the same error:
server_srv.so!bool NavAreaBuildPath<ShortestPathCost>(CNavArea*, CNavArea*, Vector const*, Vector const*, ShortestPathCost&, CNavArea**, float, int, bool) + 0x490

Accelerator's crashes reports:
https://crash.limetech.org/ofip2yx6vv7j
https://crash.limetech.org/v26blr5cyv6p
https://crash.limetech.org/afgaj3czm2hy

I looked in Stack and found left4dhooks.smx on line 4 above:
Code:
   4: jit_code_3615490048_1048576 + 0xe74d9 [ left4dhooks.smx::.55836.Native_NavAreaBuildPath ]
      eip: 0xd78e74d9  esp: 0xff9a0f60  ebp: 0xff9a0f88  ebx: 0x0b7abdd0
      esi: 0x0b78ef58  edi: 0x0001ce38  

      ff9a0f60  78 0e 71 0b 90 bd 7a 0b  cc 87 01 00 c8 87 01 00  x.q...z.........
      ff9a0f70  e0 00 00 00 03 00 00 00  88 0f 9a ff d9 74 8e d7  .............t..
      ff9a0f80  1c da 00 00 02 00 00 00  a8 0f 9a ff b7 90 37 e1  ..............7.

      Found via call frame info
I don't know if it's left4dhooks or something else, just keeping you informed.

My servers are running on linux with the latest version of SourceMod and Left 4 DHooks Direct update. Crashes happened on both 33 and 100 tickrates. I didn't find any errors in the SourceMod logs during the crashes.
Attached Thumbnails
Click image for larger version

Name:	Servers crashes in a row with the same error.png
Views:	64
Size:	28.5 KB
ID:	200853  
Mika Misori is offline
Reply


Thread Tools
Display Modes

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 18:55.


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