Jump to content

Recommended Posts

In root/uiMinimap.py:

Spoiler

If you don't have, add to the imports:


import time

 

Search:


def __Initialize(self):

Add under:


self.localTime = 0

 

Search:


self.serverInfo = self.GetChild("ServerInfo")

Add under:


self.localTime = self.GetChild("localTime")

 

Search:


if constInfo.MINIMAP_POSITIONINFO_ENABLE==0:

Add under:


self.localTime.Hide()

 

Search :


if self.tooltipInfo:

Add under:


self.localTime.SetText(time.strftime("|[%H:%M:%S]"))

 

 

Then  uiScript/minimap.py:

Spoiler

Search:


				## ServerInfo
				{
					"name" : "ServerInfo",
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 140,

					"text" : "",
				},

Add under:


				## Local Time
				{
					"name" : "localTime",
					"type" : "text",
					
					"text_horizontal_align" : "center",

					"outline" : 1,

					"x" : 70,
					"y" : 155,

					"text" : "",
				},

 

 

PS: Btw this will show your local time that has been set in your windows and not your server time. Care with tabs.

  • Good 1
Link to comment
Share on other sites

  • Forum Moderator
42 minutes ago, ManiacRobert said:

I think it's needed to send via packet or cmdchat get_global_time() from server-side

Already app.GetGlobalTimeStamp() (#1 #2) doing that, returns the server timestamp (sent by TPacketGCTime to client) on each enter in game, you just need to convert the timestamp with a proper method.

cur_time_stamp = app.GetGlobalTimeStamp()
seconds = cur_time_stamp % 60
minutes = (cur_time_stamp / 60) % 60
hours = (cur_time_stamp / 60) / 60 % 24

self.textLine.SetText("%02i:%02i:%02i" % (hours, minutes, seconds))
Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 1
  • Good 1
  • Love 7
Link to comment
Share on other sites

18 hours ago, VegaS™ said:

Already app.GetGlobalTimeStamp() (#1 #2) doing that, returns the server timestamp (sent by TPacketGCTime to client) on each enter in game, you just need to convert the timestamp with a proper method.


cur_time_stamp = app.GetGlobalTimeStamp()
seconds = cur_time_stamp % 60
minutes = (cur_time_stamp / 60) % 60
hours = (cur_time_stamp / 60) / 60 % 24

self.textLine.SetText("%02i:%02i:%02i" % (hours, minutes, seconds))

1- i did the same tut and it worked but i got different time than the server time ( i didn't got convert timestamp part ) https://metin2.download/picture/oXfWUB5C9wevlT25N5JmykeBeTL0Ba6I/.png
2- how to make the time format 12 h with am and pm

@VegaS™

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Forum Moderator
On 10/12/2019 at 10:04 PM, ALmutiri said:

2- how to make the time format 12 h with am and pm
@VegaS™

  • Metin2 Dev 1
  • Good 2
  • Love 3
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.