Jump to content
  • 0

[-Teleport-]*Premium Tab


Question

Posted

Hi all, how i can make Second Tab to work just for premium users?

lF9o7sQ.png

I try 

if (!activeChar.isPremium() && !activeChar.isGM())
			{
				activeChar.sendMessage("Only Premium chars can teleport there.");
				return;
			}

but no work..nothing happend!

5 answers to this question

Recommended Posts

  • 0
Posted (edited)

You can add in RequestByPassToServer (clientpacket)

Quote

else if (_command.startsWith("premium")){    
    if(!player.isPremium()){
        player.sendMessage("Only Premium chars can teleport there.");
        return;
    }
    StringTokenizer st = new StringTokenizer(_command);
    st.nextToken();
            
    int x = Integer.parseInt(st.nextToken());
    int y = Integer.parseInt(st.nextToken());
    int z = Integer.parseInt(st.nextToken());
    player.teleportTo(x , y, z, 20);    
}

 

and html part

Quote

<a action="bypass -h npc_%objectId%_premium X Y Z ">Premium Drop</a>

where X Y Z , the location you want to teleport the players.

 

In the other hand you can do it as the nobless teleport quest do,you can check your quests and do it by the same way.

Edited by @IcathiaLord
  • 0
Posted

Logic seems coorext. Yet you didn't show where you put it. That may be the problem.

 

No, don't use bypass with self defined xyz. It can be exploited. Simply use normal teleport logic. Do exactly the same system as noblesse teleport. Add new param to xml coords.

  • 0
