Code SpecialTeleport System – Acceso VIP por Tickets (Custom Gatekeeper)

EmptyPirsys

Vassal
Customer
╔══════════════════════════════════════════════════════╗
SPECIAL VIP TELEPORT SYSTEM - Gatekeeper Script
╚══════════════════════════════════════════════════════╝


.:: DESCRIPTION ::.
Professional teleport system for Lineage 2 servers that requires special VIP tickets/items to access specific locations. Perfect for creating premium teleport services, VIP zones, or monetization features.

.:: FEATURES ::.
Multi-Ticket Support - Works with 3 different ticket types
Player Validation - Checks player status before teleport
Custom Messages - Clear feedback system
Easy Configuration - Simple setup process
Optimized Code - Lightweight & production-ready
Error Handling - Full exception management
Console Logging - Track script status

.:: HOW IT WORKS ::.
The script checks if the player has one of the configured VIP tickets before allowing teleportation to specified coordinates.
Perfect for:
VIP-only areas
Premium teleport services
Cash shop items
Event access control
Donator benefits

.:: CONFIGURATION ::.
// Item IDs (customize these)
TICKET_VIP_1 = 91579
TICKET_VIP_2 = 91580
TICKET_VIP_3 = 9210
// Usage in scripts:
teleportWithTicket("x", "y", "z")

.:: USE CASES ::.
Create exclusive teleport NPCs for VIP players
Monetize special zone access
Reward donators with premium teleports
Control access to custom instances/zones
Event-based teleportation system

.:: INSTALLATION ::.
1. Compile the script
2. Place the generated ext inside the gameserver directory
3. Configure item IDs in the script
4. Add teleport NPCs with the function call
5. Reload scripts and test

.:: WHY USE THIS? ::.
Increase revenue - Sell VIP tickets
Player retention - Exclusive benefits
Flexible - 3 ticket tiers
Professional - Production-ready

PM FOR QUESTIONS & SUPPORT
Price: FREE
⚡ Fast Delivery | ⚡ Professional Support | ⚡ Quality Code

Java:
package custom.gatekeeper;

import l2.gameserver.scripts.Functions;
import l2.gameserver.scripts.ScriptFile;
import l2.gameserver.data.xml.holder.ItemHolder;
import l2.gameserver.model.Player;
import l2.gameserver.network.l2.components.SystemMsg;
import l2.gameserver.network.l2.s2c.SystemMessage;
import l2.gameserver.templates.item.ItemTemplate;
import l2.gameserver.utils.Location;

public class SpecialTeleport extends Functions implements ScriptFile {

    private static final int TICKET_VIP_1 = 91579;
    private static final int TICKET_VIP_2 = 91580;
    private static final int TICKET_VIP_3 = 9210;

    @Override
    public void onLoad() {
        System.out.println("=== SpecialTeleport: Script cargado ===");
    }

    @Override
    public void onReload() {
        System.out.println("=== SpecialTeleport: Script recargado ===");
    }

    @Override
    public void onShutdown() {
        System.out.println("=== SpecialTeleport: Script apagado ===");
    }

    public void teleportWithTicket(String[] args) {

        Player player = getSelf();

        if (player == null || player.isDead() || player.isInObserverMode()) {
            return;
        }

        if (args.length < 3) {
            player.sendMessage("Invalid teleport data.");
            return;
        }

        try {
            int x = Integer.parseInt(args[0]);
            int y = Integer.parseInt(args[1]);
            int z = Integer.parseInt(args[2]);

            boolean hasTicket1 = getItemCount(player, TICKET_VIP_1) > 0;
            boolean hasTicket2 = getItemCount(player, TICKET_VIP_2) > 0;
            boolean hasTicket3 = getItemCount(player, TICKET_VIP_3) > 0;

            if (hasTicket1 || hasTicket2 || hasTicket3) {
                player.teleToLocation(new Location(x, y, z));
            } else {
                String name1 = getItemName(TICKET_VIP_1);

                player.sendPacket(
                    new SystemMessage(SystemMsg.S1)
                        .addString("Only those bearing " + name1 + " may access this sacred teleport.")
                );
            }

        } catch (Exception e) {
            player.sendMessage("Invalid teleport data.");
        }
    }

    private String getItemName(int itemId) {
        try {
            ItemTemplate template = ItemHolder.getInstance().getTemplate(itemId);
            if (template != null && template.getName() != null) {
                return template.getName();
            }
        } catch (Exception e) {
        }
        return "Item #" + itemId;
    }
}
bypass -h scripts_custom.gatekeeper.SpecialTeleport:teleportWithTicket 184360 -62665 -2976
 
I added some functions to my friend's code.

Add the items you want as coupons and the quantity of each item.


