Vice City: Multiplayer

VC:MP Discussion => General Discussion => Topic started by: Mötley on May 18, 2016, 04:45 AM

Title: :New [Request]
Post by: Mötley on May 18, 2016, 04:45 AM
Could you please consider keeping the code GetFullTime()It's really nice to have. As well as remove the warning in console? If I wanted to use Time()Then I would have In this case NO..
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FRjittIQ.png&hash=587993a663e8b85fb3c9f9f6702160d867ac3b3c)
Title: Re: :New [Request]
Post by: KAKAN on May 18, 2016, 04:49 AM
http://forum.vc-mp.org/?topic=1394.0
Title: Re: :New [Request]
Post by: Mötley on May 18, 2016, 04:54 AM
It's a nice script, But I am limited to an amount of space now so this is where this becomes useful, also super simple, as I had said before if I wanted to use Time()"should of been more specific" In general I would of used it but I am really limited in space so this function is extremely useful in general.
Example:: All that scripting in the Dooms code = to a close version of GetFullTime()
So this is still a request
Title: Re: :New [Request]
Post by: DizzasTeR on May 18, 2016, 08:08 AM
That snippet isn't the best and perhaps use this one as its far more better and you won't get any warnings:

GetFullTime <- function() {
local table = date(), stamp;
local sec = table.sec, min = table.min, hour = table.hour, wday = table.wday, month = table.month, year = table.year;
return stamp = format( "%i:%i:%i %s - %.2d/%.2d/%d ", hour, min, sec, ( hour >= 12 && min >= 00 ? "PM" : "AM" ), table.month+1, table.day, table.year );
}
[SCRIPT]  13:8:36 PM - 05/18/2016
Title: Re: :New [Request]
Post by: Mötley on May 18, 2016, 12:27 PM
That's a Nice code to,.
But does not return what I want for something so short.,
But would be considered if the warning message is not removed so this is still considered a request. I could add my version to this if my request is denied but I prefer to not waste my time with it.

Even in [LU] this exact function has been labeled the same way that it would be removed but nothing further since 2011 I believe, maybe before then.

*So this is still a request.
Title: Re: :New [Request]
Post by: DizzasTeR on May 18, 2016, 01:18 PM
I don't get what you're trying to even achieve, explain what you want the function to return.
Title: Re: :New [Request]
Post by: Mötley on May 18, 2016, 01:34 PM
100% exact as the photo. Space right now is a must, So I feel that the built in function is best as it goes not noticed with a big punch.
If I recall correctly in my notes it can be achieved in scripting, but returning pacific time etc, can be 100% incorrect, and will return the wrong value.
Title: Re: :New [Request]
Post by: Thijn on May 18, 2016, 03:47 PM
You can use date(time(), 'u') to get the date in UTC. You can then do whatever you want with timezones.

GetFullTime will probably be removed since there's no point in having it. You cannot parse it, you cannot modify it, you can only use it as in.
date() is a perfect alternative for that, and is inbuild.
Title: Re: :New [Request]
Post by: Mötley on May 18, 2016, 04:13 PM
Quote from: Thijn on May 18, 2016, 03:47 PMYou can use date(time(), 'u') to get the date in UTC. You can then do whatever you want with timezones.

GetFullTime will probably be removed since there's no point in having it. You cannot parse it, you cannot modify it, you can only use it as in.
date() is a perfect alternative for that, and is inbuild.
I tried your method and It does not work correctly so I will take it as an example. I have no intensions of actually scripting it and or using the code only, as well as having a modifiable version ,,

So this is still a request...,,

Save/player part
HAdd( "HSH_Time", player.Name + " Time", GetFullTime());
login
::Language("English", "You were last active "+Time+"", player, Gray);
::Language("Spanish", "Eras en el ultimo activo "+Time+"", player, Gray);

The hashes.
Motley Time
Wednesday, May 18, 2016, 00:39:59 Pacific Standard Time
Bot Time
Wednesday, May 18, 2016, 00:42:35 Pacific Standard Time
Title: Re: :New [Request]
Post by: Thijn on May 18, 2016, 06:50 PM
I'm not sure what you're trying since you aren't actually posting any code, but this works as expected.
If you're going to save time() instead of a string you can actually do something useful with it later on as well.. (For example: Pick spanish day names and months)

local dayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
local monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];

print(GetFullTime());

local currentDate = date();
print(format("%s, %s %02d, %d, %02d:%02d:%02d %s", dayNames[ currentDate.wday ], monthNames[ currentDate.month ], currentDate.day, currentDate.year, currentDate.hour, currentDate.min, currentDate.sec, "Do we need timezone?"));

local futureDate = date(time() + 3600);
print(format("%s, %s %02d, %d, %02d:%02d:%02d %s", dayNames[ futureDate.wday ], monthNames[ futureDate.month ], futureDate.day, futureDate.year, futureDate.hour, futureDate.min, futureDate.sec, "Do we need timezone?"));
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FXAeRse8.png&hash=f8d7bf1a8ec4077c7c0d427de838b317624d74c9)
Title: Re: :New [Request]
Post by: aXXo on May 18, 2016, 07:14 PM
I figure, if you run time() in a client side script it would return time in user's timezone. Send the returned value to the server and subtract it from the time() on server side. That would yield the user's timezone.

I haven't tried client side scripting yet, so not very certain about this.
Title: Re: :New [Request]
Post by: Mötley on May 18, 2016, 07:20 PM
I like That code because how you said

QuoteIf you're going to save time() instead of a string you can actually do something useful with it later on as well.. (For example: Pick Spanish day names and months)

Did not think on that as I dont speak Spanish so seeing English is native to me and anything else goes  unnoticed


aXXo:
Yes that's possible, as well as running a timer or loop to constantly update the time with Announce();.

Example this could be a replacement for the game time clock In GUI to who knows, I did something similar in [LU]