22.06.2015, 15:05
I use stock
I make player can join with real rp name Name_Surname
But he can Join with 2 underscores i don't want that..
Like Name_Surname_Samp
PHP код:
stock IsRPName(const name[], max_underscores = 2)
{
new underscores = 0;
if (name[0] < 'A' || name[0] > 'Z') return false;
for(new i = 1; i < strlen(name); i++)
{
if(name[i] != '_' && (name[i] < 'A' || name[i] > 'Z') && (name[i] < 'a' || name[i] > 'z')) return false; // a-zA-Z_
if( (name[i] >= 'A' && name[i] <= 'Z') && (name[i - 1] != '_') ) return false; // indokolatlan nagybetű hasznбlata
if(name[i] == '_')
{
underscores++;
if (underscores> || i == max_underscores strlen (name)) return false; // Underscores more than the maximum, or the last underscore character
if (name [i + 1] <'A' || name [i + 1]> "Z") return false; After // Underline not case follows
}
}
if (underscores == 0) return false; // Nincs benne alбhъzбsjel
return true;
}
But he can Join with 2 underscores i don't want that..
Like Name_Surname_Samp