[HELP] Invalid username - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Invalid username (
/showthread.php?tid=187639)
[HELP] Invalid username -
viKKmaN - 03.11.2010
Hy, when a player connects to my server, i run a query to see if his name is in the database, but for some time, a player keeps coming with invalid characters in his name and crashes the server.
Can anyone please provide a piece of code that will check if player has only [a-z][A-Z][0-9] characters in his name?
Re: [HELP] Invalid username -
bigcomfycouch - 03.11.2010
Might work, did not test:
pawn Код:
stock IsValidUsername(const string[])
{
for (new i, s = strlen(string); i < s; ++i)
{
if ((string[i] < 48) || (string[i] > 57 && string[i] < 65) || (string[i] > 90 && string[i] < 97 && string[i] != 95) || (string[i] > 122)) return 0;
}
return 1;
}
Re: [HELP] Invalid username -
viKKmaN - 03.11.2010
Works like a charm, thx.