Matim Posted April 12, 2009 Share Posted April 12, 2009 Ok . Everyone know how to create these commands like .command , but now i want to say how to create thats /command . I think it look much better ;) This guide is for L2J files , if somone want make it for other pack , should change imports . Ok . As We know...in newest L2J rev , we have handlers in DataPack ( .java files ) so we dont must compile them in core to make them working . Ok . For example we want to create command and when we use it , it will show us window with our text . 1 . First step : You should open : data\scripts\handlers\usercommandhandlers 2. Second Step : Create new .java file . For example ServerInfo.java 3. Third Step : - Ok , We have our .java file . So now We must open this file and start writing : /* * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ We know , this is GNU license , dont forget to paste it in our file . - Then We must import some classes needed for shown html window in game , so : package handlers.usercommandhandlers; import net.sf.l2j.gameserver.handler.IUserCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; Ok , we have imported needed classes from core , now we must create our class : public class ServerInfo implements IUserCommandHandler { private static final int[] COMMAND_IDS = { 121 }; Now all should ask...omg but what is that ? What its this ID ( 121 in this example ) . The answer is simple : This is ID form our client . We can define this in : commandname-e.dat file . Ok , download FileEdit and open this fille , we should have somethink like that : - Ok , first column if for command number ( 1,2,3,4,5,5 ... ) - Secound column is for command ID - yes we need it in our class ( I'ill show it again , where we will put ID ) : private static final int[] COMMAND_IDS = { 121 }; Ok , we want to add that command : /serverinfo , so we must put : - 122 in first column , becouse last one was 121 .. ( we are smarts - yeah ;) ) - 121 in secound column , becouse last one was 120 ... ok this is our comman ID , we must this into our class ( look upper , to show where put this ... ) - And in third column we must add : a,serverinfo\0 Now when we use /serverinfo in game , server will try to use command with 121 ID So it look like this : - Close and save file , this is it ;) Now add to our script this : /** * * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance) */ public boolean useUserCommand(int id, L2PcInstance activeChar) { if (id != COMMAND_IDS[0]) return false; NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0); npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your Text Here</body></html>"); activeChar.sendPacket(npcHtmlMessage); return true; } /** * * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList() */ public int[] getUserCommandList() { return COMMAND_IDS; } } Done , our ServerInfo.java should look that : /* * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */ package handlers.usercommandhandlers; import net.sf.l2j.gameserver.handler.IUserCommandHandler; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage; /** * Support for /serverinfo command * Added by Matim */ public class ServerInfo implements IUserCommandHandler { private static final int[] COMMAND_IDS = { 121 }; /** * * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance) */ public boolean useUserCommand(int id, L2PcInstance activeChar) { if (id != COMMAND_IDS[0]) return false; NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0); npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your team won the event. Look in your inventory, there should be your reward.</body></html>"); activeChar.sendPacket(npcHtmlMessage); return true; } /** * * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList() */ public int[] getUserCommandList() { return COMMAND_IDS; } } Now we must add our script to MasterHandler.java in \data\scripts\handlers folder - Open this file : And find these lines , in first column : import handlers.usercommandhandlers.ChannelDelete; import handlers.usercommandhandlers.ChannelLeave; import handlers.usercommandhandlers.ChannelListUpdate; import handlers.usercommandhandlers.ClanPenalty; import handlers.usercommandhandlers.ClanWarsList; import handlers.usercommandhandlers.DisMount; import handlers.usercommandhandlers.Escape; import handlers.usercommandhandlers.InstanceZone; import handlers.usercommandhandlers.Loc; import handlers.usercommandhandlers.Mount; import handlers.usercommandhandlers.OlympiadStat; import handlers.usercommandhandlers.PartyInfo; import handlers.usercommandhandlers.Time; and add our : import handlers.usercommandhandlers.ServerInfo; Now find this column : private static void loadUserHandlers() { UserCommandHandler.getInstance().registerUserCommandHandler(new ClanPenalty()); UserCommandHandler.getInstance().registerUserCommandHandler(new ClanWarsList()); UserCommandHandler.getInstance().registerUserCommandHandler(new DisMount()); UserCommandHandler.getInstance().registerUserCommandHandler(new Escape()); UserCommandHandler.getInstance().registerUserCommandHandler(new InstanceZone()); UserCommandHandler.getInstance().registerUserCommandHandler(new Loc()); UserCommandHandler.getInstance().registerUserCommandHandler(new Mount()); UserCommandHandler.getInstance().registerUserCommandHandler(new PartyInfo()); UserCommandHandler.getInstance().registerUserCommandHandler(new Time()); UserCommandHandler.getInstance().registerUserCommandHandler(new OlympiadStat()); UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelLeave()); UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelDelete()); UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelListUpdate()); UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo()); _log.config("Loaded " + UserCommandHandler.getInstance().size() + " UserHandlers"); } And add this : UserCommandHandler.getInstance().registerUserCommandHandler(new ServerInfo()); (under : UserCommandHandler.getInstance().registerUserCommandHandler(new ChannelListUpdate()); ) Save , and restart Your server , done now type /serverinfo in game ;) Credits goes to me Link to comment Share on other sites More sharing options...
rubix123 Posted April 12, 2009 Share Posted April 12, 2009 nice guide men Link to comment Share on other sites More sharing options...
DBSK Posted April 12, 2009 Share Posted April 12, 2009 nice man cool guide.very helpfull Link to comment Share on other sites More sharing options...
kwstas13 Posted April 12, 2009 Share Posted April 12, 2009 man this is very helpfull just hide it for lot's of post!!!! Link to comment Share on other sites More sharing options...
Matim Posted April 13, 2009 Author Share Posted April 13, 2009 If somone has found any bugg's or somethink like that , please report it to me. Link to comment Share on other sites More sharing options...
macdonald12 Posted April 13, 2009 Share Posted April 13, 2009 Fully explained, +1 :) man this is very helpfull just hide it for lot's of post!!!! lol ::) Link to comment Share on other sites More sharing options...
Kràtos Posted April 13, 2009 Share Posted April 13, 2009 Very nice guide, for niewbie... Keep it up! p.s: This have client modding so... illegal ... .info or .infoserver etc is much better no need client modding ;) Link to comment Share on other sites More sharing options...
MaestroLuke Posted April 13, 2009 Share Posted April 13, 2009 This have client modding so... illegal ... you made us laugh so much it's hard to find good server's without cilent modding Link to comment Share on other sites More sharing options...
Matim Posted April 13, 2009 Author Share Posted April 13, 2009 Ok know it is illegal...but somone can use it Link to comment Share on other sites More sharing options...
Stealth Posted April 13, 2009 Share Posted April 13, 2009 OMG Great share I was looking for a guide like this , cause I only know how to edit commands from Banking.java but couldn't find a way to crate a seperate *.java file. Thanks again. Link to comment Share on other sites More sharing options...
Kràtos Posted April 13, 2009 Share Posted April 13, 2009 you made us laugh so much it's hard to find good server's without cilent modding Us? how many ppl are you? are like all in one? 1 Waring stay on topic! As i said is very good guide for starter .... but is client moding so... illegal... If you don't agree go expres your opinion at www.NcSoft.com. Link to comment Share on other sites More sharing options...
Matim Posted April 13, 2009 Author Share Posted April 13, 2009 Man ...i fully agree with that what are you talking about , but as i said ..this is for thats people who need and want use it..same like custom items. Link to comment Share on other sites More sharing options...
kataras2006 Posted April 21, 2009 Share Posted April 21, 2009 yeah.. good tut.. the only bad is 'Client Modding'..... :/ cuz this i like the c0mmands with : .command ... xD Link to comment Share on other sites More sharing options...
Matim Posted April 22, 2009 Author Share Posted April 22, 2009 Your chose :D If You like .command chose that :) Link to comment Share on other sites More sharing options...
Expini Posted April 23, 2009 Share Posted April 23, 2009 why i can't see here i have login alredy now ? it say "[Hidden post: You need login to forum to see it.]" what i do? Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now