This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[L4D]BUG after turning on the swith


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-04-2022 , 22:09   [L4D]BUG after turning on the swith
Reply With Quote #1

BUG:
After the player opens the mechanism, rush forward quickly. During this period, the infected will not be resurrected after the mechanism.
BUG MAP:
HTML Code:
l4d_hospital03_sewers
l4d_smalltown04_mainstreet
l4d_airport03_garage 
l4d_airport04_terminal
l4d_farm02_traintunnel
....more
I found a solution. But I don't know how to write plugins. So I want to use stripper to solve it.

After opening the swith, the system will trigger an event
Code:
"OnTrigger" "director,PanicEvent,,2,-1"
I deleted this event and used the command z_spawn mob, and found that the bug will not be generated.
stripper:source, how to trigger z_spawn mob
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:

Last edited by ZBzibing; 05-05-2022 at 06:31.
ZBzibing is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-04-2022 , 22:37   Re: [L4D]BUG after turning on the swith
Reply With Quote #2

point_servercommand

For reference: https://github.com/fbef0102/L4D2-Unl...ounds.cfg#L800

Search for sky_servercommander
__________________

Last edited by Marttt; 05-04-2022 at 22:38.
Marttt is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-05-2022 , 03:11   Re: [L4D]BUG after turning on the swith
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
Thanks, I have tested it successfully!
example:
Code:
add:
{
	"classname" "point_servercommand"
	"targetname" "servercmd"
}
modify:
{
    match:
    {
	"model" "*115"
    }
	insert:
	{
	"OnStartTouch" "servercmd,command,z_spawn Mob,0,1"
	}
}
Hospital01 riots caused by stairs in front of safe house.

error:Can't use cheat command z_spawn in multiplayer, unless the server has sv_cheats set to 1
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:

Last edited by ZBzibing; 05-05-2022 at 07:41.
ZBzibing is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 05-05-2022 , 19:32   Re: [L4D]BUG after turning on the swith
Reply With Quote #4

well maybe you will have to use a plugin (sourcemod) solution to trigger z_spawn Mob on StartTouch of this entity (by hammerid probably)
__________________
Marttt is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-06-2022 , 04:39   Re: [L4D]BUG after turning on the swith
Reply With Quote #5

Quote:
Originally Posted by Marttt View Post
well maybe you will have to use a plugin (sourcemod) solution to trigger z_spawn Mob on StartTouch of this entity (by hammerid probably)
Code:
public OnPluginStart()
{
	RegAdminCmd("sm_zmob", Command_ZspawnMob, FCVAR_NOTIFY, "trigger MOB.");
}

public Action:Command_ZspawnMob(client, args)
{
	ZspawnMob(client);
}


public ZspawnMob(client)
{
	new flags = GetCommandFlags("z_spawn");	
	SetCommandFlags("z_spawn", flags & ~FCVAR_CHEAT);
	FakeClientCommand(client, "z_spawn mob auto");
	ServerCommand("z_spawn mob auto");
	SetCommandFlags("z_spawn", flags|FCVAR_CHEAT);
}
I learned other people's plug-ins and made an example. The input command on the client side is normal, but the input on the server console is invalid. I don't know what to do.
My stupid way is to use stripper:source to call the commands in this plugin
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 05-06-2022 , 09:13   Re: [L4D]BUG after turning on the swith
Reply With Quote #6

FCVAR_NOTIFY is completely wrong flag to use here, you want to use the ADMFLAG_* flags such as ADMFLAG_ROOT


Don't set:
PHP Code:
SetCommandFlags("z_spawn"flags|FCVAR_CHEAT); 
Instead do:
PHP Code:
SetCommandFlags("z_spawn"flags); 
because you already stored the original flags, otherwise you would be adding the cheat flag to it, which might not have existed already, some servers strip the cheat flags and have another plugin handle allowing/disallowing use of the command.
__________________

Last edited by Silvers; 05-06-2022 at 09:14.
Silvers is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 05-09-2022 , 19:38   Re: [L4D]BUG after turning on the swith
Reply With Quote #7

Quote:
Originally Posted by Silvers View Post
FCVAR_NOTIFY is completely wrong flag to use here, you want to use the ADMFLAG_* flags such as ADMFLAG_ROOT
Don't set:
PHP Code:
SetCommandFlags("z_spawn"flags|FCVAR_CHEAT); 
HTML Code:
public OnPluginStart()
{
	RegAdminCmd("sm_zmob", Command_ZspawnMob, ADMFLAG_ROOT, "spawn mob.");
}
public ZspawnMob()
{
	new flags = GetCommandFlags("z_spawn");	
	SetCommandFlags("z_spawn", flags & ~FCVAR_CHEAT);
	ServerCommand("z_spawn mob auto");
	SetCommandFlags("z_spawn", flags); 
}
Can't use cheat command z_spawn in multiplayer, unless the server has sv_cheats set to 1
I modified it according to the prompts, but there is still an error message
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 12-13-2022 , 15:35   Re: [L4D]BUG after turning on the swith
Reply With Quote #8

Code:
#pragma semicolon 1
#pragma newdecls required

#define DEBUG

#define PLUGIN_AUTHOR "ZB"
#define PLUGIN_VERSION "0.03"

#include <sourcemod>
#include <sdktools>

int m_map;
int activatortmp;

enum
{
	A1M3 = 1,
	B2M1,
	C3M4,
	D4M3,
	D4M4,
	F6M2,
}

public Plugin myinfo = 
{
	name = "[ZB_FIX]Zmob Bug Fixes",
	author = PLUGIN_AUTHOR,
	description = "Zmob Bug Fixes",
	version = PLUGIN_VERSION,
	url = ""
};

public void OnPluginStart()
{
	RegConsoleCmd("sm_mob", Command_ZspawnMob);
	RegConsoleCmd("sm_zmob", Command_ZspawnMob);
	HookEvent("round_start", Event_RoundStart);
	//HookEvent("player_use", Event_PlayerUse);
	
}

public void OnMapStart()
{
	char sMap[64];
	GetCurrentMap(sMap, sizeof(sMap));

	m_map = 0;
	if( IsFixMap )
	{
		if( strcmp(sMap, "l4d_hospital03_sewers") == 0 ) m_map = A1M3;
		else if( strcmp(sMap, "l4d_garage01_alleys") == 0 ) m_map = B2M1;
		else if( strcmp(sMap, "l4d_smalltown04_mainstreet") == 0 ) m_map = C3M4;
		else if( strcmp(sMap, "l4d_airport03_garage") == 0 ) m_map = D4M3;
		else if( strcmp(sMap, "l4d_airport04_terminal") == 0 ) m_map = D4M4;
		else if( strcmp(sMap, "l4d_farm02_traintunnel") == 0 ) m_map = F6M2;
	}
	else
	{
		//if( strcmp(sMap, "l4d_hospital04_interior") == 0 || strcmp(sMap, "l4d_vs_hospital04_interior") == 0 ) m_map = A1M3;
		return;
	}
}
//--------------------Event--------------------//
public void Event_RoundStart(Event event, const char[] name, bool dontBroadcast)
{
	CreateTimer(1.0, tmrStart,TIMER_REPEAT);
}

public Action tmrStart(Handle timer)
{
	int ent = -1;
	if(m_map == A1M3 && (ent = FindByClassTargetName("func_button", "washer_lift_button2")) != -1)
	HookSingleEntityOutput(ent, "OnPressed", OnStartTouch, true);
	else if(m_map == B2M1 && (ent = FindByClassTargetName("func_button", "fire_howitzer")) != -1)
	HookSingleEntityOutput(ent, "OnPressed", OnStartTouch, true);
	else if(m_map == C3M4 && (ent = FindByClassTargetName("func_button", "button")) != -1)
	HookSingleEntityOutput(ent, "OnPressed", OnStartTouch, true);
	else if(m_map == D4M3 && (ent = FindByClassTargetName("prop_physics", "barricade_gas_can")) != -1)
	HookSingleEntityOutput(ent, "OnBreak", OnStartTouch, true);
	else if(m_map == D4M4 && (ent = FindByClassTargetName("func_button", "van_button")) != -1)
	HookSingleEntityOutput(ent, "OnPressed", OnStartTouch, true);
	else if(m_map == F6M2 && (ent = FindByClassTargetName("logic_relay", "emergency_door_relay")) != -1)
	HookSingleEntityOutput(ent, "OnTrigger", OnStartTouch, true);
}

public void OnStartTouch(const char[] output, int caller, int activator, float delay)
{
	CreateTimer(5.0, zmobfix_timer,3);
	activatortmp = activator;
}

public Action zmobfix_timer(Handle timer,int time)
{
	if( time >= 1)
	{
		CreateTimer( 30.0, zmobfix_timer, --time);
		EmitSoundToAll("npc/mega_mob/mega_mob_incoming.wav", _, SNDCHAN_AUTO, SNDLEVEL_RAIDSIREN, SND_NOFLAGS, SNDVOL_NORMAL, SNDPITCH_LOW, -1, NULL_VECTOR, NULL_VECTOR, true, 0.0);
		SpawnAWitch();
		zmobfix(activatortmp);
	}
	else if(time == 0)
	{
		return Plugin_Stop;
	}
	return Plugin_Continue;
}

