• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts help with script cube teleport canary 13.32 use in pz and only vip players

3zequi3l

Member
Joined
Jan 14, 2021
Messages
27
Reaction score
5
Location
México
Lua:
local teleportLocations  = {
    { name="Thais", position = Position(32369, 32241, 7) },
    { name="Edron", position = Position(33217, 31814, 8) },
    { name="Carlin", position = Position(32360, 31782, 7) },
    { name="Venore", position = Position(32957, 32076, 7) },
    { name="Ab'Dendriel", position = Position(32732, 31634, 7) },
    { name="Port Hope", position = Position(32594, 32745, 7) },
    { name="Yalahar", position = Position(32787, 31276, 7) },
    { name="Kazordoon", position = Position(32649, 31925, 11) },
    { name="Darashia", position = Position(33213, 32454, 1) },
    { name="Rathleton", position = Position(33594, 31899, 6) },
    { name="Svargrond", position = Position(32212, 31132, 7) },
    { name="Farmine", position = Position(33023, 31521, 11) },
    { name="Ankrahmun", position = Position(33194, 32853, 8) },
    { name="Liberty Bay", position = Position(32317, 32826, 7) },
    { name="Roshamuul", position = Position(33513, 32363, 6) },
    { name="Gray beach", position = Position(33447, 31323, 9) },
    { name="Issavi", position = Position(33921, 31477, 5) },
    { name="Krailos", position = Position(33655, 31666, 8) },
    { name="Hunts Teleports", position = Position(31891, 32024, 8) },
    { name="Forge", position = Position(31646, 32043, 8) },
}



local teleportEvent = Action()

local teleportItemID = 31633 -- Replace with the actual item ID


function teleportEvent.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    -- if not player:isPlayer() then
    if not player:isVip() then
      player:sendCancelMessage("Somente players Vip podem usar este item!")
        return false
    end

    player:registerEvent("TeleportModalWindowLocations")

    local teleportWindow = ModalWindow(1, "Select a Location")
    for i, location in ipairs(teleportLocations) do
        teleportWindow:addChoice(i, location.name)
    end
    teleportWindow:addButton(0, "Select")
    teleportWindow:addButton(1, "Cancel")
    teleportWindow:setDefaultEnterButton(0)
    teleportWindow:setDefaultEscapeButton(1)
    teleportWindow:sendToPlayer(player)

    return true
end

function Player.ProcessTeleport(self, position)
    if not self or not position then return false end
    if self:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        self:sendTextMessage(MESSAGE_FAILURE, "Voce nao pode usar enquanto esta¡ em battle")
        return false
    end
    if self:isPzLocked() then
        self:sendTextMessage(MESSAGE_FAILURE, "Voce nao pode usar enquanto esta¡ em battle")
        return false
    end
    self:teleportTo(position)
    return true
end
    

teleportEvent:id(teleportItemID)
teleportEvent:register()

-- Create a modal window event
local modalEvent = CreatureEvent("TeleportModalWindowLocations")

function modalEvent.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("TeleportModalWindowLocations")
    if buttonId == 0 then
        local selectedLocation = teleportLocations[choiceId]
        if selectedLocation then
            player:teleportTo(selectedLocation.position)
        end
    end
    return true
end

modalEvent:type("modalwindow")
modalEvent:register()
 
Solution
I'm not sure which VIP system you have. If it's 'isVip', I've already fixed the script, okay? Check the screenshot I sent. It says that only VIPs can use the item!


