How do I kick players containing number nicks?
And nicks with weird symbols ( ,,,' ''''' """" )
(https://i.postimg.cc/xdfVjkdD/Untitled.png)
Thanks btw I made this.
Quotelocal nickcheck = ( player.Name.len() < 4 ) || IsNum(player.Name)
if (nickcheck) {
print("nick not allowed");
}
how do i include symbols players like such nick (```` ;;;; '''' ) joined every time
for pure clean names you can use
if(::regexp( @"^[a-zA-Z]+$" ).match( names[i] )){
to avoid any number or symbols. but many of players vcmp are using clan tags [MK] (RT) VU. =TnC= or ending with ^ like SuPer^Sens^, or "4" instead "A" so they wont be able to keep their names
for detectiong only-symbols
local names = ["12345", "1abcd", "::", "_$_!", "abcde", "", " "];
for(local i = 0; i < names.len(); i++){
if(::regexp( @"^[^a-zA-Z]+$" ).match( names[i] )){
::print(names[i] +" has no letters");
} else {
::print(names[i] +" has letters or its empty string");
}
}
[SCRIPT] 12345 has no letters
[SCRIPT] 1abcd has letters or its empty string
[SCRIPT] :: has no letters
[SCRIPT] _$_! has no letters
[SCRIPT] abcde has letters or its empty string
[SCRIPT] has letters or its empty string
[SCRIPT] has no letters
Quote from: Nihongo^ on Jul 24, 2023, 04:21 PMHow do I kick players containing number nicks?
And nicks with weird symbols ( ,,,' ''''' """" )
My Answer: The four characters ( , ), ( ' ), ( " ) and ( ` ) gets replaced by _ when player is connecting to server.
As vito said, some players use 4 for A and so on.
If the name contain more than 4 digits, you can kick him
local c=0;
for(local i=0;i<player.Name.len();i++)
{
if(player.Name[i]>='0'&& player.Name[i]<='9')
c++;
}
if(c>=4)
{
MessagePlayer("Invalid Nick. Connect with proper nick.", player);
if(!rawin("KickById")
KickById<-function(id){ if( FindPlayer( id ) ) FindPlayer( id ).Kick() }
NewTimer( "KickById", 2000, 1, player.ID );
}