Bad nick/name (RP name)
#1

How i do .. ?

If anyone come to server nick: jack_kodama and will be kick, it need Jack_Kodama not jack_kodama
and hblddlld will be kick only Name_Lastname

How ?
Reply
#2

I'm not so sure about the capital letters. Though you might want to search for the firstname_lastname. I'm sure its mentioned somewhere.
Reply
#3

[font=courier new] From Carlitos RPG - Developer Norn. Firstname_Lastname
Code:
stock GetPlayerFirstName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[0];
}
stock GetPlayerLastName(playerid)
{
	new namestring[2][MAX_PLAYER_NAME];
	new name[MAX_PLAYER_NAME];
	GetPlayerName(playerid,name,MAX_PLAYER_NAME);
	split(name, namestring, '_');
	return namestring[1];
}

RPName(name[],ret_first[],ret_last[])
{
	new len = strlen(name),
		point = -1,
		bool:done = false;
	for(new i = 0; i < len; i++)
	{
	  if(name[i] == '_')
	  {
	    if(point != -1) return 0;
	    else {
				if(i == 0) return 0;
				point = i + 1;
			}
	  } else if(point == -1) ret_first[i] = name[i];
	  else {
			ret_last[i - point] = name[i];
			done = true;
		}
	}
	if(!done) return 0;
	return 1;
}

public OnPlayerConnect(playerid)
{
new first[MAX_PLAYER_NAME], last[MAX_PLAYER_NAME];
if(RPName(PlayerName(playerid),first,last))
{
SendClientMessage(playerid,COLOR_YELLOW,"Welcome to My server");
}
else
{
KickPlayer(playerid,"System","Invalid Name, Correct Format: Firstname_lastname.");
}
return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)