gettime() problem
#1

hey everybody i have a problem i make a date checker but i have a problem i wrote the script like this

Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/test", cmdtext, true, 10) == 0)
	{
		new date1;
		new Year, Month, Day;
		new date2;
		date1 = 29/12/2014;
		date2 = getdate(Year, Month, Day);
		printf("%02d/%02d/%d", Day, Month, Year);
		if(date2 == date1) //then is date1 older .
		ShowPlayerDialog(playerid, DIALOG_WELCOME, DIALOG_STYLE_MSGBOX, "Notice", "You connected to the server", "Close", "");
		return 1;
	}
	return 0;
}
then if i type the command in the game the command doesnt work
that script for check the older date(old date) with current date(now)

help plss

sorry for my bad english
Reply
#2

What you trying to do? to get new date?
Reply
#3

hehe i want to check if date 29/12/2014 is older than current date(new date)
Reply
#4

I never tried this

but try this :

pawn Код:
if(date2 < date1)
Reply
#5

-_- not working
Reply
#6

This will never work. Create two strings, format them and then use strcmp.
Reply
#7

PHP код:
getdate(YearMonthDay);
if(
Month == 12 && Year == 2014 && Day <=29)
{
//Day is less than/equal to 29.
}
else
{
//Day is Greater than 29

Read https://sampwiki.blast.hk/wiki/Getdate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)