Jump to content

getTime problem


SycroX

Recommended Posts

i have a problem with function getTime .. i want to get the night time and the night time is starting in 20 and end in 6

when i cheak if the time between 20 and 6 i dosen't work , no debugs nothing

but if i cheak if time between 20 and 23 it's work why ?
 

			local h, m = getTime()
			if tonumber(h) >= 20 and tonumber(h) < 6 then

 

Edited by #Skrillex
Link to comment

Well this is quite logically. You're looking for your if-statement to be true. But it'll never be.

Example you're number is 5. Then you are indeed below 6. But you aren't above or at 20.

There is no existing number that's bigger than 20 but ALSO smaller than six. I do understand that you were thinking in hours instead of numbers.

Change the and with an or

if tonumber(h) >= 20 or tonumber(h) < 6 then

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...