[HELP] pm system with anti numbers
#1

Hello, I have a pm system that blocks numbers, but it only blocks numbers 0-9 so if someone comes to my server and puts any number like 34 45 654 23 54 23 it wont block it, here is the code:

stock NoEsNumerico(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0)
|| (string[i]=='1' && i!=0)
|| (string[i]=='2' && i!=0)
|| (string[i]=='3' && i!=0)
|| (string[i]=='4' && i!=0)
|| (string[i]=='5' && i!=0)
|| (string[i]=='6' && i!=0)
|| (string[i]=='7' && i!=0)
|| (string[i]=='8' && i!=0)
|| (string[i]=='9' && i!=0)
|| (string[i]=='0' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}





I have tried adding, || (string[i]==10' && i!=0) but i get this errors :

error 027: invalid character constant
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
warning 217: loose indentation
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

any help would be appreciated!
Reply
#2

Just do this

pawn Код:
for(new i; i<10; i++)
{
    new smallstr[5];
    format(smallstr, sizeof(smallstr), "%d", i);
    if(strfind(string, smallstr) != - 1) return true; //There is numbers
}
return false; //There isn't any numbers
Reply
#3

where do i put that? i just put it at the bottom and it says "format" not defined
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)