SA-MP Forums Archive
Register - 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)
+--- Thread: Register (/showthread.php?tid=438019)



Register - Gundogdu - 18.05.2013

Well, I was trying to test a script and was registering, it asked me if I was male or female, I answered that..
Then it asked:
"When were you born? ( use dd/mm/yyyy )"
I wrote: "01/01/1990" but it said that it was invalid.. And sometimes it doesnt say anything only my timestamp..

Код:
if(RegistrationStep[playerid] > 0)
	{
		if(RegistrationStep[playerid] == 1)
		{
			if (strcmp("male", text, true) == 0)
			{
			    SetPlayerPos(playerid,1830.803,-1731.561,5203.459);
				PlayerInfo[playerid][pSex] = 1;
				SendClientMessageEx(playerid, COLOR_PURPLE, "** Immigration writes your gender on a paper **");
				SendClientMessageEx(playerid, COLOR_WHITE, "[IMMIGRATION] When were you born? (Use dd/mm/yyyy)");
				RegistrationStep[playerid] = 2;
				return 0;
			}
			else if (strcmp("female", text, true) == 0)
			{
			    SetPlayerPos(playerid,1830.803,-1731.561,5203.459);
				PlayerInfo[playerid][pSex] = 2;
				SendClientMessageEx(playerid, COLOR_PURPLE, "** Immigration writes your gender on a paper **");
				SendClientMessageEx(playerid, COLOR_WHITE, "[IMMIGRATION] When were you born? (Use dd/mm/yyyy)");
				RegistrationStep[playerid] = 2;
				return 0;
			}
			else
			{
       			SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
			    SendClientMessageEx(playerid, COLOR_REALRED, "ERROR: You did not type in either 'male' or 'female'");
				SendClientMessageEx(playerid, COLOR_WHITE, "[IMMIGRATION] Are you a male or female?");
				SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
			}
			return 0;
		}
		else if(RegistrationStep[playerid] == 2)
		{
			new year, month,day;
			getdate(year, month, day);
			new DateInfo[3][20];
			splits(text, DateInfo, '/');
			if(year - strval(DateInfo[2]) > 100 || strval(DateInfo[2]) < 1 || strval(DateInfo[2]) >= year)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
			    SendClientMessageEx(playerid, COLOR_REALRED, "ERROR: Fix Your Date of Birth");
				SendClientMessageEx(playerid, COLOR_WHITE, "[IMMIGRATION] When were you born? (Use dd/mm/yyyy)");
				SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
				return 0;
			}
			new check = year - strval(DateInfo[2]);
			if(check == year)
			{
			    SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
			    SendClientMessageEx(playerid, COLOR_REALRED, "ERROR: Wrong Date of Birth Format");
				SendClientMessageEx(playerid, COLOR_WHITE, "[IMMIGRATION] When were you born? (Use dd/mm/yyyy)");
				SendClientMessageEx(playerid, COLOR_LIGHTRED, "____________________________________________________");
				return 0;
			}
			if(strval(DateInfo[1]) > month)
			{
				check -= 1;
			}
			else if(strval(DateInfo[1]) == month && strval(DateInfo[0]) > day)
			{
				check -= 1;
			}
			PlayerInfo[playerid][pAge] = check;
			PlayerInfo[playerid][pOrigin] = 0;
			ClearChatbox(playerid);