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

    • 寒冷的冬天 — 火热的折扣。使用促销代码 WINTER 即可在我们商店的所有购买中获得 10% 折扣! 有效链接: 数字商品商店(网站): 前往 其他服务和产品: 商店 Telegram 机器人: 前往 – 通过 Telegram 信使方便访问商店。 虚拟号码服务: 前往 用于购买 Telegram Stars 的 Telegram 机器人: 前往 – 在 Telegram 中快速且优惠地购买 Stars。 SMM 面板: 前往 – 推广您的社交媒体账户。 我们想向您展示当前的 促销和特别优惠列表 ,用于购买我们服务的产品和服务: 1. 您可以在首次购买时使用促销代码:SOCNET(15% 折扣) 2. 获取 $1 商店余额或 10–20% 折扣——只需在我们的网站注册后按以下模板填写您的用户名:"SEND ME BONUS, MY USERNAME IS..." ——您需要在我们的论坛主题中发布! 3. SMM 面板首次试用可获得 $1:只需在我们的网站(Support)提交主题为 “Get Trial Bonus” 的工单。 4. 我们的 Telegram 频道和 Stars 购买机器人中每周都会赠送 Telegram Stars! 新闻: ➡ Telegram 频道: https://t.me/accsforyou_shop ➡ WhatsApp 频道: https://chat.whatsapp.com/K8rBy500nA73z27PxgaJUw?mode=ems_copy_t ➡ Discord 服务器: https://discord.gg/y9AStFFsrh 联系方式和支持: ➡ Telegram: https://t.me/socnet_support ➡ WhatsApp: https://wa.me/79051904467 ➡ Discord: socnet_support ➡ ✉ Email: solomonbog@socnet.store
    • Cold winter — hot discounts. Use promo code WINTER and get 10% off on all purchases in our store! Active links: Digital goods store (Website): Go to Other services and products: Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. 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 write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." – you need to post 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
    • Cold winter — hot discounts. Use promo code WINTER and get 10% off on all purchases in our store! Active links: Digital goods store (Website): Go to Other services and products: Store Telegram bot: Go to – convenient access to the store via the Telegram messenger. Virtual numbers service: Go to Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. 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 write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." – you need to post 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
    • Telegram Stars — a new digital currency inside Telegram. And right now, the best opportunities are opening for profitable purchases and participation in exclusive events. And you can purchase Telegram Stars safely and at the best price in our bot. Active links: Telegram bot for purchasing Telegram Stars: Go to – fast and profitable purchase of Stars in Telegram. Other services and products: 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 write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." — you need to post 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