SA-MP Forums Archive
Detecting 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: Detecting numbers? (/showthread.php?tid=416501)



Detecting numbers? - Jernu - 17.02.2013

I'm making a registration system and I wanted to know how you'd detect if someone entered numbers in the dialog?

Thanks.


AW: Detecting numbers? - Nero_3D - 17.02.2013

Check if the inputtext is numeric with such a function
pawn Код:
stock IsNumeric(const string[]) {
    for(new i = strlen(string); i-- >= 0; ) {
        if(!('0' <= string[i] <= '9')) {
            return false;
        }
    }
    return true;
}



Re: Detecting numbers? - Jernu - 17.02.2013

Thanks!