Lua:
local teleportLocations  = {
    { name="Thais", position = Position(32369, 32241, 7) },
    { name="Edron", position = Position(33217, 31814, 8) },
    { name="Carlin", position = Position(32360, 31782, 7) },
    { name="Venore", position = Position(32957, 32076, 7) },
    { name="Ab'Dendriel", position = Position(32732, 31634, 7) },
    { name="Port Hope", position = Position(32594, 32745, 7) },
    { name="Yalahar", position = Position(32787, 31276, 7) },
    { name="Kazordoon", position = Position(32649, 31925, 11) },
    { name="Darashia", position = Position(33213...
I'm not sure which VIP system you have. If it's 'isVip', I've already fixed the script, okay? Check the screenshot I sent. It says that only VIPs can use the item!


Lua:
local teleportLocations  = {
    { name="Thais", position = Position(32369, 32241, 7) },
    { name="Edron", position = Position(33217, 31814, 8) },
    { name="Carlin", position = Position(32360, 31782, 7) },
    { name="Venore", position = Position(32957, 32076, 7) },
    { name="Ab'Dendriel", position = Position(32732, 31634, 7) },
    { name="Port Hope", position = Position(32594, 32745, 7) },
    { name="Yalahar", position = Position(32787, 31276, 7) },
    { name="Kazordoon", position = Position(32649, 31925, 11) },
    { name="Darashia", position = Position(33213, 32454, 1) },
    { name="Rathleton", position = Position(33594, 31899, 6) },
    { name="Svargrond", position = Position(32212, 31132, 7) },
    { name="Farmine", position = Position(33023, 31521, 11) },
    { name="Ankrahmun", position = Position(33194, 32853, 8) },
    { name="Liberty Bay", position = Position(32317, 32826, 7) },
    { name="Roshamuul", position = Position(33513, 32363, 6) },
    { name="Gray beach", position = Position(33447, 31323, 9) },
    { name="Issavi", position = Position(33921, 31477, 5) },
    { name="Krailos", position = Position(33655, 31666, 8) },
    { name="Hunts Teleports", position = Position(31891, 32024, 8) },
    { name="Forge", position = Position(31646, 32043, 8) },
}

local teleportItemID = 31633 -- Replace with the actual item ID

local teleportEvent = Action()

function teleportEvent.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:isVip() then
        player:sendCancelMessage("Somente jogadores VIP podem usar este item!")
        return true
    end
   
    player:registerEvent("TeleportModalWindowLocations")
   
    local teleportWindow = ModalWindow(1, "Selecione um Local")
    for i, location in ipairs(teleportLocations) do
        teleportWindow:addChoice(i, location.name)
    end
    teleportWindow:addButton(1, "Selecionar")
    teleportWindow:addButton(2, "Cancelar")
    teleportWindow:setDefaultEnterButton(1)
    teleportWindow:setDefaultEscapeButton(2)
    teleportWindow:sendToPlayer(player)
   
    return true
end

teleportEvent:id(teleportItemID)
teleportEvent:register()

local modalEvent = CreatureEvent("TeleportModalWindowLocations")

function modalEvent.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("TeleportModalWindowLocations")
   
    if buttonId == 1 then
        local selectedLocation = teleportLocations[choiceId]
        if selectedLocation then
            return player:ProcessTeleport(selectedLocation.position)
        end
    end
   
    return true
end

modalEvent:type("modalwindow")
modalEvent:register()

function Player.ProcessTeleport(self, position)
    if not self or not position then return false end
    if self:getCondition(CONDITION_INFIGHT) then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, "Você não pode se teleportar enquanto está em combate.")
        return false
    end
    if self:isPzLocked() then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, "Você não pode se teleportar enquanto está protegido por uma zona de paz.")
        return false
    end
   
    self:teleportTo(position)
    self:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
   
    return true
end

1710539955312.png
 
Solution
I'm not sure which VIP system you have. If it's 'isVip', I've already fixed the script, okay? Check the screenshot I sent. It says that only VIPs can use the item!


Lua:
local teleportLocations  = {
    { name="Thais", position = Position(32369, 32241, 7) },
    { name="Edron", position = Position(33217, 31814, 8) },
    { name="Carlin", position = Position(32360, 31782, 7) },
    { name="Venore", position = Position(32957, 32076, 7) },
    { name="Ab'Dendriel", position = Position(32732, 31634, 7) },
    { name="Port Hope", position = Position(32594, 32745, 7) },
    { name="Yalahar", position = Position(32787, 31276, 7) },
    { name="Kazordoon", position = Position(32649, 31925, 11) },
    { name="Darashia", position = Position(33213, 32454, 1) },
    { name="Rathleton", position = Position(33594, 31899, 6) },
    { name="Svargrond", position = Position(32212, 31132, 7) },
    { name="Farmine", position = Position(33023, 31521, 11) },
    { name="Ankrahmun", position = Position(33194, 32853, 8) },
    { name="Liberty Bay", position = Position(32317, 32826, 7) },
    { name="Roshamuul", position = Position(33513, 32363, 6) },
    { name="Gray beach", position = Position(33447, 31323, 9) },
    { name="Issavi", position = Position(33921, 31477, 5) },
    { name="Krailos", position = Position(33655, 31666, 8) },
    { name="Hunts Teleports", position = Position(31891, 32024, 8) },
    { name="Forge", position = Position(31646, 32043, 8) },
}

local teleportItemID = 31633 -- Replace with the actual item ID

local teleportEvent = Action()

function teleportEvent.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if not player:isVip() then
        player:sendCancelMessage("Somente jogadores VIP podem usar este item!")
        return true
    end
  
    player:registerEvent("TeleportModalWindowLocations")
  
    local teleportWindow = ModalWindow(1, "Selecione um Local")
    for i, location in ipairs(teleportLocations) do
        teleportWindow:addChoice(i, location.name)
    end
    teleportWindow:addButton(1, "Selecionar")
    teleportWindow:addButton(2, "Cancelar")
    teleportWindow:setDefaultEnterButton(1)
    teleportWindow:setDefaultEscapeButton(2)
    teleportWindow:sendToPlayer(player)
  
    return true
end

teleportEvent:id(teleportItemID)
teleportEvent:register()

local modalEvent = CreatureEvent("TeleportModalWindowLocations")

function modalEvent.onModalWindow(player, modalWindowId, buttonId, choiceId)
    player:unregisterEvent("TeleportModalWindowLocations")
  
    if buttonId == 1 then
        local selectedLocation = teleportLocations[choiceId]
        if selectedLocation then
            return player:ProcessTeleport(selectedLocation.position)
        end
    end
  
    return true
end

modalEvent:type("modalwindow")
modalEvent:register()

function Player.ProcessTeleport(self, position)
    if not self or not position then return false end
    if self:getCondition(CONDITION_INFIGHT) then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, "Você não pode se teleportar enquanto está em combate.")
        return false
    end
    if self:isPzLocked() then
        self:sendTextMessage(MESSAGE_STATUS_SMALL, "Você não pode se teleportar enquanto está protegido por uma zona de paz.")
        return false
    end
  
    self:teleportTo(position)
    self:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
  
    return true
