SA-MP Forums Archive
Is it possible to make a command by time? - 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: Is it possible to make a command by time? (/showthread.php?tid=526498)



Is it possible to make a command by time? - ben4uka - 17.07.2014

Hi,
I mean is it possible to do a command that will work only between 21:00 to 8:00?
i tried that:
Код:
if(!strcmp(cmd, "/test1", true))
	{
	    new time[3];
	    gettime(time[0], time[1], time[2]);
	    if(time[0] > 21 && time[0] < 8)
	    {
	        SendClientMessage(playerid, red, "Works.");
		}
	    return 1;
	}
But this seems to not work.

Any help?


Re: Is it possible to make a command by time? - ryansheilds - 17.07.2014

Sir maybe try:

Код:
if((time[0] >= 21 && time[0] <= 24) || (time[0] >= 0 && time[0] <= 8))
(:


Re: Is it possible to make a command by time? - ben4uka - 17.07.2014

Quote:
Originally Posted by ryansheilds
Посмотреть сообщение
Sir maybe try:

Код:
if((time[0] >= 21 && time[0] <= 24) || (time[0] >= 0 && time[0] <= 8))
(:
THANK YOU <3


Re: Is it possible to make a command by time? - SupaVZ - 17.07.2014

why dont you use zcmd..? more better and faster


Re: Is it possible to make a command by time? - erminpr0 - 17.07.2014

Quote:
Originally Posted by SupaVZ
Посмотреть сообщение
why dont you use zcmd..? more better and faster
strcmp does better in this case, there is no command params