Age Calculate
#3

Or you use the getdate function

pawn Код:
stock BirthAge[MAX_PLAYERS];
Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
stock SetPlayerBirthday(playerid, day, month, year) {
    return (BirthAge[playerid] = year * 10000 + month * 100 + day);
}
Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
pawn Код:
stock GetAge(playerid) {
    new
        day,
        year,
        month
    ;
    getdate(year, month, day);
    month = month * 100 + day; // current month and day
    day = BirthAge[playerid] % 10000; // extracts month and day
    year = year - BirthAge[playerid] / 10000; // gets the difference in years
    return (day <= month) ? (year) : (year - 1); // if current date is higher or equal he already had birthday
}
Reply


Messages In This Thread
Age Calculate - by Marco940 - 30.06.2012, 11:23
Re: Age Calculate - by Mauzen - 30.06.2012, 11:31
AW: Age Calculate - by Nero_3D - 30.06.2012, 14:19

Forum Jump:


Users browsing this thread: 1 Guest(s)