SA-MP Forums Archive
Is it possible to allow only letters/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: Is it possible to allow only letters/numbers? (/showthread.php?tid=548944)



Is it possible to allow only letters/numbers? - LocMax - 03.12.2014

So, I need some kind of function which would forbid usage of any symbols or so, so basically only numbers and letters can be used.
How can I do it? like do I need to list all symbols or?


Re: Is it possible to allow only letters/numbers? - Kyance - 03.12.2014

Quote:
Originally Posted by LocMax
Посмотреть сообщение
So, I need some kind of function which would forbid usage of any symbols or so, so basically only numbers and letters can be used.
How can I do it? like do I need to list all symbols or?
pawn Код:
stock IsValidPassword( const password[ ] )
{
    for( new i = 0; password[ i ] != EOS; ++i )
    {
        switch( password[ i ] )
        {
            case '0'..'9', 'A'..'Z', 'a'..'z': continue;
            default: return 0;
        }
    }
    return 1;
}
I don't remember from who I got this, but yeah.. not made by me xd


Respuesta: Is it possible to allow only letters/numbers? - LocMax - 03.12.2014

Thank you dear Kyance.