gettime function
#1

Hello,

I have a litte question about gettime function.

Код:
new hour, minute, second;
gettime(hour, minute, second);
if(hour >= 03)
{
//some code
}
So simply i want: hour 03 AM (morning), but in script it is wrong
Reply
#2

----up
Reply
#3

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
Hello,

I have a litte question about gettime function.

Код:
new hour, minute, second;
gettime(hour, minute, second);
if(hour >= 03)
{
//some code
}
So simply i want: hour 03 AM (morning), but in script it is wrong
//EDIT:misunderstood something.

so, where's your problem?
you have what you want, if hours equals 3 (or greater than 3), it's 3am in the morning.
you can just do your stuff in that control structure.

btw. if you were to put some code generating some message like "hello! it's 3 am!"
with the current condition in that control structure, it would still say that it's3 am in the morning even if it's 9 pm :P
something like
Код:
if(hour == 3)
would be better for things like that.
ah, well, you could also do a nice switch, if you want multiple messages displaying at certain times of the day
Reply
#4

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
Hello,

I have a litte question about gettime function.

Код:
new hour, minute, second;
gettime(hour, minute, second);
if(hour >= 03)
{
//some code
}
So simply i want: hour 03 AM (morning), but in script it is wrong
You said that you have a question but I don't see any questions in your post..
Reply
#5

thanks for your reply, but i got it working... it must be:

Код:
new hour, minute, second;
gettime(hour, minute, second);
if(hour >= 03 && hour <= 05) //This is the fix.. so its only between 3-5 AM, if it was only the 3AM it will be persist till next day 3AM
{
//some code
}
Reply
#6

Quote:
Originally Posted by Jacapo
Посмотреть сообщение
thanks for your reply, but i got it working... it must be:

Код:
new hour, minute, second;
gettime(hour, minute, second);
if(hour >= 03 && hour <= 05) //This is the fix.. so its only between 3-5 AM, if it was only the 3AM it will be persist till next day 3AM
{
//some code
}
Use your head before posting next time.
Reply
#7

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Use your head before posting next time.
As you say.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)