Jump to content

Recommended Posts

Posted

Howdy,i'm here to share something today.

I know showing online player count to html page is useless but hey its just an idea :D

Have Fun.

 

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 4652)
+++ java/config/l2jmods.properties	(working copy)
@@ -348,6 +348,9 @@
# variables: $killer, $target
AnnouncePvpMsg = $killer has defeated $target

+# Show online players vcmd
+# Default: False
+ShowOnlinePlayers = False

# ---------------------------------------------------------------------------
# Chat Moderation
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java	(revision 4652)
+++ java/com/l2jserver/Config.java	(working copy)
@@ -1018,6 +1018,8 @@
	//chatfilter
	public static ArrayList<String>	FILTER_LIST;

+	public static boolean SHOW_ONLINE_PLAYERS;
+	
	/**
	 * This class initializes all global variables for configuration.<br>
	 * If the key doesn't appear in properties file, a default value is set by this class.
@@ -2442,6 +2444,7 @@
					ANNOUNCE_PK_MSG = L2JModSettings.getProperty("AnnouncePkMsg", "$killer has slaughtered $target");
					ANNOUNCE_PVP_MSG = L2JModSettings.getProperty("AnnouncePvpMsg", "$killer has defeated $target");

+					SHOW_ONLINE_PLAYERS = Boolean.parseBoolean(L2JModSettings.getProperty("ShowOnlinePlayers","False"));
					L2JMOD_CHAT_ADMIN = Boolean.parseBoolean(L2JModSettings.getProperty("ChatAdmin", "false"));

					L2JMOD_MULTILANG_ENABLE = Boolean.parseBoolean(L2JModSettings.getProperty("MultiLangEnable", "false"));
#P L2J_DataPack
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java	(revision 8046)
+++ data/scripts/handlers/MasterHandler.java	(working copy)
@@ -245,6 +245,7 @@
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.Online;
import handlers.voicedcommandhandlers.TvTVoicedInfo;
import handlers.voicedcommandhandlers.Wedding;
import handlers.voicedcommandhandlers.stats;
@@ -546,6 +547,8 @@
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Banking());
		if (Config.TVT_ALLOW_VOICED_COMMAND)
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new TvTVoicedInfo());
+		if (Config.SHOW_ONLINE_PLAYERS)
+			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Online());
		if (Config.L2JMOD_CHAT_ADMIN)
			VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new ChatAdmin());
		if (Config.L2JMOD_MULTILANG_ENABLE && Config.L2JMOD_MULTILANG_VOICED_ALLOW)
Index: data/html/mods/online/OnlineStatus.htm
===================================================================
--- data/html/mods/online/OnlineStatus.htm	(revision 0)
+++ data/html/mods/online/OnlineStatus.htm	(revision 0)
@@ -0,0 +1,4 @@
+<html><title>Online players status</title>
+<body><center>There are %playernumber% players online.<br>
+<font color="333333">by Voqus</font><br>
+<button value="Exit" action="bypass -h Close" width=45 height=25 back="L2UI_CT1.Button_DF_Down" fore="L2UI_ct1.button_df">
+</center></body></html>
Index: data/scripts/handlers/voicedcommandhandlers/Online.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/Online.java	(revision 0)
+++ data/scripts/handlers/voicedcommandhandlers/Online.java	(revision 0)
@@ -0,0 +1,44 @@
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.cache.HtmCache;
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+
+/**
+ * @author Voqus
+ */
+
+public class Online implements IVoicedCommandHandler
+{
+	public static final String[] VOICED_COMMANDS = { "online" };
+
+	private static final boolean USE_STATIC_HTML = true;
+	private static final String HTML_LINK = HtmCache.getInstance().getHtm(null, "data/html/mods/online/OnlineStatus.htm");
+	
+	public boolean useVoicedCommand(String command, L2PcInstance player, String params)
+	{
+		String htmContent = (USE_STATIC_HTML && !HTML_LINK.isEmpty()) ? HTML_LINK :
+		HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/mods/online/OnlineStatus.htm");
+		
+		if(command.equalsIgnoreCase("online"))
+		{
+			NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
+			
+			npcHtmlMessage.setHtml(htmContent);
+			npcHtmlMessage.replace("%playernumber%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
+			player.sendPacket(npcHtmlMessage);
+			}
+			else
+			{
+				player.sendPacket(ActionFailed.STATIC_PACKET);
+			}
+		return true;
+	}
+	
+	public String[] getVoicedCommandList()
+	{
+		return VOICED_COMMANDS;
+	}
+}

 

Credits: me

Posted

good job mate but it is uselless :>

 

Is not useless, if you want to see the players online without the community board because it makes lag, so, thats a light code who dont make lag and its useful for me. Any1 haves a different way to use it.

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

    • Is there tutorial how to make this effects? Thanks in Advance  
    • https://pastebin.com/UJcX7rXH    
    • Does anyone have more information about bugs and errors in the Frozen review? Any ideas? Any help is welcome!   Modifications and corrections made   https://pastebin.com/vqYjM8ZH   Sorry if this is the wrong area.
    • Purchase Telegram Stars at a favorable price with minimal markup. New auctions from Telegram are expected, and our bot will help you prepare in advance. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services: Digital goods store (Website): Go to Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to SMM Panel: Go to – promotion of your social media accounts. We want to present to you the current list of promotions and special offers for purchasing products and services of our service: 1. You can use a promo code for your first purchase: SOCNET (15% discount) 2. Get $1 on your store balance or a 10–20% discount — just send your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to write this in our forum thread! 3. Get $1 for the first trial launch of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly Telegram Stars giveaways in our Telegram channel and in our bot for purchasing stars! News: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord server: https://discord.gg/y9AStFFsrh Contacts and support: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock