Raised This Month: $ Target: $400
 0% 

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


Post New Thread Reply   
 
Thread Tools Display Modes
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-07-2023 , 07:47   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #841

Edit: After speaking with 3ipKa, the issue was calling the natives in "round_start" which can happen before OnMapStart. Adding a timer in the affected plugin fixed the issue.
__________________

Last edited by Silvers; 04-07-2023 at 09:03.
Silvers is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 04-08-2023 , 13:45   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #842

Request add L4D_IsServerHibernating() native

Code:
"CGameServer::IsHibernating"
{
	"library"	"engine"
	"linux"		"@_ZNK11CGameServer13IsHibernatingEv"
	"windows"		"\x8A\x81\x81\xD3\x02\x00"
}

PHP Code:
// without using sdkcall
bool bHibernating LoadFromAddress(g_pGameServer view_as<Address>(m_bHibernating), NumberType_Int8);

// m_bHibernating
windows 185217
linux 185209 
ProjectSky is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-08-2023 , 14:15   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #843

Quote:
Originally Posted by ProjectSky View Post
Request add L4D_IsServerHibernating() native
IsServerProcessing()

?
__________________
Silvers is offline
ProjectSky
AlliedModders Donor
Join Date: Aug 2020
Old 04-08-2023 , 23:39   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #844

Quote:
Originally Posted by Silvers View Post
IsServerProcessing()

?
With server hibernated it reports true, server not hibernated it reports false?
this is so weird.

Code:
True if the server is ticking, false otherwise.
server ticking while hibernated? or did i mess up something?

Last edited by ProjectSky; 04-08-2023 at 23:43.
ProjectSky is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 04-09-2023 , 09:09   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #845

SM timers can still tick when a server is hibernating afaik since SM 1.10.

Try and see.
__________________
Silvers is offline
yzybb
Member
Join Date: Jul 2020
Old 04-10-2023 , 11:22   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #846

Hello, Silvers. I'm sorry to bother you. L4D_SetVersusMaxCompletionScore() seems to have a bug that always crashes my server, with the frequency reaching several dozen times. I'm sure it's caused by this function. Here is the server crash information:
(All crashes ultimately point to tier0.dll+0x1991d. I have provided 3 crash reports with more information, hoping it can be helpful)

<removed crash dump, so the post loads faster - by Silvers>

Plugins Source code
Code:
#pragma semicolon 1
#pragma newdecls required
#include <left4dhooks>
#include <sourcemod>

int g_iPlayerSpawn, g_iRoundStart, iDistance;


public void OnConfigsExecuted()
{
	HookEvent("tank_spawn", TankSpawn, EventHookMode_PostNoCopy);
	HookEvent("player_death", PlayerDeath, EventHookMode_Post);
	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
	HookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);

	// isVersus
	if(L4D_GetGameModeType() == 2)
	{
		iDistance = L4D_GetVersusMaxCompletionScore();
	}
	else
	{
		UnhookEvent("tank_spawn", TankSpawn, EventHookMode_PostNoCopy);
		UnhookEvent("player_death", PlayerDeath, EventHookMode_Post);
		UnhookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
		UnhookEvent("player_spawn", Event_PlayerSpawn, EventHookMode_PostNoCopy);
	}
}

void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	if( g_iPlayerSpawn == 1 && g_iRoundStart == 0 )
		CreateTimer(0.5, TimerStart, _, TIMER_FLAG_NO_MAPCHANGE);
	g_iRoundStart = 1;
}

void Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast)
{
	if( g_iPlayerSpawn == 0 && g_iRoundStart == 1 )
		CreateTimer(0.5, TimerStart, _, TIMER_FLAG_NO_MAPCHANGE);
	g_iPlayerSpawn = 1;
}

Action TimerStart(Handle timer)
{
	g_iRoundStart = 0;
	g_iPlayerSpawn = 0;

	L4D_SetVersusMaxCompletionScore(iDistance);

	return Plugin_Continue;
}

public void TankSpawn(Event hEvent, const char[] eName, bool dontBroadcast)
{
	L4D_SetVersusMaxCompletionScore(0);
}

public void PlayerDeath(Event hEvent, const char[] eName, bool dontBroadcast)
{
	int client = GetClientOfUserId(hEvent.GetInt("userid"));
	if (client >0 && IsTank(client))
	{
		if (!L4D2_IsTankInPlay()) L4D_SetVersusMaxCompletionScore(iDistance);
	}
}

public void OnClientDisconnect(int client)
{
	if (IsTank(client))
	{
		if (!L4D2_IsTankInPlay()) L4D_SetVersusMaxCompletionScore(iDistance);
	}
}

bool IsTank(int client)
{
	return IsClientInGame(client) && GetEntProp(client,Prop_Send,"m_zombieClass") == 8;
}

Last edited by Silvers; 05-21-2023 at 15:59. Reason: Removing unnecessary crash dump data
yzybb is offline
49459317
Junior Member
Join Date: May 2021
Location: Sichuan
Old 04-12-2023 , 11:00   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #847

L4D_WarpToValidPositionIfStuck
Very useful, can you also provide one for an infected person to use?Thank you.
49459317 is offline
Mystik Spiral
Senior Member
Join Date: Oct 2020
Location: Orlando, FL
Old 04-16-2023 , 13:22   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #848

Hi Silvers!

Can the forward L4D2_CGasCan_EventKilled be suppressed with Plugin_Handled? I am in the planning phase about how to prevent detonation of a gascan under specific circumstances and wondered if I could hook this event, do checks, and potentially block gascan detonation with Plugin_Handled. If detonation can be suppressed with Plugin_Handled, would the gascan entity still exist or will it be destroyed?

Last edited by Mystik Spiral; 04-19-2023 at 09:41.
Mystik Spiral is offline
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 04-16-2023 , 15:37   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #849

Quote:
Originally Posted by 49459317 View Post
L4D_WarpToValidPositionIfStuck
Very useful, can you also provide one for an infected person to use?Thank you.
L4D_WarpToValidPositionIfStuck also apply to alive special infected, I have tested.
__________________
HarryPotter is offline
49459317
Junior Member
Join Date: May 2021
Location: Sichuan
Old 04-16-2023 , 19:53   Re: [L4D & L4D2] Left 4 DHooks Direct (1.129) [31-Mar-2023]
Reply With Quote #850

Ah, old ha, you're right
49459317 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 17:46.


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