Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Metin2 > Metin2 Private Server > Metin2 PServer Guides & Strategies
You last visited: Today at 06:39

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Python] Register environment based on server time

Discussion on [Python] Register environment based on server time within the Metin2 PServer Guides & Strategies forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
VegaS ♆'s Avatar
 
elite*gold: 10
Join Date: Jul 2013
Posts: 93
Received Thanks: 416
Lightbulb [Python] Register environment based on server time

Code:
def getModule():
	EnvironmentData = {
	# Explanation:
		# 16 - (16:00:00 - 16:59:59)
		# "d:/ymir work/environment/capedragonhead.msenv" - Environment what will be set on this time.
	# You can add how many environments you want.
	4:	"d:/ymir work/environment/metin2_map_n_flame_dragon_01.msenv",
	8:	"d:/ymir work/environment/mtthunder.msenv",
	12:	"d:/ymir work/environment/bayblacksand.msenv",
	16:	"d:/ymir work/environment/capedragonhead.msenv",
	20:	"d:/ymir work/environment/snowm02.msenv",
	22:	"d:/ymir work/environment/trent02.msenv"
}
	return EnvironmentData # Returns the dict with all items
			
def getHour():
	return ((app.GetGlobalTimeStamp() / 60) / 60 % 24) # Returns the hour from server timestamp (loaded by TPacketGCTime) 

def Main():
	for key, c_pszName in getModule().iteritems():
		if getHour() is key and app.IsExistFile(c_pszName): # Checks if current hour is equal with index from dict EnvironmentData and it checks if environment exists (file .msenv) in pack.
			background.RegisterEnvironmentData(0, c_pszName) # Set the environment
			background.SetEnvironmentData(0)
I didn't tested in client, i just write for one friend long time ago.
You can execute the function in two parts for loaded automatically.
File: root/game.py
On function:
  • def OnUpdate(self): - Check every time hour and inserted environment, you should add a break to stop condition after check is true.
  • def Open(self): - Check on every start the client / teleport - Much better optimization.
VegaS ♆ is offline  
Thanks
7 Users
Reply

Tags
environment, metin2, python, vegas


Similar Threads Similar Threads
[PYTHON] TIME FORMAT (PLAY TIME) SELECT CHARACTER
01/26/2016 - Metin2 PServer Guides & Strategies - 4 Replies
Preview: http://i.imgur.com/j8Qg4gn.pnghttp://i.imgur.com/ XQiTBKl.png http://i.imgur.com/3XChBzZ.pnghttp://i.imgur.com/ B1sGmSe.png Cod: #Exygo's function def timp_frumos(self, minute): #import math # modulul math se presupune a fi deja importat sus
Help with Php-Based Register script from Abrassive ...
04/18/2014 - Shaiya PServer Development - 2 Replies
Hello Guys, i have an Question. Can anyone help me in Teamviewer or so on to install the register script.. ive done everything.. changing the database options like db host etc. and nothing happen.. My root server and my homepage are on different servers and i dont know how to do it that i can create an account... pls need help
SjSRO Register time?
03/15/2009 - SRO Private Server - 16 Replies
I need to now the register time chinese time when the reg page will be open all ppl say 3AM to 9AN but im in Chile so i need the chinese hour please.
[How to Register ECSRO Guide] - Server time out error
11/27/2008 - SRO Private Server - 30 Replies
Guide for people that are geting "Server time out Error" on registration page. Step 1 - go to Proxy80.Info - Anonymously Surf MySpace, Facebook, Bebo and More! Step 2 - enter into address bar, above the banner add http://221.195.40.141:1026/ Step 3 - click Browse Anon Button



All times are GMT +1. The time now is 06:39.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.