Hello xD
#7

Код HTML:
stock const MonthDays[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
stock GetPlayerAge(playerid, input[])
{
    new Date[12];
    strcat(Date, input);

	if(Date[1] == '.')
		strins(Date, "0", 0, 12);

	if(Date[4] == '.')
		strins(Date, "0", 3, 12);

	if(!Date[9] || Date[10])
	{
		ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age:[6-35]", "When were you born? ?\n[DD/MM/YYYY]", "Next", "");
		return -1;
	}
		
    new day = 10*(Date[0]-48)+(Date[1]-48);
    new month = 10*(Date[3]-48)+(Date[4]-48);
    new year = 1000*(Date[6]-48)+100*(Date[7]-48)+10*(Date[8]-48)+(Date[9]-48);
    
    if(year < 1000 || year > 9999 || month < 1 || month > 12 || day < 1)
    {
        ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age:[6-35]", "When were you born? ?\n[DD/MM/YYYY]", "Next", "");
		return -1;
	}

	if(month == 2)
    {
	    if(day > 28 && (year % 4 != 0 || (year % 100 == 0 && year % 400 != 0)))
			return -1;
	}
    else if(day > MonthDays[month-1])
		return -1;

	new d, m, y;
    getdate(y, m, d);

	pInfo[playerid][pAge] = y - year;
	
	if(!strlen(input))
 		return ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age:[6-35]", "When were you born? ?\n[DD/MM/YYYY]", "Next", "");

	
    if(m < month)
		pInfo[playerid][pAge]--;

	else if(m == month && d < day)
		pInfo[playerid][pAge]--;
		
	if(pInfo[playerid][pAge] < 7 || pInfo[playerid][pAge] > 35)
	{
	    ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, "Age: [6-35]", "When were you born? ?\n[DD/MM/YYYY]", "Next", "");
	    return pInfo[playerid][pAge];
 	}
	else return -1;
}
i tried to modify that stock and wont work , anyone want help me - that is over my level of knowledge ...

EDIT: Work perfectly if i put a inputtext like DD/MM/YYYY but , if i put another think that will skip to the next dialog ... what it's needed to add the condition if inputtext is not DD/MM/YYYY to set player dialog again ?!
Reply


Messages In This Thread
Hello xD - by Mariciuc223 - 16.07.2015, 05:45
Re: Hello xD - by X337 - 16.07.2015, 05:47
Re: Hello xD - by Roberto80 - 16.07.2015, 06:37
Re: Hello xD - by thaKing - 16.07.2015, 06:44
AW: Re: Hello xD - by Kaliber - 16.07.2015, 06:55
Re: AW: Re: Hello xD - by thaKing - 16.07.2015, 06:57
Re: Hello xD - by Mariciuc223 - 16.07.2015, 09:24

Forum Jump:


Users browsing this thread: 2 Guest(s)