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
sorallll
Senior Member
Join Date: Oct 2018
Old 06-30-2021 , 14:45   Re: [L4D & L4D2] Left 4 DHooks Direct (1.42) [23-Jun-2021]
Reply With Quote #341

Quote:
Originally Posted by ProjectSky View Post
is there any way block ghost state si spawn?
found m_ghostSpawnState, but it need called every frame on the client.

i using this method, i think maybe there is a better solution
PHP Code:
public Action OnPlayerRunCmd(int clientint &buttons)
{
    if (!(
buttons IN_ATTACK)) return Plugin_Continue;
    else if (
GetClientTeam(client) != || IsFakeClient(client) || GetEntProp(clientProp_Send"m_isGhost") != 1) return Plugin_Continue;
    else if (
GetEntProp(clientProp_Send"m_ghostSpawnState") != 0) return Plugin_Continue;

    if (
g_ibalabala)
    {
        
buttons &= ~IN_ATTACK;
        return 
Plugin_Continue;
    }
    return 
Plugin_Continue;

detour L4D_MaterializeFromGhost
sorallll is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 07-01-2021 , 00:27   Re: [L4D & L4D2] Left 4 DHooks Direct (1.42) [23-Jun-2021]
Reply With Quote #342

Quote:
Originally Posted by sorallll View Post
detour L4D_MaterializeFromGhost
it works thx!!(silvers can you add it?)

PHP Code:
public void OnPluginStart()
{
    
GameData hGameData = new GameData("test");
    if (
hGameData == nullSetFailState("Failed to load test.txt gamedata.");
    
    
DHookSetup hDetour DHookCreateFromConf(hGameData"CTerrorPlayer::MaterializeFromGhost");
    if(!
hDetour)
        
SetFailState("Failed to find CTerrorPlayer::MaterializeFromGhost signature.");
    if(!
DHookEnableDetour(hDetourfalseMaterializeFromGhost))
        
SetFailState("Failed to start detour CTerrorPlayer::MaterializeFromGhost.");
    
    
delete hGameData;
}

public 
MRESReturn MaterializeFromGhost(int pThisDHookParam hParams)
{
    
PrintToChatAll("Player: %N"pThis);
    return 
MRES_Supercede;

Code:
"Games"
{
	"left4dead2"
	{
		"Functions"
		{
      "CTerrorPlayer::MaterializeFromGhost"
			{
				"signature"		"MaterializeFromGhost"
				"callconv"		"thiscall"
				"return"		"void"
				"this"			"entity"
			}
		}
    
		"Signatures"
		{
       /*
			 * CTerrorPlayer::MaterializeFromGhost(void)
       * form left4dhooks
			 */
			"MaterializeFromGhost"
			{
				"library"	"server"
				"linux"		"@_ZN13CTerrorPlayer20MaterializeFromGhostEv"
				"windows"	"\x56\x8B\xF1\x8B\x06\x8B\x90\x2A\x2A\x2A\x2A\xFF\xD2\x50\xE8\x2A\x2A\x2A\x2A\x83\xC4"
				/* 56 8B F1 8B 06 8B 90 ? ? ? ? FF D2 50 E8 ? ? ? ? 83 C4 */
				/* Search "%s materialized from spawn mode as a %s" */
			}
		}
	}
}
ProjectSky is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2021 , 01:05   Re: [L4D & L4D2] Left 4 DHooks Direct (1.42) [23-Jun-2021]
Reply With Quote #343

Yeah will do. You'll have to give me some time.. I was adding some new natives but they're not working 100% yet. When that's done I'll release with the new forward.

Edit: Completed.
__________________

Last edited by Silvers; 07-01-2021 at 09:03.
Silvers is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-01-2021 , 01:17   Re: [L4D & L4D2] Left 4 DHooks Direct (1.42) [23-Jun-2021]
Reply With Quote #344

You can improve the signatures with these:
L4D1:
PHP Code:
/* From "server.dll" */
Signature for detouring sub_1029F820 (CTerrorPlayer::MaterializeFromGhost):
"\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xFF\x2A\x50\xE8\x2A\x2A\x2A\x2A\x50\x8D\x86"
/* ? ? ? ? ? ? ? ? ? ? ? FF ? 50 E8 ? ? ? ? 50 8D 86 */ 
L4D2:
PHP Code:
/* From "server.dll" */
Signature for detouring sub_1031D120 (CTerrorPlayer::MaterializeFromGhost):
"\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\x2A\xFF\x2A\x50\xE8\x2A\x2A\x2A\x2A\x83\x2A\x2A\x50\x8B\x2A\x8B\x90\x2A\x2A\x2A\x2A\x8B\x2A\xFF\x2A\x50\x68\x2A\x2A\x2A\x2A\xE8"
/* ? ? ? ? ? ? ? ? ? ? ? FF ? 50 E8 ? ? ? ? 83 ? ? 50 8B ? 8B 90 ? ? ? ? 8B ? FF ? 50 68 ? ? ? ? E8 */ 
You could also probably wildcard some more bytes to make them more durable.
__________________
Psyk0tik is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2021 , 09:02   Re: [L4D & L4D2] Left 4 DHooks Direct (1.43) [01-Jul-2021]
Reply With Quote #345

Done.

Code:
1.43 (01-Jul-2021)
    - L4D1 & L4D2 update:
    - Added forward "L4D_OnMaterializeFromGhostPre" and "L4D_OnMaterializeFromGhost" when a client spawns out of ghost mode. Thanks to "ProjectSky" and "sorallll" and for suggesting.

    - Added native "L4D_RespawnPlayer" to respawn a dead player.
    - Added native "L4D_SetHumanSpec" to takeover a bot.
    - Added native "L4D_TakeOverBot" to takeover a bot.
    - Added native "L4D_CanBecomeGhost" to determine when someone is about to enter ghost mode.
    - Added native "L4D2_AreWanderersAllowed" to determine if Witches can wander.
    - Added native "L4D_IsFinaleEscapeInProgress" to determine when the rescue vehicle is leaving until.
    - Added native "L4D_GetLastKnownArea" to retrieve a clients last known nav area.

    - Added missing "ACT_ITEM2_VM_LOWERED_TO_IDLE" to the "data/left4dhooks.l4d2.cfg" config.

    - Updated: Plugin, Test plugin, Include file, GameData files and "data/left4dhooks.l4d2.cfg" config.
__________________

Last edited by Silvers; 07-01-2021 at 12:28.
Silvers is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 07-01-2021 , 11:02   Re: [L4D & L4D2] Left 4 DHooks Direct (1.43) [01-Jul-2021]
Reply With Quote #346

Quote:
Originally Posted by Silvers View Post
Done.

Code:
1.43 (01-Jul-2021)
great update, thx

edit: erros

USE L4D_OnMaterializeFromGhostPre

Code:
L 07/02/2021 - 00:07:48: [SM] Exception reported: Maximum number of parameters reached
L 07/02/2021 - 00:07:48: [SM] Blaming: left4dhooks.smx
L 07/02/2021 - 00:07:48: [SM] Call stack trace:
L 07/02/2021 - 00:07:48: [SM]   [0] Call_PushCell
L 07/02/2021 - 00:07:48: [SM]   [1] Line 7484, C:\Servers\L4D2\left4dead2\addons\sourcemod\scripting\left4dhooks.sp::OnMaterialize
PHP Code:
public MRESReturn OnMaterialize(int clientHandle hParams)
{
    
//PrintToServer("##### DTR OnMaterializeFromGhost");

    
Call_StartForward(g_hForward_OnMaterializeFromGhost);
    
Call_PushCell(client);
    
Call_Finish(); // Miss Call_Finish()

    
return MRES_Ignored;


Last edited by ProjectSky; 07-01-2021 at 12:16. Reason: Error found
ProjectSky is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 07-01-2021 , 11:55   Re: [L4D & L4D2] Left 4 DHooks Direct (1.43) [01-Jul-2021]
Reply With Quote #347

Quote:
Originally Posted by Silvers View Post
Done.

Code:
1.43 (01-Jul-2021)
    - Added native "L4D_IsFinaleEscapeInProgress" to determine if Witches can wander around.
This don't seem right. Maybe you copy pasted the wrong description?
__________________
Spirit_12 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-01-2021 , 12:27   Re: [L4D & L4D2] Left 4 DHooks Direct (1.44) [01-Jul-2021]
Reply With Quote #348

Thanks, fixed.

Code:
1.44 (01-Jul-2021)
    - Fixed forward "L4D_OnMaterializeFromGhost" not firing. Thanks to "ProjectSky" for reporting.
    - Fixed changelog description. Thanks to "Spirit_12" for reporting.
__________________
Silvers is offline
fdxx
Member
Join Date: Oct 2020
Location: 0xdeadbeef
Old 07-02-2021 , 09:55   Re: [L4D & L4D2] Left 4 DHooks Direct (1.44) [01-Jul-2021]
Reply With Quote #349

This is a bit confusing:
Code:
Then call "L4D_TakeOverBot" then call "L4D_SetHumanSpec
It should be like this?
Code:
First "L4D_SetHumanSpec", then "L4D_TakeOverBot"
fdxx is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 07-02-2021 , 09:59   Re: [L4D & L4D2] Left 4 DHooks Direct (1.44) [01-Jul-2021]
Reply With Quote #350

You're right, thanks for reporting the mistake. Test plugin shows correct usage.
__________________
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 11:58.


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