29.12.2012, 05:31
(
Последний раз редактировалось Dragonborn; 29.12.2012 в 06:18.
)
ContainInvalidCharacters
I created this function on any time ago... Good to check and create "normal" passwords and to set player name.
Check if have invalid characters in one string.
An example :
Output :
Enjoy and i hope it is useful !
I created this function on any time ago... Good to check and create "normal" passwords and to set player name.

Check if have invalid characters in one string.

pawn Код:
#define function%0(%1) stock %0(%1)
function ContainInvalidCharacters(string[])
{
// Add more if you need/want. (if you add new characters, you should add the quantity of characters that you put to the variable. ("19"))
new InvalidCharacters[19][] =
{
"&","$","^","?","_",".","*","#","(",")",
"[","]","{","}","=","+","-","!","@"
};
for(new checkloop; checkloop<sizeof(InvalidCharacters); checkloop++)
{
if(strfind(string, InvalidCharacters[checkloop]) != -1) return true;
}
return false;
}
pawn Код:
public OnGameModeInit()
{
new varstring[15] = "mystringwith@";
if(ContainInvalidCharacters(varstring)) return print("- 'varstring' contains invalid characters !");
return 1;
}
Quote:
[04:42:32] Filterscripts [04:42:32] --------------- [04:42:32] Loading filterscript 'gl_actions.amx'... [04:42:32] Loading filterscript 'gl_realtime.amx'... [04:42:32] Loaded 2 filterscripts. [04:42:32] - 'varstring' contains invalid characters ! [04:42:32] Number of vehicle models: 0 |
