![](img/smiles/cry.gif)
Forum
![>](img/i_next.png)
![>](img/icons/cs2d.png)
![>](img/i_next.png)
![>](img/i_next.png)
Stop @C
14 replies![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)
![](img/smiles/cry.gif)
if txt:sub(#txt-1,#txt) == "@C" then txt = txt:sub(1,#txt-2) end
1
text:gsub('@C', '')
![user](img/i_friend.png)
thanks
![](img/smiles/bigsmile.gif)
![user](img/i_friend.png)
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).
![user](img/i_friend.png)
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
![user](img/i_friend.png)
![](img/smiles/smile.gif)
![user](img/i_friend.png)
![](img/smiles/heart.gif)
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
![user](img/i_friend.png)
![user](img/i_friend.png)
@
![user](img/i_friend.png)
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
![user](img/i_friend.png)
![](img/smiles/wink.gif)
![To the start](img/i_first.png)
![Previous](img/i_prev.png)
![Next](img/i_next.png)
![To the start](img/i_last.png)