Jump to content
  • 0

Python Help !!! ToP Online Script


Question

Posted

Hello Guys exw ena ''Top Online Players'' Npc....alla vlepw to onlimetime twn paixtwn se seconds...

 

thelw an to allaksw se wres...

 

ti prepei na prosthesw ston kodika?

 

Edw ein o kodikos...

	# **************
	# * Top onlinetime *
	# **************

	if event == "1" and check_money >= 7000 :
		st.takeItems(Money_ID,7000)
		total_asesinados = 0
		htmltext_ini = "<html><head><title>Top Online Players</title></head><body><table width=300><tr><td><font color =\"63B2FF\">N°</td><td><center><font color =\"FFFF00\">.:: Player ::.</color></center></td><td><center>.:: Time ::.</center></td></tr>"
		htmltext_info =""			
		color = 1
		pos = 0
		con = L2DatabaseFactory.getInstance().getConnection()
		pks = con.prepareStatement("SELECT char_name,onlinetime FROM characters WHERE onlinetime>0 order by onlinetime desc limit 20")
		rs = pks.executeQuery()
		while (rs.next()) :
               min_con = 60
		    char_name = rs.getString("char_name")
			char_onlinetime = rs.getString("onlinetime") / int(min_con) 
			total_asesinados = total_asesinados + int(char_onlinetime)
			pos = pos + 1
			posstr = str(pos)
			if color == 1:
				color_text = "<font color =\"00FFFF\">"
				color = 2
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"63B2FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_onlinetime + "</center></td></tr>"
			elif color == 2:
				color_text = "<font color =\"C00000\">"
				color = 1
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"63B2FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_onlinetime + "</center></td></tr>"
		htmltext_end = "</table><center><font color=\"FFFFFF\">" + "Total: " + str(total_asesinados) + " Hours.</center></body></html>"
		htmltext_onlinetime = htmltext_ini + htmltext_info + htmltext_end
		con.close()
		return htmltext_onlinetime
	elif event == "1" and check_money < 7000 :
		htmltext = "<html><head><title>Top Online Players</title></head><body><font color =\"FF0000\">Sorry but you need to pay a small fee (7k adena) in order to see the list.<br>Get 7000 adena and come again.</body></html>"
		return htmltext

 

 

ty..gia to xrono sas

3 answers to this question

Recommended Posts

  • 0
Posted

Δοκιμασε να το κανεις ετσι:

 

	# **************
	# * Top onlinetime *
	# **************

	if event == "1" and check_money >= 7000 :
		st.takeItems(Money_ID,7000)
		total_asesinados = 0
		htmltext_ini = "<html><head><title>Top Online Players</title></head><body><table width=300><tr><td><font color =\"63B2FF\">N°</td><td><center><font color =\"FFFF00\">.:: Player ::.</color></center></td><td><center>.:: Time ::.</center></td></tr>"
		htmltext_info =""			
		color = 1
		pos = 0
		con = L2DatabaseFactory.getInstance().getConnection()
		pks = con.prepareStatement("SELECT char_name,onlinetime FROM characters WHERE onlinetime>0 order by onlinetime desc limit 20")
		rs = pks.executeQuery()
		while (rs.next()) :
             #   min_con = 60
		    char_name = rs.getString("char_name")
			char_onlinetime = rs.getString("onlinetime") / 60
#int(min_con) 
			total_asesinados = total_asesinados + int(char_onlinetime)
			pos = pos + 1
			posstr = str(pos)
			if color == 1:
				color_text = "<font color =\"00FFFF\">"
				color = 2
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"63B2FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_onlinetime + "</center></td></tr>"
			elif color == 2:
				color_text = "<font color =\"C00000\">"
				color = 1
				htmltext_info = htmltext_info + "<tr><td><center><font color =\"63B2FF\">" + posstr + "</td><td><center>" + color_text + char_name +"</center></td><td><center>" + char_onlinetime + "</center></td></tr>"
		htmltext_end = "</table><center><font color=\"FFFFFF\">" + "Total: " + str(total_asesinados) + " Hours.</center></body></html>"
		htmltext_onlinetime = htmltext_ini + htmltext_info + htmltext_end
		con.close()
		return htmltext_onlinetime
	elif event == "1" and check_money < 7000 :
		htmltext = "<html><head><title>Top Online Players</title></head><body><font color =\"FF0000\">Sorry but you need to pay a small fee (7k adena) in order to see the list.<br>Get 7000 adena and come again.</body></html>"
		return htmltext

 

Παιζει να φταιει το οτι εχει κανει redefinition στο min_con γραφοντας int(min_cont)

Δοκιμασε να το κανεις ετσι. Προγραμματιστης σπουδαζω αλλα δυστυχως δεν ειμαι σιγουρος για το αν θα δουλεψει η οχι.

Υ.Γ.

Ειναι κωδικας και οχι κωδικος :D

  • 0
Posted

Βασικα για να γνωριζουμε, το αποτελεσμα που βλεπετε δεν ειναι σε secs αλλα σε mSecs...

 

Αυτο ειναι χρονισμος χρονικού προσδιορισμού της μηχανής, σε milisecs δηλαδή:

 

1000 = 1 sec ή 60000 = 1 λεπτό, και ισχυει για ολους τους χρονισμούς στο game, πχ siege, restart κλπ.

μετα ισχυουν όλα οπως τα ξερουμε, δηλαδή 60 sec = 1 λεπτό, 60 λεπτά = 1 ωρα.

Αν εχετε pack με προσδιορισμό sec απλα αντι 60000 χρησιμοποιήστε τοτε 60.

 

Εστω οτι εχουμε την 'onlinetime' = 10 000 000

 

mins = onlinetime/60000    γίνεται σε mins, δηλ. 166,66666

hours = mins/60  γίνεται σε hours, δηλ. 2,77777

 

ακεραιο του hours = 2 ωρες

υπολοιπονται λεπτα  = mins - (hours * 60) δηλαδή 166,666 - ( 2 * 60) = 46,66  ακεραιο του mins = 46 λεπτα

Συνεπως το  online time = 2:46 ή αν θελετε 2h 46m

 

Αν θελετε και σε μερες τοτε προσθεστε σε java ή c++

        if (hours == 24) { day += 1; hours =0;}

 

ή σε python

        if hours == 24:  

                day = day + 1

                hours =0

 

οπου 'day' ειναι οι μερες και οι ωρες σε καθε ανανεωση μερας μηδενιζονται.

 

 

 

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


  • Posts

    • First, you need to understand what you're doing and what you want to achieve. You have to choose a server core. After that, decide what you want your server to include, code it, modify the client to fit your server, go public, and drink champagne.   If you know how to code, creating a server is relatively easy — a few months of work and you can make it happen. Modifying the client is a completely different story. There’s a lack of tutorials, tools, and source materials. I’m currently working on the client myself, and I’ve already spent over three weeks just trying to get started due to the lack of information. If you don’t have the knowledge and experience, you’ll need a team and a bag of money — but realistically, it just won’t succeed.
    • The server has been online and stable for over 2 months now, and we’re still going strong! No wipes, no shortcuts ~ just continuous work, daily fixes, events, and improvements to ensure the best possible experience.   Great News! 🔥 CHAPTER II IS COMING — GRACIA FINAL 🔥 On February 16, L2Elixir enters a new era. The server will be officially updated to Gracia Final, opening Chapter II of our journey. Expect new content, improvements, and surprises that will refresh the gameplay while keeping the classic Gracia Final spirit alive.   More challenges, more competition, and more reasons to log in.   📅 Update Date: February 16 ⚔️ Chapter II: Gracia Final This is not a reset. This is evolution.   Prepare yourselves — Chapter II begins soon.   Website: https://l2elixir.org/ Discord: https://discord.gg/5ydPHvhbxs    
    • Server owners, Top.MaxCheaters.com is now live and accepting Lineage 2 server listings. There is no voting, no rankings manipulation, and no paid advantages. Visibility is clean and equal, and early listings naturally appear at the top while the platform grows. If your server is active, it should already be listed. Submit here 👉https://Top.MaxCheaters.com This platform is part of the MaxCheaters.com network and is being built as a long-term reference point for the Lineage 2 community. — MaxCheaters.com Team
    • Hello! We are Genesis, small team that works on new Lineage 2 project. Our goal with this project is to create a fresh new place to play — built around real community feedback, with no aggressive pay-to-win donations and with carefully thought-out quality-of-life improvements, balance changes etc. We believe that even tho we all love this game, everyone has at least one or two things they would like to change in the game to make it more enjoyable. Thats why we want the comunity feedback to shape our server. Main information about the server: • Interlude Classic version • Rates: EXP x4 SP x2 Loot x2, Spoil x2 (not set in stone, might be changed) • Local & Server-Side Dualbox Protection • Complete, Clear Website with Integrated Account Panel (Game account creation, direct communication with support, bug reporting, voting and reward system) • Launcher – External Game Login System: manage all your accounts inside the launcher, “Play” button logs you directly into the game server Here are list of few changes we already added/decided to add to the server: • Reworked Client to fit interlude Era with upgraded Classic Ui • Custom Antibot system • Custom AntiDualBox System • Offline shops • Offline shop with buffs (available only in towns) • Mass Sweeper added to the game • Newbie buffs available all the way to lvl 76 (nothing crazy, but its free) • Slight balance change to Destroyer damage with Polearm and Cancel spell from SPS • PvP zones on every Epic spawn spot • Overbuffing blocked • And more! Since we put big focus on community feedback and suggestions, we are looking for people for our internal tests, that will discuss whether current changes „fit” into the game and maybe suggest some changes themselves. If what you’ve just read sounds interesting to you, if you want to help creating server fitted for you, join our server Discord. Help us to understand what Lineage 2 players in 2026 actually expect and need — so we can meet those expectations and avoid becoming just another server that dies a natural death.     Even if you’re not interested in playing right now, but you are a long-time Lineage 2 player, feel free to join our community. We would greatly appreciate your experience and feedback to help us improve and develop our project. Join the growing L2Genesis community: https://discord.gg/mcuHsQzNCm Also check our website: https://l2genesis.com/
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and 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..