Create a file called special_teleport.properties and place it in the config/ folder (or config/custom/, depending on your server's organization).

# List of VIP Tickets and the required quantity of each.
# Format: ITEM_ID:QUANTITY
# Separate the different tickets with a comma.

# Example below: Requires 1 of item 91579, or 5 of item 91580, or 10 of item 9210.
VipTickets = 91579:1, 91580:5, 9210:10



JavaScript:
package custom.gatekeeper;

import l2.gameserver.scripts.Functions;
import l2.gameserver.scripts.ScriptFile;
import l2.gameserver.data.xml.holder.ItemHolder;
import l2.gameserver.model.Player;
import l2.gameserver.network.l2.components.SystemMsg;
import l2.gameserver.network.l2.s2c.SystemMessage;
import l2.gameserver.templates.item.ItemTemplate;
import l2.gameserver.utils.Location;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SpecialTeleport extends Functions implements ScriptFile {

    private static final String CONFIG_FILE = "config/special_teleport.properties";
    
    // Now using a Map to store ID -> Amount
    private static final Map<Integer, Long> VIP_TICKETS = new HashMap<>();

    @Override
    public void onLoad() {
        loadConfig();
        System.out.println("=== SpecialTeleport: Script loaded with " + VIP_TICKETS.size() + " configured tickets ===");
    }

    @Override
    public void onReload() {
        loadConfig();
        System.out.println("=== SpecialTeleport: Script reloaded ===");
    }

    @Override
    public void onShutdown() {
        System.out.println("=== SpecialTeleport: Script shutdown ===");
    }

    private void loadConfig() {
        VIP_TICKETS.clear();
        try {
            File file = new File(CONFIG_FILE);
            if (file.exists()) {
                InputStream is = new FileInputStream(file);
                Properties props = new Properties();
                props.load(is);
                is.close();

                // Reads the property with a safe default in case it's empty
                String itemsString = props.getProperty("VipTickets", "91579:1, 91580:1, 9210:1");
                String[] items = itemsString.split(",");
                
                for (String itemStr : items) {
                    try {
                        // Splits the string "ID:Amount"
                        String[] parts = itemStr.trim().split(":");
                        int itemId = Integer.parseInt(parts[0].trim());
                        
                        // If the user forgets to set the amount (e.g., "91579"), default to 1
                        long count = parts.length > 1 ? Long.parseLong(parts[1].trim()) : 1L;
                        
                        VIP_TICKETS.put(itemId, count);
                    } catch (NumberFormatException ignored) {
                        // Ignore invalid formats
                    }
                }
            } else {
                System.out.println("SpecialTeleport: File " + CONFIG_FILE + " not found! Using default configuration.");
                VIP_TICKETS.put(91579, 1L);
                VIP_TICKETS.put(91580, 1L);
                VIP_TICKETS.put(9210, 1L);
            }
        } catch (Exception e) {
            System.out.println("SpecialTeleport: Error loading configurations.");
            e.printStackTrace();
        }
    }

    public void teleportWithTicket(String[] args) {

        Player player = getSelf();

        if (player == null || player.isDead() || player.isInObserverMode()) {
            return;
        }

        if (args.length < 3) {
            player.sendMessage("Invalid teleport data.");
            return;
        }

        try {
            int x = Integer.parseInt(args[0]);
            int y = Integer.parseInt(args[1]);
            int z = Integer.parseInt(args[2]);

            boolean hasTicket = false;

            // Iterates through the Map checking the ID and required Amount
            for (Map.Entry<Integer, Long> entry : VIP_TICKETS.entrySet()) {
                int ticketId = entry.getKey();
                long requiredCount = entry.getValue();

                // Checks if the player has an amount equal to or greater than the required
                if (getItemCount(player, ticketId) >= requiredCount) {
                    hasTicket = true;
                    
                    // IMPORTANT: If the ticket is consumable (pay to teleport), 
                    // remove the two slashes "//" from the code below:
                    // removeItem(player, ticketId, requiredCount);
                    
                    break;
                }
            }

            if (hasTicket) {
                player.teleToLocation(new Location(x, y, z));
            } else {
                // Gets the name of the first item in the Map just to display in the error message
                int firstTicketId = VIP_TICKETS.keySet().stream().findFirst().orElse(0);
                String name1 = getItemName(firstTicketId);

                player.sendPacket(
                    new SystemMessage(SystemMsg.S1)
                        .addString("Only those bearing enough " + name1 + " or equivalent VIP items may access this sacred teleport.")
                );
            }

        } catch (Exception e) {
            player.sendMessage("Invalid teleport data.");
        }
    }

    private String getItemName(int itemId) {
        if (itemId == 0) return "VIP Tickets";
        try {
            ItemTemplate template = ItemHolder.getInstance().getTemplate(itemId);
            if (template != null && template.getName() != null) {
                return template.getName();
            }
        } catch (Exception e) {
        }
        return "Item #" + itemId;
    }
}
 
Full script for already existing feature. YEAH!
 
It is correct, but using a code you can personalize it and not leave it so basic, for example in messages. Or other actions such as a VIP validation for example.
Full script for already existing feature. YEAH!
 
Back
Top