03.02.2013, 21:37
I've made small code requested by a friend so i said if i can write it here ( PS: i cba to check in all these pages if its already there o.o )
it checks if the current date is between 2 specified dates.
Usage:
Example of using
pawn Код:
stock IsDateBetween(day1, month1, year1, day2, month2, year2)
{
new day, month, year;
getdate(year, month, day);
if((year1 == year2) && (year1 == year))
{
if((month1 == month2) && (month1 == month))
{
if((day1 < day) && (day2 > day)) return 1;
}
else
if((month1 < month) && (month1 > month)) return 1;
}
else
if((year1 < year) && (year2 > year)) return 1;
return 0;
}
Usage:
pawn Код:
IsDateBetween(day1, month1, year1, day2, month2, year2);
pawn Код:
public OnFilterScriptInit()
{
printf("IsDateBetween 02/02/2013 and 08/02/2013 returned: %i", IsDateBetween(2, 2, 2013, 8, 2, 2013));
// as we are in 04/02/2013 now (for me) it will return 1 . after/before the specified date, it will return 0
return 1;
}