07.02.2011, 10:03
(
Последний раз редактировалось iMonk3y; 07.02.2011 в 15:42.
)
pawn Код:
new day, hour, minute, second;
CountdownUntilNextMonth( day, hour, minute, second )
printf( "Countdown till next month: %d days %d hours %02d minutes and %02d seconds left", day, hour, minute, second );
pawn Код:
//Returns days-, hours-, minutes-, & seconds left until next month
stock CountdownUntilNextMonth( &day, &hour, &minute, &second )
{
new year, month, days;
getdate( year, month, day );
gettime( hour, minute, second );
//Fused this function with Ryder's GetDaysInMonth function, so the code you see below till dashed lines is Ryder's code
switch( month )
{
case 1, 3, 5, 7, 8, 10, 12: days = 31;
case 4, 6, 9, 11: days = 30;
case 2: days = ( ( (!( year % 4 ) && ( year % 100 ) != 0 ) ) || !( year % 400 ) ) ? ( 29 ) : ( 28 );
}
//<-----------------------------------------------------By Ryder----------------------------------------------------->
day = days-1 - day; hour = 23 - hour; minute = 59 - minute; second = 59 - second;
}