How can I do an "if" with "inputtext"?
#1

I need help with a Dialog Box for an age selection.
I need it to check if the "inputtext" is numbers, but how can I make a "if( ..." with inputtext?

Thanks to anyone that helps me.
Reply
#2

Yes with strcmp.

pawn Код:
if(!strcmp(inputtext, "MyTextIwan'tmatch", true)) {
   
}
Edit: If you wan't make sure it's a interger use this.

pawn Код:
new MyAge = strval(inputtext);
if(MyAge >= myvalue) ....
Reply
#3

Search the forums for IsNumeric.
Reply
#4

Quote:
Originally Posted by Carlton
Посмотреть сообщение
Yes with strcmp.

pawn Код:
if(!strcmp(inputtext, "MyTextIwan'tmatch", true)) {
   
}
Thanks alot
Reply
#5

or
pawn Код:
if(strval(inputtext))
{
//Do something if it is the age
} else {
//Do something if it is not
}
or
pawn Код:
if(!strval(inputtext)) return //Do something if it is not the age
Reply
#6

Quote:
Originally Posted by Miikkel
Посмотреть сообщение
Thanks alot
I edited my post.
Reply
#7

I think, he got it.
Reply
#8

Quote:
Originally Posted by DJBluefader
Посмотреть сообщение
I think, he got it.
I only need 1 way

But thanks everyone for helping me.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)