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

Typing '{' is replaced with '{{}' #43

Open
Hexer10 opened this issue Nov 27, 2018 · 1 comment
Open

Typing '{' is replaced with '{{}' #43

Hexer10 opened this issue Nov 27, 2018 · 1 comment

Comments

@Hexer10
Copy link
Contributor

Hexer10 commented Nov 27, 2018

Whenever someone write something in chat, and a plugin returns Plugin_Changed in the forward, if the text contains { it becomes {{}, more test cases:
Hello {} -> No Changes
Hello {world} -> No Changes
Hello {{} -> Hello {}
Hello {{}} -> Hello {}}
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{ -> {{} - Any brackets count.
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{} -> {} - Any brackets count.

I solved this issue by replacing this part of code:

https://github.com/Drixevel/Chat-Processor/blob/b2eec276b4c2cd7ed6f5c9a43d564fbf13f2e9f1/scripting/include/colorvariables.inc#L366-L408

with

	StringMap map = view_as<StringMap>(g_hColors);
	StringMapSnapshot snap = map.Snapshot();
	int size = snap.Length;
	char sKey[32];
	char sReplace[32] = "";
	for (int i = 0; i < size; i++)
	{
		snap.GetKey(i, sKey, sizeof(sKey));
		if (!bRemoveColors)
			map.GetString(sKey, sReplace, sizeof(sReplace));
		Format(sKey, sizeof(sKey), "{%s}", sKey);
		ReplaceString(sMsg, iSize, sKey, sReplace);
	}
	delete snap;

I don't know if it could cause performance issues, or other problems in some games, I've tested it only on CSGO,

@DJPlaya
Copy link

DJPlaya commented Nov 27, 2018

This is a real Problem, i have a Server with mostly Hebrew speaking Players and this is coming with every Message in that Lang.

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