public Action zmobfix(int args)
{
	char name[] = "mob";
	char command[] = "z_spawn";
	char iflags = GetCommandFlags(command);
	SetCommandFlags(command, iflags & ~FCVAR_CHEAT);
	FakeClientCommand(activatortmp, "z_spawn %s", name);
	SetCommandFlags(command, iflags);
	ShowActivity2(activatortmp, "ZB", "Spawned a %s", name);
	PrintToChatAll("\x04[test]trigger:%N",activatortmp);
}

public Action Command_ZspawnMob(int client, int args)
{
	char name[] = "mob";
	char command[] = "z_spawn";
	int flags = GetCommandFlags(command);
	SetCommandFlags(command, flags & ~FCVAR_CHEAT);
	FakeClientCommand(client, "z_spawn %s", name);
	SetCommandFlags(command, flags);
}

bool IsFixMap()
{
	char sMap[64];
	GetCurrentMap(sMap, sizeof(sMap));
	if (StrEqual(sMap, "l4d_hospital02_subway", false))
	{
		//UnflagAndExecuteCommand(TriggeringBot, "ent_fire", "filter_generator", "TestActivator");
	}
	else if (StrEqual(sMap, "l4d_hospital03_sewers", false))
	{
		int ent = -1;
		ent = FindByClassTargetName("func_button", "washer_lift_button2");
		if(ent != -1 )
		{
			PrintToChatAll("\x04[ZB] button,on");
		}
		else
		{
			//TriggerPanicEvent();
			PrintToChatAll("\x04[ZB] button,off");
		}
	}
}

int FindByClassTargetName(const char[] sClass, const char[] sTarget)
{
	char sName[64];
	int ent = -1;
	while( (ent = FindEntityByClassname(ent, sClass)) != -1 )
	{
		GetEntPropString(ent, Prop_Data, "m_iName", sName, 64);
		if( strcmp(sTarget, sName) == 0 ) return ent;
	}
	return -1;
}
Code:
L 12/14/2022 - 04:17:59: [SM] Exception reported: Client index 203 is invalid
L 12/14/2022 - 04:17:59: [SM] Blaming: test\ZB_MobFix.smx
L 12/14/2022 - 04:17:59: [SM] Call stack trace:
L 12/14/2022 - 04:17:59: [SM]   [0] FakeClientCommand
L 12/14/2022 - 04:17:59: [SM]   [1] Line 117, I:\ZB_MobFix.sp::zmobfix
L 12/14/2022 - 04:17:59: [SM]   [2] Line 101, I:\ZB_MobFix.sp::zmobfix_timer

Sometimes it will be effective, sometimes it will be invalid and an error will be reported. How to solve it?
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 12-13-2022 , 16:25   Re: [L4D]BUG after turning on the swith
Reply With Quote #9

that is a XY solution.

But...if you will keep with this, better find a random client to call FakeClientCommand, instead using the activator that may be a trigger, etc so won't be always a client.
__________________
Marttt is offline
ZBzibing
Senior Member
Join Date: Dec 2012
Old 12-16-2022 , 04:28   Re: [L4D]BUG after turning on the swith
Reply With Quote #10

Quote:
Originally Posted by Marttt View Post
that is a XY solution.

But...if you will keep with this, better find a random client to call FakeClientCommand, instead using the activator that may be a trigger, etc so won't be always a client.
Hello, marttt
I rely on a translation tool for my communication and his accuracy can make it difficult for people to understand what I mean.
I don't speak English very well, so I can read a lot of communication in the forum, and each person's reply can take me a long time to understand what they are saying over and over again.
Also regarding the programming language, it is very difficult for people who have no programming skills.
Because of my love for L4D, I feel that I am constantly trying to improve it. In my knowledge of learning step by step, some bottlenecks have to be solved with the help of programming, so I found this place, where I can learn. I can't learn systematically, and I can't understand the application of INT, BOOL, float, I rely on the use of IF, time is also the use of a large number of other people's code, constantly trying to see if it can run, and simply can not understand, the reason for his statement error.
So stand from a different perspective, I try, so please forgive me for not being able to express my meaning accurately.
__________________
Please forgive, If I'm not describing it accurately. I use google translate
Functional tests are all from L4D1, and are only keen to solve and fix various bugs of L4D1:
ZBzibing 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 02:05.


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