[Help]RP-Name checker
#1

Hello!

I need a function what checks the players name if is it RP-Name.

It will allow only this form of name: Bart_Simpson.
It will kick these forms of name: BART_Simpson,Bart_SIMPSON,bart_simpson,Bart_simpso n,BarT_Simpson,...
and: Tracey_McGready ,too.
Reply
#2

Hm, well i don't know about the Bart_SIMPSON stuff. But this MIGHT work

Код:
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];
}
OnPlayerconnect
Код:
	if(RPName(PlayerName(playerid),first,last))
	{
		SendClientMessage(playerid,COLOR_YELLOW,"____________________________________________________");
		SendClientMessage(playerid,COLOR_LIGHTYELLOW2,"                        Immigration:                           ");
		new accstring[128];
		GetPlayerName(playerid, sendername, sizeof(sendername));
		format(accstring, sizeof(accstring), "CRP_Scriptfiles/Accounts/%s.ini", sendername);
		new File: hFile = fopen(accstring, io_read);
		if (hFile)
		{
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:] You are already a citizen, type your password below.");
			fclose(hFile);
		}
		else
		{
			SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[INFO:] You are not a citizen, type your desired password to register.");
		}
		SendClientMessage(playerid,COLOR_YELLOW,"____________________________________________________");
	}
	else
	{
	    KickPlayer(playerid,"System","Invalid Name, Correct Format: Firstname_lastname.");
	}
	return 1;
}
Yes, this was taken directly from Carlito's Roleplay script..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)