Skip to content

Record Online Players Code

Featured Replies

Hey guys i would like to ask if anyone has a code so we can record MOST PLAYERS online ever on server.. i am using acis latest version and i want to put it on a info window when ur char logs but i dont have the code.. can anyone help me"?

  • Author

its ok some1 pmed me with the code :) thnx for the help.. lock plz

If the code isn't private/protected/whatever, you could post it here or create a Shares topic and point the link on that topic. It would eventually help others people who also search that feature.

 

Ask to the code owner first, or ask the code owner to make it himself if he agrees.

int maxOnlinePrev;

@Override

public void run()

{

      Connection con = L2DatabaseFactory.getInstance().getConnection();

      PreparedStatement statement = con.prepareStatement("SELECT online FROM maxOnlineTable");
      ResultSet rset = statement.executeQuery();
      maxOnlinePrev = rset.getInt("online");
      statement.close();
      rset.close();
      if (maxOnlinePrev < L2World.getInstance().getAllPlayers().size)
              con.createStatement().executeUpdate("UPDATE maxOnlineTable SET online ="+ L2World.getInstance().getAllPlayers().size);
      con.close()

}

 

handwritten, there are possible mistakes, but this is the basic structure... You could work with your RAM too to avoid db connections in tasks but that demands edits on GS.java and shutdown.java so I avoided it

Edited by xdem

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.