Name_Surname ? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Name_Surname ? (
/showthread.php?tid=185685)
Name_Surname ? -
ExEx - 25.10.2010
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 !!
Re: Name_Surname ? -
introzen - 25.10.2010
Search please
Re: Name_Surname ? -
ExEx - 25.10.2010
i searched , i not found nothing !
Re: Name_Surname ? -
Zezombia - 25.10.2010
Edit: Nvm, let me rephrase that.
Re: Name_Surname ? -
ExEx - 25.10.2010
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 !
Re: Name_Surname ? -
Scripter123 - 25.10.2010
Dude search in other GM'S!
Re: Name_Surname ? -
Jefff - 25.10.2010
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);
}
Re: Name_Surname ? -
ExEx - 25.10.2010
THANKS Jefff
you rock bro xD
Re: Name_Surname ? -
Zezombia - 25.10.2010
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.
Re: Name_Surname ? -
randomkid88 - 25.10.2010
Shouldn't this work to make sure its not at the end?
pawn Код:
if(Nick[d] == '_' && d<strlen(Nick))
{
//rest
}
?