end

View attachment 83018
wow!, Thank you very much, it worked very well for me +1
 
Excuse me, one more thing, could you help me place the modal window like this?
I'm only referring to the hunting areas, houses, cities, bosses!! PLEASE!!
Lua:
-- templos, self.house, self.temple, adventurers guild
-- Town(townId):getTemplePosition()
-- player:getTown():getTemplePosition()
CUBE_TELEPORT = {
    CITIES = {
        ["Thais"] = Town(TOWNS_LIST.THAIS):getTemplePosition() or nil,
        ["Ab'Dendriel"] = Town(TOWNS_LIST.AB_DENDRIEL):getTemplePosition() or nil,
        ["Carlin"] = Town(TOWNS_LIST.CARLIN):getTemplePosition() or nil,
        ["Kazordoon"] = Town(TOWNS_LIST.KAZORDOON):getTemplePosition() or nil,
        ["Venore"] = Town(TOWNS_LIST.VENORE):getTemplePosition() or nil,
        ["Ankrahmun"] = Town(TOWNS_LIST.ANKRAHMUN):getTemplePosition() or nil,
        ["Edron"] = Town(TOWNS_LIST.EDRON):getTemplePosition() or nil,
        ["Farmine"] = Town(TOWNS_LIST.FARMINE):getTemplePosition() or nil,
        ["Darashia"] = Town(TOWNS_LIST.DARASHIA):getTemplePosition() or nil,
        ["Liberty Bay"] = Town(TOWNS_LIST.LIBERTY_BAY):getTemplePosition() or nil,
        ["Port Hope"] = Town(TOWNS_LIST.PORT_HOPE):getTemplePosition() or nil,
        ["Svargrond"] = Town(TOWNS_LIST.SVARGROND):getTemplePosition() or nil,
        ["Yalahar"] = Town(TOWNS_LIST.YALAHAR):getTemplePosition() or nil,
        ["Gray Beach"] = Town(TOWNS_LIST.GRAY_BEACH):getTemplePosition() or nil,
        ["Krailos"] = Town(TOWNS_LIST.KRAILOS):getTemplePosition() or nil,
        ["Rathleton"] = Town(TOWNS_LIST.RATHLETON):getTemplePosition() or nil,
        ["Roshamuul"] = Town(TOWNS_LIST.ROSHAMUUL):getTemplePosition() or nil,
        ["Issavi"] = Town(TOWNS_LIST.ISSAVI):getTemplePosition() or nil,
        ["Adventurers' Guild"] = Position(32210, 32300, 6) or nil
    },
    EXTRAS = {
        ["NPC's"] = {
            ["Npc Imbuiments"] = Position(32360, 32240, 7),
            ["Xodet"] = Position(32399, 32219, 7),
            ["Tamoril"] = Position(32911, 31017, 5),
            ["lailene"] = Position(33280, 31845, 4),
            ["alexander"] = Position(33256, 31841, 3),
            ["haroun"] = Position(33108, 32527, 4),
            ["esrik"] = Position(33036, 31534, 12),
            ["yaman"] = Position(33047, 32621, 2),
        },
        ["Bosses"] = {
            ["Bosses Feyrist"] = Position(32209, 32094, 13),
            ["Ratmiral"] = Position(33891, 31197, 7),
            ["Tentugly's Head"] = Position(33838, 31431, 6),
            ["Scarlet"] = Position(33395, 32666, 6),
            ["Drume"] = Position(32459, 32507, 8),
            ["falcons"] = Position(33356, 31309, 4),
            ["Oberon"] = Position(33351, 31340, 9),
            ["Gray island"] = Position(33446, 31274, 14),
            ["Heart of Destruction"] = Position(32213, 31382, 14),
            ["Soul war"] = Position(33621, 31429, 10),
            ["Brainhead"] = Position(32625, 32078, 7),
            ["Leiden"] = Position(32669, 31542, 9),
            ["mini boss lion"] = Position(33123, 32235, 12),
            ["Boss Jaul"] = Position(33557, 31281, 11),
            ["W-zone 1,2,3"] = Position(32801, 31781, 10),
            ["W-zone 4,5,6"] = Position(33745, 32191, 14),
            ["W-zone 7,8,9"] = Position(32604, 31848, 10),
            ["Faceles Bane"] = Position(33618, 32521, 15),       
            ["King zelos"] = Position(32172, 31918, 8),
            ["Urmalulu Boss"] = Position(33920, 31607, 8),
            ["Count Vlarkorth"] = Position(33196, 31689, 8),
            ["Duke Krule"] = Position(32346, 32165, 12),
            ["Earl Osam"] = Position(33264, 31990, 7),
            ["Timira The Many-headed"] = Position(27613, 23887, 8),
            
        
        },
        ["Trainers"] = {
            -- ["trainers online"] = Position(12747, 15539, 5),
            ["trainers"] = Position(18960, 20455, 5),

        },
        ["Quests"] = {
            ["The pist of inferno"] = Position(32842, 32333, 11),
            ["The inquisition"] = Position(33192, 31687, 14),
            ["The anihilation"] = Position(33212, 31671, 13),
            ["Demon helmet"] = Position(33211, 31639, 13),

        },
        ["Locais de caça"] = {
            ["Asuras"] = Position(32949, 32691, 7),
            ["Banuta"] = Position(32892, 32633, 11),
            ["Boquinha roshamuul"] = Position(33675, 32470, 6),
            ["Prision Roshamuul"] = Position(33516, 32380, 11),
            ["Dragons Darashia"] = Position(33265, 32279, 7),
            ["Catacombs"] = Position(33663, 31884, 5),
            ["Hellspawn yalahar"] = Position(32881, 31051, 6),
            ["Drakens"] = Position(33084, 31214, 8),
            ["Gnomprona"] = Position(26910, 23842, 15),
            ["Marapur"] = Position(27545, 23995, 7),
            ["Biblioteca"] = Position(32177, 31928, 7),

        },       
        -- ["Trainers"] = Position(12743, 15539, 7),
        -- ["Bomber-man"] = Position(32401, 32207, 7),
        
        -- ["Npc Xodet"] = Position(32400, 32220, 7),
        -- ["Soul war"] = Position(33621, 31431, 10),
        -- ["Inqui"] = Position(33168, 31713, 14),
        -- ["Poi quest"] = Position(32839, 32232, 13),
        -- ["Asuras"] = Position(32949, 32691, 7),
        -- ["Banuta"] = Position(32892, 32633, 11),
        -- ["Boquinha roshamuul"] = Position(33675, 32470, 6),
        -- ["Prision Roshamuul"] = Position(33516, 32380, 11),
        -- ["Dragons Darashia"] = Position(33265, 32279, 7),
        -- ["W-zone"] = Position(32801, 31781, 10),
        -- ["New-warzones"] = Position(32604, 31848, 10),
        -- ["Cobras"] = Position(33314, 32646, 6),
        -- ["Falcons"] = Position(33198, 31764, 1),
        -- ["Lions"] = Position(32424, 32445, 7),
        -- ["Catacombs"] = Position(33663, 31884, 5),
        -- ["Leiden Boss"] = Position(32669, 31542, 9),
        -- ["Hellspawn yalahar"] = Position(32881, 31051, 6),
        -- ["Drakens"] = Position(33084, 31214, 8),
        -- ["Bosses Feyrist"] = Position(32209, 32094, 13),
        -- ["Boss Jaul"] = Position(33558, 31282, 11),
        -- ["mini boss lion"] = Position(33123, 32235, 12),
        -- ["rascoohan Isle"] = Position(33774, 31346, 7),
        -- ["heart of destruction"] = Position(32213, 31382, 14),
    },
    EXAUST_STORAGE = 1564849,
    EXAUST_TIME = 20, -- in seconds
    EXAUST = false,
}

