Rp Names
#2

Код:
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 name[MAX_PLAYER_NAME], first[MAX_PLAYER_NAME], last[MAX_PLAYER_NAME], ret;
	GetPlayerName(playerid,name,sizeof(name));
	if(RPName(name,first,last))
	{
		// Valid name, player is called first_last
	} else {
	  // Invalid name, deal accordingly
	}
	return 1;
}
Reply


Messages In This Thread
Rp Names - by MechaTech - 19.05.2012, 12:59
Re: Rp Names - by TuTh - 19.05.2012, 13:03
Re: Rp Names - by MechaTech - 19.05.2012, 13:06
Re: Rp Names - by Admigo - 19.05.2012, 13:14
Re: Rp Names - by MechaTech - 19.05.2012, 13:19
Re: Rp Names - by Admigo - 19.05.2012, 13:32
Re: Rp Names - by MechaTech - 19.05.2012, 13:35
Re: Rp Names - by Admigo - 19.05.2012, 13:44
Re: Rp Names - by MechaTech - 19.05.2012, 13:50

Forum Jump:


Users browsing this thread: 1 Guest(s)