SA-MP Forums Archive
gettime() problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: gettime() problem (/showthread.php?tid=553327)



gettime() problem - semara456 - 29.12.2014

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


Re: gettime() problem - UltraScripter - 29.12.2014

What you trying to do? to get new date?


Re: gettime() problem - semara456 - 29.12.2014

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


Re: gettime() problem - UltraScripter - 29.12.2014

I never tried this

but try this :

pawn Код:
if(date2 < date1)



Re: gettime() problem - semara456 - 29.12.2014

-_- not working


Re: gettime() problem - dominik523 - 29.12.2014

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


Re: gettime() problem - Mic_H - 29.12.2014

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