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

[L4D2] Zombie Class Select Redux


Post New Thread Reply   
 
Thread Tools Display Modes
Author
eyal282
Veteran Member
Join Date: Aug 2011
Plugin ID:
7991
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Left 4 Dead
Plugin Dependencies:
Servers with this Plugin:
 
Plugin Description:
Minor fixes for players, major fixes for my plugins
Old 03-06-2022 , 08:00   [L4D2] Zombie Class Select Redux
Reply With Quote #1

Requires Left4Dhooks
I might add a few features but this fixes bugs that ruined my stock of the upcoming Point System API

Code:
// bNoPick = cannot press mouse2 to change to another SI in a ghost spawn by the plugin l4d2_zcs.smx
#pragma deprecated Wait for Point System API, this stock might not work...
stock bool PSAPI_SpawnInfectedBossByClassname(int client, const char[] name, bool bGhost=false, bool bNoPick = false)
{	
	if(StrEqual(name, "survivor") || StrEqual(name, "witch"))
		return false;
	
	// Multi tanks will create utter chaos if we don't first swap to a non-tank class prior to spawning the player.
	
	L4D_SetClass(client, view_as<int>(L4D2ZombieClass_Charger));
	L4D2_SetPlayerZombieClass(client, L4D2ZombieClass_Charger);

	// Safety measurements.
	L4D_State_Transition(client, STATE_DEATH_WAIT_FOR_KEY);

	float fOrigin[3];
	GetEntPropVector(client, Prop_Data, "m_vecOrigin", fOrigin);

	// Regardless of bGhost, we switch to ghost. If not ghost, we materialize.
	// We must become ghost prior to sending the event or zcs will wait another 0.1 seconds until we're alive.
	L4D_State_Transition(client, STATE_GHOST);

	if(bGhost)
	{
		// ZCS is really really annoying with its demands.
		Event event = CreateEvent("ghost_spawn_time");

		event.SetInt("userid", GetClientUserId(client));
		event.SetFloat("spawntime", 0.0);
		event.Fire();
	}



	// isRelocating and isCulling are not a solution to make a no pick, you can only respawn yourself and then swap to ghost as the only solution.
	// isRelocating is not 100% grasped by me, but isCulling checks if a living player can teleport and become ghost for being too far away from survivors.
	// isCulling is not a player that already pressed E to teleport as a living player.
	//SetEntProp(client, Prop_Send, "m_isCulling", bNoPick);
	//SetEntProp(client, Prop_Send, "m_isRelocating", bNoPick);

	if(bNoPick)
	{
		// Respawn is required to make ZCS think we relocated. Must put state transition above to ensure spec2ghost take the OnEnterGhostState
		L4D_RespawnPlayer(client);

		// Since we must switch to ghost again, we must recreate the spectator origin to activate spec2ghost
		TeleportEntity(client, fOrigin);

		// On top of state transition required to negate RespawnPlayer, you must switch state twice to remove a fake message of "You are too far away from survivors" caused by either isRelocating or isCulling
		L4D_State_Transition(client, STATE_GHOST);
	}

	for (int i = 0; i < sizeof(g_sBossClassnames);i++)
	{
		if(StrEqual(g_sBossClassnames[i], name))
		{
			L4D_SetClass(client, i);
			L4D2_SetPlayerZombieClass(client, view_as<L4D2ZombieClassType>(i));
		}
	}
	
	PSAPI_FullHeal(client); // I don't know how, but I once spawned as a tank health smoker.
	
	if(!bGhost)
		L4D_MaterializeFromGhost(client);

	return true;
}
Do not expect me to help you with less than a 1.10 compiler & server.
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_zcs_redux.sp - 212 views - 41.3 KB)
File Type: smx l4d2_zcs_redux.smx (19.0 KB, 242 views)
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334

Last edited by eyal282; 04-25-2022 at 00:52.
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-06-2022 , 09:13   Re: [L4D2] Zombie Class Select Redux
Reply With Quote #2

For the 5 people who pressed Get Plugin, you should reinstall it because your version crashes servers.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Krufftys Killers
Senior Member
Join Date: Jan 2014
Old 03-06-2022 , 09:59   Re: [L4D2] Zombie Class Select Redux
Reply With Quote #3

Got an error

03/06/2022 - 08:49:19: SourceMod error session started
L 03/06/2022 - 08:49:19: Info (map "c1m1_hotel") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220306.log")
L 03/06/2022 - 08:49:19: [SM] Exception reported: [+] S_HGD: Error: Unable to find SetClass signature.
L 03/06/2022 - 08:49:19: [SM] Blaming: l4d2_zcs_redux.smx
L 03/06/2022 - 08:49:19: [SM] Call stack trace:
L 03/06/2022 - 08:49:19: [SM] [0] SetFailState
L 03/06/2022 - 08:49:19: [SM] [1] Line 978, C:\Users\kruff\Desktop\l4d2_zcs_redux.sp::Sub _HookGameData
L 03/06/2022 - 08:49:19: [SM] [2] Line 224, C:\Users\kruff\Desktop\l4d2_zcs_redux.sp::OnP luginStart
L 03/06/2022 - 08:49:19: [SM] Unable to load plugin "l4d2_zcs_redux.smx": Error detected in plugin startup (see error logs)
L 03/06/2022 - 08:57:53: Error log file session closed.
Krufftys Killers is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 03-08-2022 , 15:07   Re: [L4D2] Zombie Class Select Redux
Reply With Quote #4

Quote:
Originally Posted by Krufftys Killers View Post
Got an error

03/06/2022 - 08:49:19: SourceMod error session started
L 03/06/2022 - 08:49:19: Info (map "c1m1_hotel") (file "C:\servers\kruffty\left4dead2\addons\sourcem od\logs\errors_20220306.log")
L 03/06/2022 - 08:49:19: [SM] Exception reported: [+] S_HGD: Error: Unable to find SetClass signature.
L 03/06/2022 - 08:49:19: [SM] Blaming: l4d2_zcs_redux.smx
L 03/06/2022 - 08:49:19: [SM] Call stack trace:
L 03/06/2022 - 08:49:19: [SM] [0] SetFailState
L 03/06/2022 - 08:49:19: [SM] [1] Line 978, C:\Users\kruff\Desktop\l4d2_zcs_redux.sp::Sub _HookGameData
L 03/06/2022 - 08:49:19: [SM] [2] Line 224, C:\Users\kruff\Desktop\l4d2_zcs_redux.sp::OnP luginStart
L 03/06/2022 - 08:49:19: [SM] Unable to load plugin "l4d2_zcs_redux.smx": Error detected in plugin startup (see error logs)
L 03/06/2022 - 08:57:53: Error log file session closed.
Hmm that's weird. I'll take a look when I fix other stuff. This version will be more "felt" after I release my point system API.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
eyal282
Veteran Member
Join Date: Aug 2011
Old 04-25-2022 , 01:40   Re: [L4D2] Zombie Class Select Redux
Reply With Quote #5

Major update that I don't remember what contains.
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Spicee
Junior Member
Join Date: Jul 2020
Old 04-30-2022 , 02:17   Re: [L4D2] Zombie Class Select Redux
Reply With Quote #6

Doesn't work with ABM Infected Team on coop mode. Already on 1.11
Spicee 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 07:47.


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