Raised This Month: $32 Target: $400
 8% 

Solved Ignore color input


Post New Thread Reply   
 
Thread Tools Display Modes
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 03-21-2017 , 04:29   Re: Ignore color input
Reply With Quote #11

Damit, i completely forgot lol

Headline's solution is a bit exploitable tho.

PHP Code:
if(StrContains("123456789" /*User input*/"2" /*1+1=2*/) != -1
Timocop is offline
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 03-21-2017 , 09:59   Re: Ignore color input
Reply With Quote #12

Damn... my code is old. Need to be rewritten.
__________________
Want to check my plugins ?
Arkarr is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 03-22-2017 , 01:34   Re: Ignore color input
Reply With Quote #13

Quote:
Originally Posted by Timocop View Post
Regex whitelist version (tested):
PHP Code:
public Action OnChatMessage(&authorHandle recipientschar[] namechar[] message)
{
    if(
inQuizz)
    {
        
char filteredMessage[256];
        
strcopy(filteredMessagesizeof filteredMessagemessage);
        
        
Regex regex = new Regex("[\\-\\d]+");        //Positive/Negative number
//        Regex regex = new Regex("[\\d]+");            //Positive number
//        Regex regex = new Regex("[\\-\\d\\.]+");    //Positive/Negative number/float
        
if(regex.Match(filteredMessage) > 0)
        {
            
regex.GetSubString(0filteredMessagesizeof filteredMessage);
            if(
ProcessSolution(authorStringToInt(filteredMessage)))
                
SendEndQuestion(author);            
        }
        
delete regex;
    }

Thank you Timo and everyone else, this worked well! I also took Chaosxk's advice:

Quote:
Originally Posted by Chaosxk View Post
Just need to change Handle pack = CreateDataPack(); to Handle pack;
and don't need to delete the datapack since it's automatically closes.
Works great! Thank you all, again!
__________________

Last edited by sneaK; 03-22-2017 at 01:34.
sneaK is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:24.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode