how to block certain characters?
#1

Hey so probably I thought to myself, if it's possible to block few written characters, such as "dot (.), ( | ) and {}" for an example, I tried so many way, I don't find any better way to solve it. thanks for help if you do so.
Reply
#2

https://sampwiki.blast.hk/wiki/Strfind
Reply
#3

PHP код:
static const cChars[] = {'.''|''{''}'}; // note: single quotes
new bool:invalid false;
for(new 
istrlen(input); && !invalidi++)
{
    for(new 
csizeof(cChars); c++)
    {
        if(
input[i] == cChars[c])
        {
            
invalid true;
            break;
        }
    }
}
if(
invalid)
{
    
// found invalid characters in input
}
else
{
    
// no invalid chars

You should probably use this as a function if you intend to use it in different places.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)