Forum
CS2D Scripts Stop @CStop @C
14 replies 1
if txt:sub(#txt-1,#txt) == "@C" then txt = txt:sub(1,#txt-2) end
1
text:gsub('@C', '')
thanks
Appending the
$magic character to the pattern makes sure that the "@C" is written at the end of the string, thus preventing such cases to happen (even though they're not likely to happen, but still).
1
string.gsub(chatmessage_variable, "@C$", "@C ")
1
string.gsub(chatmessage_variable, "^\169%d%d%d%d%d%d%d%d%d", " %1")
But instead of deleting the @C or colorcode, I place a space " " in the end or in the beginning in the message, so these codes have no meaning to cs2d
The people that usually find out these loop-holes and try to break things are idiots. Logical thinking is not one of their strong feats, so they try things like @C@C. It is within their nature.
Took them 5 minutes to figure out @C@C worked on my server after I patched it to remove the last instance like you did.
1
2
3
4
5
6
7
2
3
4
5
6
7
function escapeString(text) 	if string.sub(text, -2) == "@C" then 		text = string.sub(text, 1, string.len(text) - 2) 	end 	text = string.gsub(text, "[\166]", " ") 	return text end
@ Yates: No, these people are true legends. They find the impossible. Their logic exceeded your logic and they outsmarted your system.
The people who find the deepest & elegant loopholes have my respect.
Also regarding "@C@C" - when you add a space to the end of the message, it will look very weird in chat, because it must have worked!!1111
1
2
3
4
5
6
7
8
2
3
4
5
6
7
8
local txt = 'Remove Kebab@C@C@C' while txt:sub(-2) == '@C' do txt = txt:sub(1, -3) end print(txt) -- Remove Kebab
1