function CUBE_TELEPORT:SHOW_MODAL(playerId)
    if not playerId then return false end
    local player = Player(playerId)
    if not player then return false end
    
    if self.EXAUST then
        if player:getStorageValue(self.EXAUST_STORAGE) > os.time() then
            player:sendTextMessage(MESSAGE_FAILURE, "Voce precisa esperar o cooldown")
            return true
        end
    end
    
    player:setStorageValue(self.EXAUST_STORAGE, os.time() + self.EXAUST_TIME)
    local window = ModalWindow {
        title = 'Cube Teleport',
        message = 'Onde quer ir?.'
    }
    
    local choice = window:addChoice("Cidades")
    choice.id = 1
    local choice = window:addChoice("House")
    choice.id = 2
    
    for groupName, data in pairs(self.EXTRAS) do
        local choice = window:addChoice(groupName)
        choice.groupName = groupName
        choice.data = data
    end
    
    window:addButton('Choose',
        function(button, choice)
            if choice.id == 1 then
                self:SHOW_MODAL_CITIES(playerId)
            elseif choice.id == 2 then
                self:SHOW_MODAL_HOUSE(playerId)
            else
                self:SHOW_MODAL_EXTRA_GROUP(playerId, choice.groupName, choice.data)
            end
        end
    )
    
    window:addButton('Close',
        function(button, choice)
        end
    )
    
    window:setDefaultEnterButton('Choose')
    window:setDefaultEscapeButton('Choose')
    window:sendToPlayer(player)
