Jump to content
  • 0

Voiced command help :S


Question

Posted

Hello guys. I want to make a voice command like: .sendgmmsg hi guys what's up?

i mean you know a command, and the rest a String value, but it doesnt work properly :S any idea how to make it? It works as an admin command though...

Recommended Posts

  • 0
Posted

What do you need exactly lol, explain it a bit if you expect help :/

 

Global message to each online player? But via pm.. htm window.. system message or what.

  • 0
Posted

Well i want to make just a command like: .message Hello guys

And i want this "Hello Guys" to appear to everyone... but i think something with the tokens is the problem.. as i saw in one of my files, i found this:

 

StringTokenizer st = new StringTokenizer(target);

 

But if i am write, i have to make like 15 tokens? and i dont think its gonna work anyway...

  • 0
Posted

so all player can use this and spam ? how should this be useful ?

or the command can use only admin/gm chars ? but then is still the question for what is it useful :s

  • 0
Posted

As message, but if its possible to make it in the middle of the screen, no problem but its interlude so i dont think its working...

I dont mind also if its made with HTML, like a box in a html and then a submit button..

  • 0
Posted

1) ExShowScreenMessage (not a huge deal to put it in IL)

2) Broadcast..

3) Announcements..

 

(If you are facing problems with the structure of the code, you could take a few ideas from the //announce admincommand. But you can't expect us to give you the ready code. "We're here to help you, not open your server"! ;))

  • 0
Posted

I dont really have a problem man, look first i made it as admin command, and it works great. But when i made it as voiced command, it doesnt work... it doesnt read the message... plus, to put ExShowScreenMessage, you  need to put something in System if i am right, and seriously no one is gonna download files... :S I just want to make: .sendmessage hello people, and send "hello people" to everyone. I used CreatureSay for that.. but doesnt work on Voiced command! only works on admin command...

  • 0
Posted

1) You have to modify the parse method. Right now, the voiced handler is getting as:

handlerMap.get(command); etc

if you write .sendMessage bla bla bla, obviously, the command wont equals to the voiced handler name

you should change to

String start = command.split(" ");
if(start.lenght < 2) return null;
handlerMap.get(start[0]);

Then, in the voiced handler, forget about String target, just use command.split(" ");

 

  • 0
Posted

this is a test i made after see that the voiced commands in interlude alredy support parameters for them.

Screen:

shot00000kz.jpg

Code:

Index: java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Test.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Test.java	(revision 0)
+++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Test.java	(revision 0)
@@ -0,0 +1,50 @@
+/* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.handler.voicedcommandhandlers;
+
+import net.sf.l2j.gameserver.clientpackets.Say2;
+import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.serverpackets.CreatureSay;
+
+/**
+ *
+ * @author  BiggBoss
+ */
+public class Test implements IVoicedCommandHandler
+{
+	private static final String[] COMMAND = {"test"};
+	
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#getVoicedCommandList()
+	 */
+	public String[] getVoicedCommandList()
+	{
+		return COMMAND;
+	}
+
+	/**
+	 * @see net.sf.l2j.gameserver.handler.IVoicedCommandHandler#useVoicedCommand(java.lang.String, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance, java.lang.String)
+	 */
+	public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+	{
+		final CreatureSay say = new CreatureSay(activeChar.getObjectId(), Say2.SHOUT, activeChar.getName(), target);
+		activeChar.broadcastPacket(say);
+		return false;
+	}
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java	(revision 4462)
+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)
@@ -196,6 +196,7 @@
import net.sf.l2j.gameserver.handler.usercommandhandlers.OlympiadStat;
import net.sf.l2j.gameserver.handler.usercommandhandlers.PartyInfo;
import net.sf.l2j.gameserver.handler.usercommandhandlers.Time;
+import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Test;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Wedding;
import net.sf.l2j.gameserver.handler.voicedcommandhandlers.stats;
import net.sf.l2j.gameserver.idfactory.IdFactory;
@@ -589,6 +590,7 @@

		_voicedCommandHandler = VoicedCommandHandler.getInstance();
		_voicedCommandHandler.registerVoicedCommandHandler(new stats());
+		_voicedCommandHandler.registerVoicedCommandHandler(new Test());

		if(Config.L2JMOD_ALLOW_WEDDING)
			_voicedCommandHandler.registerVoicedCommandHandler(new Wedding());

Guest
This topic is now closed to further replies.


×
×
  • Create New...