Skip to content

Hello Got A Problem With A Code Can Anyone Help?

Featured Replies

I putted this patch manually  http://www.maxcheaters.com/topic/142327-user-panel-h5/
 
  and now i got problem in gameserver dont know how to fix it :)) 
u enter in game and when u right commands it's like there aren't any commands and u can't target ncps ...

user_problem.jpg

post the user.java here if you can and mark the line that the code is inserted 

  • Author

post the user.java here if you can and mark the line that the code is inserted 

red lines

 

 

 

  1. package handlers.voicedcommandhandlers;
  2.  
  3. import com.l2jserver.Config;
  4. import com.l2jserver.gameserver.GameTimeController;
  5. import com.l2jserver.gameserver.cache.HtmCache;
  6. import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
  7. import com.l2jserver.gameserver.model.L2World;
  8. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  9. import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
  10. import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  11.  
  12. /**
  13.  * @author NeverMore
  14.  */
  15.  
  16. public class User implements IVoicedCommandHandler
  17. {
  18.        public static final String[] VOICED_COMMANDS = { "user" , "user1", "user2", "user3" };
  19.       
  20.        @Override
  21.        public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
  22.        {
  23.                   if (Config.SHOW_USER)
  24.           {
  25.                           if(command.equalsIgnoreCase("user"))
  26.                           {
  27.                                   User.showUserPage(activeChar, "user.htm");
  28.                           }      
  29.                   if(command.equalsIgnoreCase("user1"))
  30.                           {
  31.                                   User.showUserPage(activeChar, "user1.htm");
  32.                           }  
  33.                   if(command.equalsIgnoreCase("user2"))
  34.                           {
  35.                                   User.showUserPage(activeChar, "user2.htm");
  36.                           }
  37.                   if(command.equalsIgnoreCase("user3"))
  38.                           {
  39.                                   User.showUserPage(activeChar, "user3.htm");
  40.                           }
  41.           }
  42.                   else
  43.                   {
  44.                                        activeChar.sendMessage("This command is disabled");
  45.                                        ExShowScreenMessage message1 = new ExShowScreenMessage("This command is disabled by admin!", 4000);
  46.                                        activeChar.sendPacket(message1);
  47.                                        return false;
  48.                   }    
  49.                        return false;      
  50.        }        
  51.       
  52.        public static String getServerRunTime()
  53.        {
  54.           int timeSeconds = (GameTimeController.getGameTicks() - 36000) / 10;
  55.           String timeResult = "";
  56.           if (timeSeconds >= 86400)
  57.                   timeResult = Integer.toString(timeSeconds / 86400) + " Days " + Integer.toString((timeSeconds % 86400) / 3600) + "hours";
  58.           else
  59.                   timeResult = Integer.toString(timeSeconds / 3600) + " Hours " + Integer.toString((timeSeconds % 3600) / 60) + "mins";
  60.           return timeResult;
  61.        }
  62.             
  63.        public static String getRealOnline()
  64.        {
  65.           int counter = 0;
  66.           for (L2PcInstance onlinePlayer : L2World.getInstance().getAllPlayersArray())
  67.           {
  68.                   if (onlinePlayer.isOnline() && (onlinePlayer.getClient() != null && !onlinePlayer.getClient().isDetached()))
  69.                   {
  70.                           counter++;
  71.                   }
  72.           }
  73.           String realOnline = "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Active</td><td FIXWIDTH=470><font color=FF6600>" + counter + "</font></td></tr>" + "<tr><td fixwidth=11></td><td FIXWIDTH=280>Players Shops</td><td FIXWIDTH=470><font color=FF6600>" + (L2World.getInstance().getAllPlayersCount() - counter) + "</font></td></tr>";
  74.           return realOnline;
  75.        }
  76.       
  77.        public static void showUserPage(L2PcInstance targetChar, String filename)
  78.        {
  79.           String content = HtmCache.getInstance().getHtmForce(targetChar.getHtmlPrefix(), "data/html/userpanel/" + filename);
  80.           NpcHtmlMessage UserPanelReply = new NpcHtmlMessage(5);
  81.           UserPanelReply.setHtml(content);
  82.           UserPanelReply.replace("%online%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
  83.           UserPanelReply.replace("%name%", String.valueOf(targetChar.getName()));
  84.           UserPanelReply.replace("%serveronline%", getRealOnline());
  85.           UserPanelReply.replace("%servercapacity%", Integer.toString(Config.MAXIMUM_ONLINE_USERS));
  86.           UserPanelReply.replace("%serverruntime%", getServerRunTime());
  87.           UserPanelReply.replace("%playernumber%", String.valueOf(L2World.getInstance().getAllPlayers().size()));
  88.                   if (!Config.ENABLE_SPECIAL_EFFECT)
  89.                   {
  90.                        UserPanelReply.replace("%effect%", "Disabled");
  91.                   }
  92.                   else if (L2PcInstance._isoneffect == true)
  93.                   {
  94.                           UserPanelReply.replace("%effect%", "ON");
  95.                   }
  96.                   else  
  97.                   {
  98.                           UserPanelReply.replace("%effect%", "OFF");
  99.                   }
  100.                   if (!Config.ENABLE_PM_REFUSAL)
  101.                   {
  102.                           UserPanelReply.replace("%pm%", "Disabled");
  103.                   }
  104.                   else if (L2PcInstance._ispmrefusal == true)
  105.                   {
  106.                           UserPanelReply.replace("%pm%", "ON");
  107.                   }
  108.                   else
  109.                   {
  110.                           UserPanelReply.replace("%pm%", "OFF");
  111.                   }
  112.                   if (!Config.ENABLE_TRADE_REFUSAL)
  113.                   {
  114.                           UserPanelReply.replace("%trade%", "Disabled");
  115.                   }
  116.                   else if (L2PcInstance._istraderefusal == true)
  117.                   {
  118.                           UserPanelReply.replace("%trade%", "ON");
  119.                   }
  120.                   else
  121.                   {
  122.                           UserPanelReply.replace("%trade%", "OFF");
  123.                   }
  124.                   if (!Config.ENABLE_EXP_REFUSAL)
  125.                   {
  126.                        UserPanelReply.replace("%exp%", "Disabled");
  127.                   }
  128.                   else if (L2PcInstance._isexpsprefusal == true)
  129.                   {
  130.                        UserPanelReply.replace("%exp%", "ON");
  131.                   }
  132.                   else
  133.                   {
  134.                        UserPanelReply.replace("%exp%", "OFF");
  135.                   }
  136.                   if (!Config.ENABLE_SPECIAL_EFFECT)
  137.                   {
  138.                           UserPanelReply.replace("%effect%", "Disabled");
  139.                   }
  140.                   else if (L2PcInstance._isoneffect == true)
  141.                   {
  142.                           UserPanelReply.replace("%effect%", "ON");
  143.                   }
  144.                   else  
  145.                   {
  146.                           UserPanelReply.replace("%effect%", "OFF");
  147.                   }               
  148.                   targetChar.sendPacket(UserPanelReply);
  149.         }
  150.  
  151.       
  152.        @Override
  153.        public String[] getVoicedCommandList()
  154.        {
  155.                return VOICED_COMMANDS;
  156.        }
  157. }

     

     

     

     

     

    RED LINE

Edited by Olymps

Can wrong on user.java on voicecomandhandlers, please check again if you have modify its

  • Author

bump

Create an account or sign in to comment

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.