EventScripts-Emulator icon indicating copy to clipboard operation
EventScripts-Emulator copied to clipboard

ConCommand called via ES function not being executed fully during certain events. (CSGO)

Open backwards-dev opened this issue 6 years ago • 1 comments

eventscripts code:

event player_spawn
{
    es  wcs_disable_attack event_var(userid) 0
    es_msg [ESS] disable attack: event_var(userid) (Event Spawn)
}

sourcemod code for registerd ConCommand:

public OnPluginStart()
{
    RegServerCmd("wcs_disable_attack", DisableAttack_CMD);
}

public Action:DisableAttack_CMD(args)
{
    PrintToChatAll("Disable Attack Command Callback.");
    return Plugin_Handled;
}

Reproduce the bug by running both of these scripts and executing "mp_restartgame 1" multiple times. If you wait around 20 seconds and execute it again, then it stops calling the callback function and printing the message on player spawn event. After this point you don't have to wait 20 seconds between "mp_restartgame 1" calls, as it will fail to call the function "fully" everytime until the es_reload plugin is ran.

I say it's not "fully executed" because the callback isn't ran. However sourcemods command listener will see the command and all its args executed (via print logger). I'm unsure what's causing it inside of the eventscripts emulator as i haven't had time to look.

WorkAround: Add spoof to the begining of the command arg string when executing ConCommands via ES.

event player_spawn
{
    es spoof wcs_disable_attack event_var(userid) 0
    es_msg [ESS] disable attack: event_var(userid) (Event Spawn)
}

Sourcemod Plugin: This plugin will run the command via sourcemod and issue the callback 100% of the time.

#include <sourcemod>
#include <sdktools>

public Plugin myinfo =
{
	name = "EventScripts Emulator Command Push Proxy",
	author = "backwards",
	description = "...",
	version = "1.0",
	url = "http://steamcommunity.com/id/mypassword"
};

public OnAllPluginsLoaded()
{
	RegServerCmd("spoof", Spoof_CMD);
	
	AddCommandListener(Commands_CommandListener);
}

public Action:Commands_CommandListener(client, const String:command[], argc)
{
	if (client < 1)
	{
		decl String:f_sCmdString[256];
		GetCmdArgString(f_sCmdString, sizeof(f_sCmdString));
		
		if(StrEqual("spoof", command, false))
		{
			ReplaceString(f_sCmdString, 256, "spoof ", "", false);
			ServerCommand(f_sCmdString)
			PrintToServer("Spoofer Found Command %s", f_sCmdString);
			return Plugin_Handled;
		}
	}

	return Plugin_Continue;
}

public Action:Spoof_CMD(args)
{
	return Plugin_Continue;
}

backwards-dev avatar Feb 12 '20 16:02 backwards-dev

Does this plugin disable the ability to attack? Ifso had this issue been fixed already? I'd love to use such a plugin in eventscripts.

Thanks in advance!

NosferatuJoe avatar Jan 26 '21 12:01 NosferatuJoe