end

function CUBE_TELEPORT:SHOW_MODAL_EXTRA_GROUP(playerId, groupName, data)
    if not playerId or not data or not groupName then return false end
    local player = Player(playerId)
    if not player then return false end
    
    local window = ModalWindow {
        title = groupName,
        message = 'Escolha.'
    }
    
    for localName, pos in pairs(data) do
        local choice = window:addChoice(localName)
        choice.position = pos
    end
    
    -- for extra, position in pairs(self.EXTRAS) do
        -- if position then
            -- local choice = window:addChoice(extra)
            -- choice.position = position
        -- end
    -- end
    
    window:addButton('Go',
        function(button, choice)
            if choice.position then
                -- player:teleportTo(choice.position)
                player:ProcessCubeTeleport(choice.position)
            end
        end
    )
    
    window:addButton('Close',
        function(button, choice)
        end
    )
    
    window:setDefaultEnterButton('Go')
    window:setDefaultEscapeButton('Go')
    window:sendToPlayer(player)
end

function CUBE_TELEPORT:SHOW_MODAL_CITIES(playerId)
    if not playerId then return false end
    local player = Player(playerId)
    if not player then return false end
    
    local window = ModalWindow {
        title = 'Cidades',
        message = 'Escolha a cidade.'
    }
    
    for cidade, position in pairs(self.CITIES) do
        if position then
            local choice = window:addChoice(cidade)
            choice.position = position
        end
    end
    
    window:addButton('Go',
        function(button, choice)
            -- player:teleportTo(choice.position)
            player:ProcessCubeTeleport(choice.position)
        end
    )
    
    window:addButton('Close',
        function(button, choice)
        end
    )
    
    window:setDefaultEnterButton('Go')
    window:setDefaultEscapeButton('Go')
    window:sendToPlayer(player)
