Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
backwards-dev opened this issue Feb 12, 2020 · 1 comment

Comments

@backwards-dev
Copy link

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;
}
@NosferatuJoe
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants