Jump to content
  • 0

Custom Gatekeeper


alextoti13

Question

hello I have this code:

 

 

Index: D:\eclipse_luna\Workspace\L2jFrozen_GameServer\head-src\com\l2jfrozen\gameserver\model\actor\instance\L2TeleporterInstance.java
===================================================================
--- D:\eclipse_luna\Workspace\L2jFrozen_GameServer\head-src\com\l2jfrozen\gameserver\model\actor\instance\L2TeleporterInstance.java   (revision 1116)
+++ D:\eclipse_luna\Workspace\L2jFrozen_GameServer\head-src\com\l2jfrozen\gameserver\model\actor\instance\L2TeleporterInstance.java   (working copy)

   else
   {
      LOGGER.warn("No teleport destination with id:" + val);
   }
   player.sendPacket(ActionFailed.STATIC_PACKET);
   list = null;
}
   
+@SuppressWarnings("unused")
+private void doPartyTeleport(final L2PcInstance player, final int val)
+{
+   if (player.getParty() == null)
+   {
+      player.sendMessage("You must be in party of 5-9 members to use the teleport!");
+      return;
+   }
+   
+   if (player.getObjectId() != player.getParty().getPartyLeaderOID())
+   {
+      player.sendMessage("You must be party leader to use the teleport!");
+      return;
+   }
+   
+   int NumberPartyMembers = 0;      
+   for (final L2PcInstance temp : player.getParty().getPartyMembers())
+   {
+      NumberPartyMembers++;   
+   }
+   
+   if(NumberPartyMembers < 5 && NumberPartyMembers > 9)
+   {
+      player.sendMessage("You must be in party of 5-9 members to use the teleport!");
+      return;
+   }
+   
+   L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
+   // Teleport ID must be 99999
+   if (list.getTeleId() == 99999)
+   {
+      for (final L2PcInstance temp : player.getParty().getPartyMembers())
+      {
+         temp.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);   
+      }
+   }
+}
   
/**
 * Validate condition.
 * @param player the player
 * @return the int
 */
private int validateCondition(final L2PcInstance player)
{
   if (CastleManager.getInstance().getCastleIndex(this) < 0) // Teleporter isn't on castle ground

And I also created the html: with the id 919192 as it writes:

(just to test it)

 

 

gameserver/data/hml/teleporter/919192.htm

<html>
<body>
<center>
<tr><td><font color="FF40FF">Dungeon Gatekeeper</font></td></tr>
<br>
<tr><td><font color="FF0066">______________________________</font></td></tr>
<br>
<br>
<tr><td><a action="bypass -h npc_%objectId%_goto 50146" msg="811;Saints"><font color="C00080">Saint's</font></a></td></tr>
<tr><td><br></td></tr>
<br>
<br>
<tr><td><font color="FF0066">______________________________</font></td></tr>
</body>
</html>

 

But it doesnt working it teleportes me even if I am alone (I tester it with a single character no GM) Also Plz tell me how to add an item in order to let someone teleport. Happy Chrismtass!

Link to comment
Share on other sites

Recommended Posts

  • 0

Failado.

 

player.teleToLocation(-21598, 185328, -5646);

 

Only the "player" will be teleported.. Oh you ppl

 

Also, lol at those checks about party leader and party member count.. :troll:

What about this:

   }
  }
+{
 +  if (player.getParty() == null)
 +      
 

I change it.

 

and i try with Dual Box and its works now..  :)

 

(Sorry im new in Java)

 

Did you put the party in a loop? :)

Edited by Tessa
Link to comment
Share on other sites

  • 0

Failado.

 

player.teleToLocation(-21598, 185328, -5646);

 

Only the "player" will be teleported.. Oh you ppl

 

Also, lol at those checks about party leader and party member count.. :troll:

Tested works perfect, and also teleport your partyMembers !

Link to comment
Share on other sites

  • 0

i dont know why its looks like that.

 

I have this and its works :S

http://pastebin.com/qZEk59QP

Why this?

+                                      player.sendMessage("You must be in party of 2-9 members to use the teleport!");
+                                      return;
+                                   }
+                                  
+                                     else if(actualCommand.equalsIgnoreCase("party"))
+                                     {
+                                        for (final L2PcInstance temp : player.getParty().getPartyMembers())
+                                        {
+                                           temp.teleToLocation(80139, 148616, -3559, true);  
+                                        }
+                                     }
Link to comment
Share on other sites

  • 0

There is no need to compare objectId..

if (player.getParty().getLeader() != player)

...

else if (player.getParty().getMemberCount() < 2)

If you use much checks for one thing, you can make it shorter like

L2Party party = player.getParty();

so, you put party instead of player.getParty()

 

Drop your hilarious party count check blabla++, and use only getMemberCount() check :D

Edited by SweeTs
Link to comment
Share on other sites

  • 0

Then why SweeTs you dont make a "Code" for alextoti13 ? :/

I like cuz this forum have very skilled guys and when one member ask something with 7-8 Lines

all reply but nobody help.

For me at this forum as i have see at this 4-5 days only Tessa help people's.

Link to comment
Share on other sites

  • 0

For me at this forum as i have see at this 4-5 days only Tessa help people's.

... :gusta:

 

 

Then why SweeTs you dont make a "Code" for alextoti13 ? :/

It's "help" section, not "create instead of me". I can give tips, hints and so on. But I won't give to anyone the whole ready code.. Let's be serious :)

 

You try your best, when you stuck here we are, ready to help, improve the code and so on. BUt, "hello, please give me this, this and this. Ok thanks." - it's not working like that, you won't learn anything :)

Edited by SweeTs
Link to comment
Share on other sites

  • 0

... :gusta:

 

 

It's "help" section, not "create instead of me". I can give tips, hints and so on. But I won't give to anyone the whole ready code.. Let's be serious :)

 

Good point, if you want something coded from scratch hire someone to do it/

Link to comment
Share on other sites

  • 0

... :gusta:

 

 

It's "help" section, not "create instead of me". I can give tips, hints and so on. But I won't give to anyone the whole ready code.. Let's be serious :)

 

You try your best, when you stuck here we are, ready to help, improve the code and so on. BUt, "hello, please give me this, this and this. Ok thanks." - it's not working like that, you won't learn anything :)

 

SweeTs is my spiritual baby, enough said.

Link to comment
Share on other sites

  • 0

SweeTs is my spiritual baby, enough said.

Sensei, senpai.. !? Nooo, Ero-sensei  dw1_4.gif

Edited by SweeTs
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...