SA-MP Forums Archive
Check if there are only numbers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Check if there are only numbers (/showthread.php?tid=344557)



Check if there are only numbers - Jstylezzz - 21.05.2012

Hi everyone,

Maybe this is a nooby question, but how do i check if a player only typed numbers inside a dialog, and if it is between 18 and 80.

I know this is nooby, but i'm stuck.

Thanks


Re: Check if there are only numbers - ViniBorn - 21.05.2012

Ex
pawn Код:
if(strval(inputtext) > 18 && strval(inputtext) < 80)
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
        if (string[i] > '9' || string[i] < '0') return 0;

    return 1;
}



Re: Check if there are only numbers - Jstylezzz - 21.05.2012

Quote:
Originally Posted by Viniborn
Посмотреть сообщение
Ex
pawn Код:
if(strval(inputtext) > 18 && strval(inputtext) /, 80)
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
        if (string[i] > '9' || string[i] < '0') return 0;

    return 1;
}
Thanks!