Ignore color input
1 Attachment(s)
Hi guys, I'm currently working with this plugin (also attached below): https://forums.alliedmods.net/showpo...&postcount=538 Unfortunately the author has not been online in 3 months, and I haven't been able to contact him.
This plugin allows players to answer a math question and gain store credits. The store plugin I am using also allows players to colorize their chat messages (using {blue}, {red}, {green}, etc) which is not registering properly with the above plugin. I was wondering if it is possible to ignore the chat colors, and only get the proper string (the numbers) that the player is typing into chat. Thanks! |
Re: Ignore color input
Try this, uses regex.
Replace this function and include <regex> Code:
#include <regex> |
Re: Ignore color input
That works with no chat colors, but when I have chat colors enabled, still no dice. :(
|
Re: Ignore color input
If this is for CS:GO then i don't think its {red}, {blue}, instead it uses \x02, \x03..etc... i think?
Can you link to the color chat plugin your using? |
Re: Ignore color input
Should remove all unprintable characters from the message, including color, if the message is ASCII. (untested but should work)
PHP Code:
Spoiler
|
Re: Ignore color input
Thanks for the tip on the memory leak!
Unfortunately with that solution, the plugin now sees no answers from anyone, regardless of color or no color. Error log: Code:
L 03/21/2017 - 02:00:29: [SM] Call stack trace: |
Re: Ignore color input
PHP Code:
PHP Code:
Spoiler
|
Re: Ignore color input
I was unable to compile so it might have an error I couldn't catch, but this might be what you're looking for lol.
PHP Code:
|
Re: Ignore color input
Quote:
Yours will still have a memory leak, CreateDataTimer will automatically create a DataPack handle when called and is freed automatically when the timer ends. Just need to change Handle pack = CreateDataPack(); to Handle pack; and don't need to delete the datapack since it's automatically closes. Quote:
|
Re: Ignore color input
Quote:
|
All times are GMT -4. The time now is 01:49. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.