Firstname_Lastname?
#1

Hello Again.

As the title says, how can I script like when a player enters the server with a name like "FreddeN" he gets kicked, but if a player joins with "Frederik_Nielsen" he may play.

Thanks!
Reply
#2

Speaking of Which Seif_ lol....

I just found one of your codes.

Here's one made by Seif_ earlier:

Quote:
Originally Posted by Seif_
pawn Код:
stock IsValidName(playerid)
{
  if (IsPlayerConnected(playerid))
  {
    new player[24];
    GetPlayerName(playerid,player,24);
    for(new n = 0; n < strlen(player); n++)
    {
        if (player[n] == '_') return 1;
        if (player[n] == ']' || player[n] == '[') return 0;
    }
  }
  return 0;
}
Example:

pawn Код:
public OnPlayerConnect(playerid)
{
  if (!IsValidName(playerid))
  {
    SendClientMessage(playerid, RED, " Your name is invalid. Your name must be a role play-ish one. Example: Michael_Taylor"
    Kick(playerid);
  }
  return 1;
}
Search is disabled.
Reply
#3

Put this under "OnPlayerConnect"
pawn Код:
new namestring = strfind(plname, "_", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, COLOR_RED, "Hint: Your name must be in the format Firstname_Lastname.");
        Kick(playerid);
        return 1;
    }
oh and change that COLOR_RED to a color you already Defined in the beginning if this one is not defined
Reply
#4

Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
use fukin ****** then...

http://www.******.com/cse/home?cx=01...69:munac565hug
Reply
#5

Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
use fukin ****** then...

http://www.******.com/cse/home?cx=01...69:munac565hug
I dont think he knows that is even possible. Thats why i searched for him.
Reply
#6

Quote:
Originally Posted by [B2K
Hustler ]
Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
use fukin ****** then...

http://www.******.com/cse/home?cx=01...69:munac565hug
I dont think he knows that is even possible. Thats why i searched for him.
well then give him the solution X_X
like "hey dude i give u this but i tell u that the search is disabled but i don't tell u where i got it"
makes sense....
Reply
#7

Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
use fukin ****** then...

http://www.******.com/cse/home?cx=01...69:munac565hug
I dont think he knows that is even possible. Thats why i searched for him.
well then give him the solution X_X
like "hey dude i give u this but i tell u that the search is disabled but i don't tell u where i got it"
makes sense....
The solution was given, i said the search is disabled thats why he probably couldnt search and where it is from is contained within the link from the quote from Seif_. I dont see what is the problem. Exactly as you just said.
Reply
#8

Quote:
Originally Posted by [B2K
Hustler ]
Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Quote:
Originally Posted by ┤ŞąiBЄЯҒПŋ├
Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
use fukin ****** then...

http://www.******.com/cse/home?cx=01...69:munac565hug
I dont think he knows that is even possible. Thats why i searched for him.
well then give him the solution X_X
like "hey dude i give u this but i tell u that the search is disabled but i don't tell u where i got it"
makes sense....
The solution was given, i said the search is disabled thats why he probably couldnt search and where it is from is contained within the link from the quote from Seif_. I dont see what is the problem. Exactly as you just said.
that u didn't give the soution to:
Quote:
Originally Posted by [B2K
Hustler ]
Search is disabled.
Reply
#9

I made one more advanced all-in-one checker. It detects all characters which roleplay name shouldn't have, make sure name has only one '_' in it and it also properly capitalizes name.

pawn Код:
forward NameValidator(playerid);
public NameValidator(playerid)
{
    if(IsPlayerConnected(playerid))
    {
      new pname[MAX_PLAYER_NAME],underline=0;
      GetPlayerName(playerid, pname, sizeof(pname));
      if(strfind(pname,"[",true) != (-1)) return 0;
      else if(strfind(pname,"]",true) != (-1)) return 0;
      else if(strfind(pname,"$",true) != (-1)) return 0;
      else if(strfind(pname,"(",true) != (-1)) return 0;
      else if(strfind(pname,")",true) != (-1)) return 0;
      else if(strfind(pname,"=",true) != (-1)) return 0;
      else if(strfind(pname,"@",true) != (-1)) return 0;
      else if(strfind(pname,"1",true) != (-1)) return 0;
      else if(strfind(pname,"2",true) != (-1)) return 0;
      else if(strfind(pname,"3",true) != (-1)) return 0;
      else if(strfind(pname,"4",true) != (-1)) return 0;
      else if(strfind(pname,"5",true) != (-1)) return 0;
      else if(strfind(pname,"6",true) != (-1)) return 0;
      else if(strfind(pname,"7",true) != (-1)) return 0;
      else if(strfind(pname,"8",true) != (-1)) return 0;
      else if(strfind(pname,"9",true) != (-1)) return 0;
      new maxname = strlen(pname);
      for(new i=0; i<maxname; i++)
      {
        if(pname[i] == '_') underline ++;
      }
      if(underline != 1) return 0;
    pname[0] = toupper(pname[0]);
        for(new x=1; x<maxname; x++)
        {
            if(pname[x] == '_') pname[x+1] = toupper(pname[x+1]);
            else if(pname[x] != '_' && pname[x-1] != '_') pname[x] = tolower(pname[x]);
        }
        SetPlayerName(playerid, "New_Name");
        SetPlayerName(playerid, pname);
        return 1;
    }
    return 0;
}
Reply
#10

Thank you for your answers, it works good!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)