Jump to content

Calculating time


villr

Recommended Posts

Posted

The thing that im trying to do and what im gonna have it to is like this, it will be a bot that says like, it was 1day and 3 hours since you last visited here. or it was 5 hours since you last visited here

I have some code i tested but i wasent even sure what i was doing but here it is..

TD2 = tonumber(20130615) 
OD2 = tonumber(20130610) 
hDays = (TD2-OD2) 
totH = hDays*24 
curH = totH/h 
outputChatBox(hDays.." days, "..curH.." hours  "..(totH).." total hours") 

Anyone know how to do it?

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted

I don't really understand what ur doing there, is this your whole code?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That was just some test code...

But what i want is to calculate how many days and hours it has passed since the player last entered. But i have no idea about how i'll should calculate it.

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted

You can try with

getTickCount 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

What i meant with my post was, im going to have an thing in Area51 that will say when you enter, it was 5hours since you last visited here, or, it was 1 day and 5 hours since you last visited here.

The time will be calculated from a data that has been saved as example 2013 06 14 22 10 but im not sure how i should calculate this, i only know how to calculate the days and total hours

Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS!

Scripted since summer 2010 :)

Posted

Store the tick count from when you last visted somewhere, then make a math to calculate how long it passed since last visit.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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...