10.02.2011, 21:32
pawn Код:
IsValidRPName(rpname[])
{
if(strfind(rpname,"_",true) == -1) { return 0; }
if(strlen(rpname) < 6) { return 0; }
if(strlen(rpname) > 19) { return 0; }
new name1 = strfind(rpname, "The", true);
new name2 = strfind(rpname, "kill", true);
new name3 = strfind(rpname, "__", true);
new name4 = strfind(rpname, "123", true);
new name5 = strfind(rpname, "asd", true);
new name6 = strfind(rpname, "xx", true);
if(name1 != -1 || name2 != -1 || name3 != -1 || name4 != -1 || name5 != -1 || name6 != -1)
{
return 0;
}
new pos;
while(pos <= strlen(rpname))
{
new str[5];
for(new lenght = 0; lenght < 10; lenght++)
{
format(str,sizeof(str),"%d",lenght);
if(strfind(rpname[pos],str,true) != -1)
{
return 0;
}
}
pos++;
}
new part[10][12];
new name,surname;
split(rpname,part,'_');
for(new g = 2; g < 10; g++)
{
if(strlen(part[g]) > 0)
{
return 0;
}
}
new invalid;
for(new i = 0; i < strlen(rpname); i++)
{
if(rpname[i] >= 'A' && rpname[i] <= 'Z')
{
invalid++;
if(invalid > 2)
{
return 0;
}
}
}
if(part[0][0] >= 'A' && part[0][0] <= 'Z')
{
name = 1;
}
if(part[1][0] >= 'A' && part[1][0] <= 'Z')
{
surname = 1;
}
if(name == 1 && surname == 1)
{
return 1;
}
else
{
return 0;
}
}