Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Rocky on Apr 16, 2015, 06:20 AM

Title: Function to get minute?
Post by: Rocky on Apr 16, 2015, 06:20 AM
I'm trying to set real life time in the game world. (not completely accurate through).
function SetWorldTime()
{
   SetTimeRate( 60000 );
   SetTime( date()["hour"], date()["minute"] );
}

I've set my time rate at 60000 (60 secs) so the time changes like in real life. Problem is minute doesn't exist in date() only hour does. I've used GetFullTime() and splitted it to get minute and hour out of it.

function getTimefromFunc( hour )
{
   local text = GetFullTime(), time = split( text, "," )[ 3 ], time_table = split(time,":");
   if( hour == true ) return time_table[0]; //returns hour
   else return time_table[1]; //returns minute
}

It works fine but i keep getting this "GetFullTime is depreciated and may be removed in the future." on console each time i use this function. So, is there any alternative function which allow me to get minute?
Title: Re: Function to get minute?
Post by: Gudio on Apr 16, 2015, 07:37 AM
date().hour, date().min
_/
Title: Re: Function to get minute?
Post by: Rocky on Apr 16, 2015, 07:44 AM
Thanks gudio, never knew date() could be used like that. :)