i got more problems
#1

Ok , i got a problem with :

Код 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 modify it , and work good but can't make a thing work .. When the input is blank or it's not like "DD/MM/YYYY" to show again the Dialog ....

An 3 questions:

1.How to show a GameTextForPlayer(...) for i seconds , i seconds = time that player is in range of point X,Y,Z
2.And how can i hide player map , for exemple when the player looks at tutorial , i want the minimap to be gone and come back when i finish the tutorial .. That's all for now !
3. "16/07/2015" it's a string or a integer ? I think it's string but i wanna hear that from you
Reply
#2

UP , no one !
Reply
#3

UP
Reply
#4

3 Q. ans. is : Yes, it is string
Reply
#5

Quote:
Originally Posted by Mariciuc223
Посмотреть сообщение
An 3 questions:

1.How to show a GameTextForPlayer(...) for i seconds , i seconds = time that player is in range of point X,Y,Z
2.And how can i hide player map , for exemple when the player looks at tutorial , i want the minimap to be gone and come back when i finish the tutorial .. That's all for now !
3. "16/07/2015" it's a string or a integer ? I think it's string but i wanna hear that from you
Ok dude, first...write this function like this if you want DD/MM/YYYY

PHP код:
//Write it at the end of your script
stock const g_days_m[12] = {312831303130313130313031};
stock GetPlayerAge(input[])
{
    new 
date[12];
    
strcat(dateinput);
    if(
date[1] == '/'strins(date"0"012);
    if(
date[4] == '/'strins(date"0"312);
    if(!
date[9] || date[10]) 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 || month 12 || day 1) return -1;
    if(
month == 2)
    {
        if(
day 28 && (year != || (year 100 == && year 400 != 0))) return -1;
    }
    else if(
day g_days_m[month-1]) return -1;
    new 
dmy;
    
getdate(ymd);
    new 
age year;
    if(
monthage--;
    else if(
== month && dayage--;
    return (
age 0) ? (-1) : (age);
}
//Then in dialog response:
new age GetPlayerAge(inputtext);
if(
age == -1) return ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"Age:[6-35]""When were you born? ?\n[DD/MM/YYYY]""Next""");
//Otherwise the age is good :) 
1. Use a timer:

PHP код:
//OnGameModeInit
SetTimer("@checkPlayer",999,0);
//Then outside
@checkPlayer();@checkPlayer() {
    for(new 
i,l=GetPlayerPoolSize()+1i<li++)
    {
        if(!
IsPlayerInRangeOfPoint(i,3.0,x,y,z)) continue; //replace x,y,z with your coords
        
GameTextForPlayer(i, ...);        
    }
    return 
1;

2. You can use a TextDraw that you draw over it

3. Yes it's obviously a string because of the /
Reply
#6

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Ok dude, first...write this function like this if you want DD/MM/YYYY

PHP код:
//Write it at the end of your script
stock const g_days_m[12] = {312831303130313130313031};
stock GetPlayerAge(input[])
{
    new 
date[12];
    
strcat(dateinput);
    if(
date[1] == '/'strins(date"0"012);
    if(
date[4] == '/'strins(date"0"312);
    if(!
date[9] || date[10]) 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 || month 12 || day 1) return -1;
    if(
month == 2)
    {
        if(
day 28 && (year != || (year 100 == && year 400 != 0))) return -1;
    }
    else if(
day g_days_m[month-1]) return -1;
    new 
dmy;
    
getdate(ymd);
    new 
age year;
    if(
monthage--;
    else if(
== month && dayage--;
    return (
age 0) ? (-1) : (age);
}
//Then in dialog response:
new age GetPlayerAge(inputtext);
if(
age == -1) return ShowPlayerDialog(playeridDIALOG_AGEDIALOG_STYLE_INPUT"Age:[6-35]""When were you born? ?\n[DD/MM/YYYY]""Next""");
//Otherwise the age is good :) 
1. Use a timer:

PHP код:
//OnGameModeInit
SetTimer("@checkPlayer",999,0);
//Then outside
@checkPlayer();@checkPlayer() {
    for(new 
i,l=GetPlayerPoolSize()+1i<li++)
    {
        if(!
IsPlayerInRangeOfPoint(i,3.0,x,y,z)) continue; //replace x,y,z with your coords
        
GameTextForPlayer(i, ...);        
    }
    return 
1;

2. You can use a TextDraw that you draw over it

3. Yes it's obviously a string because of the /
I wish i can give you again +rep but that say me a stupid message ..

Solved .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)