Name_Surname ?
#1

How to make when player connect to server to check if hе have a roleplay name

If hе has Name_Surname ok

but if hе has
Name_surname
name_surname
name_Surname
name

kick !!
Reply
#2

Search please
Reply
#3

i searched , i not found nothing !
Reply
#4

Edit: Nvm, let me rephrase that.
Reply
#5

I just found this

new plname[MAX_PLAYER_NAME];
GetPlayerName(playerid, plname, sizeof(plname));
new namestring = strfind(plname, "_", true);
if(namestring == -1)
{
SendClientMessage(playerid, COLOR_RED, "Your name must be in the format Firstname_Lastname.");
Kick(playerid);
return 1;
}


But this kick me when my name is NameSurname or Namexxxxx but not kick me when my name is name_surname

I want only players with Name_Surname join my server !
not name_surname or Name_surname Name_surname !

please !
Reply
#6

Dude search in other GM'S!
Reply
#7

pawn Код:
stock CheckRPName(p)
{
    new Nick[24],pos;
    GetPlayerName(p,Nick,24);
    pos = strlen(Nick);
    for(new d; d < pos; d++)
        if(Nick[d] == '_') {
            pos = d+1;
            break;
        }
    return ((65 <= Nick[0] <= 90) && (65 <= Nick[pos] <= 90)) ? true : false;
}
Connect
pawn Код:
if(!CheckRPName(playerid)) // if name is not Name_Surname
{
//SCM Correct name Firstname_Lastname
Kick(playerid);
}
Reply
#8

THANKS Jefff

you rock bro xD
Reply
#9

Jeff, if someone connects with the name "FirstnameLastname_", it would not kick them.

pawn Код:
stock CheckRPName(p)
{
    new Nick[24],pos;
    GetPlayerName(p,Nick,24);
    pos = strlen(Nick);
    for(new d; d < pos; d++)
        if(Nick[d] == '_') {
            pos = d+1;
            break;
        }
    if(Nick[strlen(Nick) - 1] == '_') return false;
    return ((65 <= Nick[0] <= 90) && (65 <= Nick[pos] <= 90)) ? true : false;
}
Other then that, it's a really nice piece of code :P.
Reply
#10

Shouldn't this work to make sure its not at the end?

pawn Код:
if(Nick[d] == '_' && d<strlen(Nick))
{
 //rest
}
?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)