Posted
else if (command.startsWith(_servicesBBSCommand + "_teleport"))
		{
			BoardsManager.getInstance().addBypass(activeChar, "Service Teleport", command);
			content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/gatekeeper/premium.htm");
			separateAndSend(content, activeChar);
			
			if (!CommunityServicesConfigs.COMMUNITY_SERVICES_TP_ALLOW)
			{
				activeChar.sendMessage("This function is disabled by admin.");
				return;
			}
			
			if (!activeChar.isPremium() || activeChar.isInCombat() || activeChar.isJailed() || activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || SunriseEvents.isInEvent(activeChar) || OlympiadManager.getInstance().isRegistered(activeChar))
			{
				activeChar.sendMessage("Cannot use at the moment.");
				return;
			}
			
			try
			{
				String tp = commandSeperator(command);
				Integer[] c = new Integer[3];
				c[0] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[0];
				c[1] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[1];
				c[2] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[2];
				boolean onlyForNobless = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[3] == 1;
				int itemIdToGet = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[4];
				int price = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[5];
				
				if (!CommunityServicesConfigs.ALLOW_TELEPORT_DURING_SIEGE)
				{
					if (SiegeManager.getInstance().getSiege(c[0], c[1], c[2]) != null)
					{
						activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
						return;
					}
					else if (TownManager.townHasCastleInSiege(c[0], c[1]) && activeChar.isInsideZone(ZoneIdType.TOWN))
					{
						activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
						return;
					}
				}
				
				if (Conditions.checkPlayerItemCount(activeChar, itemIdToGet, price))
				{
					if (onlyForNobless && !activeChar.isNoble() && !activeChar.isGM())
					{
						activeChar.sendMessage("Only noble chars can teleport there.");
						return;
					}
					
					if (activeChar.isTransformed())
					{
						if ((activeChar.getTransformationId() == 9) || (activeChar.getTransformationId() == 8))
						{
							activeChar.untransform();
						}
					}
					
					if (activeChar.isInsideZone(ZoneIdType.PEACE) || activeChar.isGM())
					{
						activeChar.setInstanceId(0);
						activeChar.teleToLocation(c[0], c[1], c[2]);
					}
					else
					{
						activeChar.abortCast();
						activeChar.abortAttack();
						activeChar.sendPacket(ActionFailed.STATIC_PACKET);
						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
						activeChar.setTarget(activeChar);
						activeChar.disableAllSkills();
						Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, 1050, 1, 0, 0), 810000);
						activeChar.sendPacket(new SetupGauge(SetupGauge.BLUE, 0));
						activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(activeChar, c[0], c[1], c[2]), 0));
						activeChar.forceIsCasting(10 + GameTimeController.getInstance().getGameTicks() + (0 / GameTimeController.MILLIS_IN_TICK));
					}
					
					activeChar.destroyItemByItemId("Community Teleport", itemIdToGet, price, activeChar, true);
				}
				
			}
			
			catch (Exception e)
			{
				SecurityActions.startSecurity(activeChar, SecurityType.COMMUNITY_SYSTEM);
			}
		}
		else if (command.startsWith(_servicesBBSCommand + "_teleport"))
		{
			BoardsManager.getInstance().addBypass(activeChar, "Service Teleport", command);
			content = HtmCache.getInstance().getHtm(activeChar, activeChar.getHtmlPrefix(), "data/html/CommunityBoard/services/gatekeeper/normal.htm");
			separateAndSend(content, activeChar);
			
			if (!CommunityServicesConfigs.COMMUNITY_SERVICES_TP_ALLOW)
			{
				activeChar.sendMessage("This function is disabled by admin.");
				return;
			}
			
			if (activeChar.isInCombat() || activeChar.isJailed() || activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || SunriseEvents.isInEvent(activeChar) || OlympiadManager.getInstance().isRegistered(activeChar))
			{
				activeChar.sendMessage("Cannot use at the moment.");
				return;
			}
			
			try
			{
				String tp = commandSeperator(command);
				Integer[] c = new Integer[3];
				c[0] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[0];
				c[1] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[1];
				c[2] = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[2];
				boolean onlyForNobless = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[3] == 1;
				int itemIdToGet = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[4];
				int price = TopListsLoader.getInstance().getTeleportInfo(Integer.parseInt(tp))[5];
				
				if (!CommunityServicesConfigs.ALLOW_TELEPORT_DURING_SIEGE)
				{
					if (SiegeManager.getInstance().getSiege(c[0], c[1], c[2]) != null)
					{
						activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
						return;
					}
					else if (TownManager.townHasCastleInSiege(c[0], c[1]) && activeChar.isInsideZone(ZoneIdType.TOWN))
					{
						activeChar.sendPacket(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE);
						return;
					}
				}
				
				if (Conditions.checkPlayerItemCount(activeChar, itemIdToGet, price))
				{
					if (onlyForNobless && !activeChar.isNoble() && !activeChar.isGM())
					{
						activeChar.sendMessage("Only noble chars can teleport there.");
						return;
					}
					
					if (activeChar.isTransformed())
					{
						if ((activeChar.getTransformationId() == 9) || (activeChar.getTransformationId() == 8))
						{
							activeChar.untransform();
						}
					}
					
					if (activeChar.isInsideZone(ZoneIdType.PEACE) || activeChar.isGM())
					{
						activeChar.setInstanceId(0);
						activeChar.teleToLocation(c[0], c[1], c[2]);
					}
					else
					{
						activeChar.abortCast();
						activeChar.abortAttack();
						activeChar.sendPacket(ActionFailed.STATIC_PACKET);
						activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
						activeChar.setTarget(activeChar);
						activeChar.disableAllSkills();
						Broadcast.toSelfAndKnownPlayersInRadius(activeChar, new MagicSkillUse(activeChar, 1050, 1, 0, 0), 810000);
						activeChar.sendPacket(new SetupGauge(SetupGauge.BLUE, 0));
						activeChar.setSkillCast(ThreadPoolManager.getInstance().scheduleGeneral(new Teleport(activeChar, c[0], c[1], c[2]), 0));
						activeChar.forceIsCasting(10 + GameTimeController.getInstance().getGameTicks() + (0 / GameTimeController.MILLIS_IN_TICK));
					}
					
					activeChar.destroyItemByItemId("Community Teleport", itemIdToGet, price, activeChar, true);
				}
				
			}
			
			catch (Exception e)
			{
				SecurityActions.startSecurity(activeChar, SecurityType.COMMUNITY_SYSTEM);
			}
		}

With this setting, without Premium, i can use teleport at Premium tab

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


×
×
  • 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