end

function CUBE_TELEPORT:SHOW_MODAL_HOUSE(playerId)
    if not playerId then return false end
    local player = Player(playerId)
    if not player then return false end
    
    local window = ModalWindow {
        title = 'Meus locais',
        message = 'Escolha.'
    }
    
    local house = player:getHouse()
    if house then
        local house_position = house:getExitPosition()
        if house_position then
            local choice = window:addChoice("House")
            choice.position = house_position
        end
    else
        local choice = window:addChoice("Voce nao tem house")
        choice.position = nil
    end
    
    local town = player:getTown()
    if town then
        if town:getId() < 5 then
            town = Town(8)
        end
        local townPosition = town:getTemplePosition()
        if townPosition then
            local choice = window:addChoice("My City")
            choice.position = townPosition
        end

    end
    
    window:addButton('Go',
        function(button, choice)
            if choice.position then
                -- player:teleportTo(choice.position)
                player:ProcessCubeTeleport(choice.position)
            end
        end
    )
    
    window:addButton('Close',
        function(button, choice)
        end
    )
    
    window:setDefaultEnterButton('Go')
    window:setDefaultEscapeButton('Go')
    window:sendToPlayer(player)
end

function Player.ProcessCubeTeleport(self, position)
    if not self or not position then return false end
    if self:getCondition(CONDITION_INFIGHT, CONDITIONID_DEFAULT) then
        self:sendTextMessage(MESSAGE_FAILURE, "Voce nao pode usar enquanto esta¡ em battle")
        return false
    end
    if self:isPzLocked() then
        self:sendTextMessage(MESSAGE_FAILURE, "Voce nao pode usar enquanto esta¡ em battle")
        return false
    end
    self:teleportTo(position)
    return true
end
 
Back
Top