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

Teleport pad modalwindow

Solution
So to use it just set an action id on the tile in map editor...Set that same action id in the movevent code. Each teleport is linked to the ID in the moveevent code. So to add or remove them make sure you edit the ID in movevent and creaturescript the same.

Make sure you add the actionID into your movevents.xml also.

movevent
Lua:
local tiles = {
    [1000] = {
        title = "First Teleport Title",
        desc = "First Teleport Description",
        teleports = {
            [1] = {id = 0x00, text = "Teleport 1 - 100gp"},
            [2] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [3] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [4] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [5] = {id = 0x04, text =...
I would help with this man but I really want that to be recoded. It is very un-clean. I would be more interested in setting up a whole new code for you rather then mess with this one. Let me know.
 
So to use it just set an action id on the tile in map editor...Set that same action id in the movevent code. Each teleport is linked to the ID in the moveevent code. So to add or remove them make sure you edit the ID in movevent and creaturescript the same.

Make sure you add the actionID into your movevents.xml also.

movevent
Lua:
local tiles = {
    [1000] = {
        title = "First Teleport Title",
        desc = "First Teleport Description",
        teleports = {
            [1] = {id = 0x00, text = "Teleport 1 - 100gp"},
            [2] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [3] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [4] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [5] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    },
    [1001] = {
        title = "Second Teleport Title",
        desc = "Second Teleport Description",
        teleports = {
            [1] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [2] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [3] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [4] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    }
}
function onStepIn(player, item, position, fromPosition)
    local TILE = tiles[item:getActionId()]
    if not TILE then return true end
    if not player:isPlayer() then return true end
 
    local window = ModalWindow(1860, TILE.title, TILE.desc)
 
    for i = 1, #TILE.teleports do
        window:addChoice(TILE.teleports[i].id, TILE.teleports[i].text)
    end
 
    window:addButton(0x00, "Teleport")
    window:addButton(0x01, "Close")
    window:setDefaultEnterButton(0x00)
    window:sendToPlayer(player)
return true
end

Creaturescript
Lua:
local teleports = {
    [0x00] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x01] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x02] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x03] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x04] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}}
}
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    if modalWindowId ~= 1860 then return true end
 
    if buttonId == 0x01 then return true end
 
    local CHOICE = teleports[choiceId]
 
    if not CHOICE then return true end
 
    if player:removeMoney(CHOICE.cost) then
        player:teleportTo(CHOICE.pos)
    else
        player:sendCancelMessage("This teleport costs "..CHOICE.cost.." to use.")
    end
return true
end

If you need anything added let me know. You can put all the teleport tiles into one code.
 
Last edited:
Solution
i have a doubt, here on creaturescripts:

Code:
local teleports = {
    [0x00] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x01] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x02] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x03] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}},
    [0x04] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}}

should i change these on the movements? shouldnt they be differents? the "0x04" and no repeat on teleports?

Code:
       teleports = {
            [1] = {id = 0x00, text = "Teleport 1 - 100gp"},
            [2] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [3] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [4] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [5] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    },
    [1001] = {
        title = "Second Teleport Title",
        desc = "Second Teleport Description",
        teleports = {
            [1] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [2] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [3] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [4] = {id = 0x04, text = "Teleport 5 - 100gp"}

ill test it rn
 
It is set up so you can have the same teleports in multiple teleport tiles. If you want to add new teleports just add new ID's.

For example if you want a new teleport in the second teleport tile add:

[5] = {id = 0x05, text = "Teleport 6 - 100 gp"}

into the movevent and add

[0x05] = {cost = 100, pos = {x = 1000, y = 1000, z = 7}

into the creaturescript.
 
got this error on console

heres the script

Code:
local tiles = {
    [3402] = {
        title = "Wind Nations Spots",
        desc = "Wind Nation",
        teleports = {
            [1] = {id = 0x00, text = "Rotworms - 100gp"},
            [2] = {id = 0x01, text = "Hero Fortress - 100gp"},
            [3] = {id = 0x02, text = "Asura Palace - 100gp"},
            [4] = {id = 0x03, text = "Mistrock - 100gp"},
            [5] = {id = 0x04, text = "Oramond - 100gp"}
        }
    },
    [3403] = {
        title = "Second Teleport Title",
        desc = "Second Teleport Description",
        teleports = {
            [1] = {id = 0x01, text = "Teleport 2 - 100gp"},
            [2] = {id = 0x02, text = "Teleport 3 - 100gp"},
            [3] = {id = 0x03, text = "Teleport 4 - 100gp"},
            [4] = {id = 0x04, text = "Teleport 5 - 100gp"}
        }
    }
}
function onStepIn(player, item, position, fromPosition)
    local TILE = tiles[item:getActionId()]
    if not TILE then return true end
    if not player:isPlayer() return true end
    local window = ModalWindow(1860, TILE.title, TILE.desc)
    for i = 1, #TILE.teleports do
        window:addChoice(TILE.teleports[i].id, TILE.teleports[i].text)
    end
    window:addButton(0x00, "Teleport")
    window:addButton(0x01, "Close")
    window:setDefaultEnterButton(0x00)
    window:sendToPlayer(player)
return true
end
 

Attachments

In moveevent change:

Lua:
if not player:isPlayer() return true end

to

Lua:
if not player:isPlayer() then return true end
 
it shows the modal window and the descriptions, but it doesnt teleport you nowhere, i edited the creaturescripts positions
no error on console


ps: i dont have nothing on creaturescripts.xml maybe this has something to do
only this

<event type="modalwindow" name="tp_pad" script="tp_pad.lua"/>
 
creaturescript
Code:
local teleports = {
    [0x00] = {cost = 0, pos = {x = 314, y = 102, z = 7}},
    [0x01] = {cost = 0, pos = {x = 675, y = 245, z = 7}},
    [0x02] = {cost = 0, pos = {x = 765, y = 451, z = 7}},
    [0x03] = {cost = 0, pos = {x = 862, y = 598, z = 7}},
    [0x04] = {cost = 0, pos = {x = 872, y = 933, z = 6}}
}
function onModalWindow(player, modalWindowId, buttonId, choiceId)
    if modalWindowId ~= 1860 then return true end
    if buttonId == 0x01 then return true end
    local CHOICE = teleports[choiceId]
    if not CHOICE then return true end
    if player:removeMoney(CHOICE.cost) then
        player:teleportTo(CHOICE.pos)
    else
        player:sendCancelMessage("This teleport costs "..CHOICE.cost.." to use.")
    end
return true
end

login.lua
Code:
local events = {
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'Razzagorn',
    'Shatterer',
    'Zamulosh',   
    'The Hunger',
    'The Rage',
    'Eradicator',
    'Eradicator1',
    'Rupture',
    'World Devourer',   
    'Tarbaz',
    'Shulgrax',
    'Ragiaz',
    'Plagirath',
    'Mazoran',
    'Destabilized',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'KillingInTheNameOfKillss',
    'KillingInTheNameOfKillsss',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'WarzoneThree',
    'PlayerDeath',
    'AdvanceSave',
    'bossesWarzone',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot',
    'Yielothax',
    'BossParticipation',
    'Energized Raging Mage',
    'Raging Mage',
    'modalMD1',
    'VibrantEgg',
    'DeathCounter',
    'KillCounter',
    'bless1'
}
local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end
    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end
    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end
function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
  
    local playerId = player:getId()
    -- Stamina
    nextUseStaminaTime[playerId] = 1
    -- STAMINA DEVIDO A QUEDAS START
  
    --local stamina_full = 42 * 60 -- config. 42 = horas
   -- if player:getStamina() >= stamina_full then
      --  player:sendCancelMessage("Your stamina is already full.")
   -- elseif player:getPremiumDays() < 1 then
     --   player:sendCancelMessage("You must have a premium account.")
   -- else
      --  player:setStamina(stamina_full)
     -- player:sendTextMessage(MESSAGE_INFO_DESCR, "Your stamina has been refilled.")     
   -- end
  
    -- STAMINA DEVIDO A QUEDAS END
  
    -- Promotion
   --[[ local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end--]]
  
     -- ABRIR CHANNELS
    if(not isInArray({1,2,3,5,6,7,8}, player:getVocation():getId()) or player:getLevel() < 6) then
   -- player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat
    player:openChannel(6)   -- advertsing rook main
    else
  --  player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat
    player:openChannel(5)   -- advertsing main
    end
  
    --
    -- Rewards
    local rewards = #player:getRewardList()
    if(rewards > 0) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %d %s in your reward chest.", rewards, rewards > 1 and "rewards" or "reward"))
    end
    -- Update player id
    local stats = player:inBossFight()
    if stats then
        stats.playerId = player:getId()
    end
    -- fury gates
  
    if Game.getStorageValue(GlobalStorage.FuryGates, (9710)) == 1 then -- for venore
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Venore Today.')
elseif Game.getStorageValue(GlobalStorage.FuryGates, (9711)) == 2 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Abdendriel Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9712)) == 3 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Thais Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9713)) == 4 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Carlin Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9714)) == 5 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Edron Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9716)) == 6 then -- for ab...
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Kazordoon Today.')
      end
    
  
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[INFORMATION] At your first login, please when you select your nation re-log to save it.')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BONUS EXP] Command for check !exp.')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[NATIONS WAR] Check the webpage and you can see the score of your nation.')
  
    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end
    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
    return true
end

creaturescripts.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>

    <event type="preparedeath" name="BFPrepareDeath" script="battlefield.lua" />
    <event type="healthchange" name="BFHealthChange" script="battlefield.lua" />
    <event type="manachange" name="BFManaChange" script="battlefield.lua" />
    <event type="logout" name="BFLogout" script="battlefield.lua" />

<event type="preparedeath" name="CTFDeath" script="ctf.lua" />
<event type="healthchange" name="CTFHealthChange" script="ctf.lua" />

<event type="death" name="DeathCounter" script="kdcounter.lua" />
<event type="kill" name="KillCounter" script="kdcounter.lua" />
  <event type="modalwindow" name="tp_pad" script="tp_pad.lua"/>
  
    <!-- Skill Points -->
    <event type="modalwindow" name="skillPoints_modal" script="sp.lua"/>
    <event type="advance" name="skillPoints_advance" script="sp.lua"/>
    <event type="login" name="skillPoints_register" script="sp.lua"/>

    <!-- WARZONE BOSS -->
  <event type="death" name="WarzoneBossDeath" script="warzone157.lua" />
 
  <!-- Reward Chest 19/01 -->   
    <event type="modalwindow" name="ModalWindowHelper" script="modalwindowhelper.lua" /> 
   
    <event type="logout" name="CityWarLogout" script="citywar.lua" />
    <event type="preparedeath" name="CityWarDeath" script="citywar.lua" />
    <event type="textedit" name="CityWarInvite" script="citywar.lua" />
 
     <event type="death" name="BossDeath" script="rewardChest/boss.lua" />
     <event type="healthchange" name="BossParticipation" script="rewardChest/boss.lua" />
     <event type="think" name="BossThink" script="rewardChest/boss.lua" />

    <!-- Bigfoot Burden Quest -->
    <event type="kill" name="Razzagorn" script="Novos/Razzagorn.lua"/>   
    <event type="kill" name="Shatterer" script="Novos/The Shatterer.lua"/>   
    <event type="kill" name="Zamulosh" script="Novos/Zamulosh.lua"/>   
    <event type="kill" name="Tarbaz" script="Novos/Tarbaz.lua"/>
    <event type="kill" name="Shulgrax" script="Novos/Shulgrax.lua"/>
   
    <event type="kill" name="Ragiaz" script="Novos/Ragiaz.lua"/>
    <event type="kill" name="Plagirath" script="Novos/Plagirath.lua"/>
    <event type="kill" name="Mazoran" script="Novos/Mazoran.lua"/>
   
    <event type="kill" name="Destabilized" script="Novos/Destabilized Ferumbras.lua"/>
   
    <!-- 10.94 -->
    <event type="kill" name="The Hunger" script="Novos/The Hunger.lua"/>
    <event type="kill" name="The Rage" script="Novos/The Rage.lua"/>   
    <event type="kill" name="Rupture" script="Novos/Rupture.lua"/>
    <event type="kill" name="World Devourer" script="Novos/World Devourer.lua"/>
   
    <event type="kill" name="Eradicator" script="Novos/Eradicator.lua"/>
    <event type="kill" name="Eradicator1" script="Novos/Eradicator1.lua"/>
   
    <event type="kill" name="BigfootBurdenVersperoth" script="quests/bigfoot burden/VersperothKill.lua" />
    <event type="kill" name="WarzoneThree" script="gnomebase/warzone3.lua"/>
    <event type="kill" name="BigfootBurdenWiggler" script="quests/bigfoot burden/WigglerKill.lua" />
    <event type="kill" name="bossesWarzone" script="gnomebase/bossesWarzone.lua"/>


  <event type="preparedeath" name="ZumbiDeath" script="ZE_creaturescript.lua"/>
<!--<event type="preparedeath" name="ZumbiDeath1" script="ZE_creaturescript1.lua"/>-->
     <!-- REWARD CHEST -->

    <event type="advance" name="Recompense" script="others/recompense.lua"/>
    <!--<event type="modalwindow" name="modalAD" script="custom/modalAD.lua"/>
    <event type="modalwindow" name="modalMD" script="custom/modalMD.lua"/>-->
    <event type="modalwindow" name="modalMD1" script="custom/modalMD1.lua"/>
    <event type="modalwindow" name="VibrantEgg" script="custom/VibrantEgg.lua"/>
   
    <!-- ragingmagetower -->
    <event type="kill" name="Yielothax" script="ragingmagetower/yielothax.lua"/>
    <event type="kill" name="Energized Raging Mage" script="ragingmagetower/energized.lua"/>
    <event type="kill" name="Raging Mage" script="ragingmagetower/raging.lua"/>

   
    <event type="login" name="bless1" script="freeblesslowlevel.lua"/>
    <!-- BattleField Event -->
    <event type="login" name="battleflogin" script="others/battlefield.lua"/>
    <event type="preparedeath" name="battledeath" script="others/battlefield.lua"/>
   
    <event type="login" name="battleflogin1" script="others/battlefield1.lua"/>
    <event type="preparedeath" name="battledeath1" script="others/battlefield1.lua"/>
   
   

    <!-- Rookgaard Cockroach -->
    <event type="advance" name="AdvanceRookgaard" script="rookgaard/advance.lua" />

    <!-- Elemental Spheres Quest -->
    <event type="kill" name="ElementalSpheresOverlords" script="quests/elemental spheres/OverlordsKill.lua" />

   
    <!-- Svargrond Arena: Killing a boss -->
    <event type="kill" name="SvargrondArenaKill" script="quests/svargrond arena/arena_kill.lua" />

    <!-- The New Frontier Quest -->
    <event type="kill" name="NewFrontierShardOfCorruption" script="quests/the new frontier/ShardOfCorruption.lua" />
    <event type="kill" name="NewFrontierTirecz" script="quests/the new frontier/TireczKill.lua" />

    <!-- In Service Of Yalahar Quest -->
    <event type="kill" name="ServiceOfYalaharAzerus" script="quests/in service of yalahar/AzerusKill.lua" />
    <event type="kill" name="ServiceOfYalaharDiseasedTrio" script="quests/in service of yalahar/DiseasedTrioKill.lua" />
    <event type="kill" name="ServiceOfYalaharQuaraLeaders" script="quests/in service of yalahar/QuaraLeadersKill.lua" />

    <!-- Inquisition Quest -->
    <event type="kill" name="InquisitionBosses" script="quests/inquisition/inquisitionQuestBosses.lua" />
    <event type="kill" name="InquisitionUngreez" script="quests/inquisition/inquisitionQuestUngreez.lua" />

    <!-- Killing In The Name Of Quest -->
    <event type="kill" name="KillingInTheNameOfKills" script="quests/killing in the name of/kills.lua" />
   
    <event type="kill" name="KillingInTheNameOfKillss" script="necro.lua" />
    <event type="kill" name="KillingInTheNameOfKillsss" script="minos.lua" />

    <!-- The Masters Voice Quest -->
    <event type="kill" name="MastersVoiceServants" script="quests/their master's voice/ServantsKill.lua" />

    <!-- Thieves Guild Quest -->
    <event type="kill" name="ThievesGuildNomad" script="others/nomad.lua" />

    <!-- Secret Service Quest -->
    <event type="kill" name="SecretServiceBlackKnight" script="others/blackKnight.lua" />

    <!-- Wrath of the Emperor Quest -->
    <event type="kill" name="WotELizardMagistratus" script="quests/wrath of the emperor/lizardmagistratus.lua" />
    <event type="kill" name="WotELizardNoble" script="quests/wrath of the emperor/lizardnoble.lua" />
    <event type="kill" name="WotEKeeper" script="quests/wrath of the emperor/keeper.lua" />
    <event type="kill" name="WotEBosses" script="quests/wrath of the emperor/bosses.lua" />
    <event type="kill" name="WotEZalamon" script="quests/wrath of the emperor/zalamon.lua" />

    <!-- Pythius The Rotten (Firewalker Boots Quest) -->
    <event type="kill" name="PythiusTheRotten" script="others/PythiusTheRotten.lua" />

    <!-- Others -->
    <event type="login" name="PlayerLogin" script="others/login.lua" />
    <event type="login" name="FirstItems" script="others/firstitems.lua" />
    <event type="login" name="RegenerateStamina" script="others/regeneratestamina.lua" />
    <event type="login" name="OfflineTraining" script="others/offlinetraining.lua" />
    <event type="login" name="AddonsMounts" script="others/addons-montarias.lua"/>
    <event type="logout" name="PlayerLogout" script="others/logout.lua" />

    <event type="death" name="PlayerDeath" script="others/playerdeath.lua" />
    <event type="death" name="DropLoot" script="others/droploot.lua" />
    <event type="advance" name="AdvanceSave" script="others/advance_save.lua" />
    <event type="death" name="WhiteDeerDeath" script="others/whitedeer.lua" />
    <event type="death" name="WhiteDeerScoutsDeath" script="others/whitedeer_scouts.lua" />
</creaturescripts>
 
Change login.lua to this

Lua:
local events = {
    'ElementalSpheresOverlords',
    'BigfootBurdenVersperoth',
    'Razzagorn',
    'Shatterer',
    'Zamulosh',  
    'The Hunger',
    'The Rage',
    'Eradicator',
    'Eradicator1',
    'Rupture',
    'World Devourer',  
    'Tarbaz',
    'Shulgrax',
    'Ragiaz',
    'Plagirath',
    'Mazoran',
    'Destabilized',
    'BigfootBurdenWiggler',
    'SvargrondArenaKill',
    'NewFrontierShardOfCorruption',
    'NewFrontierTirecz',
    'ServiceOfYalaharDiseasedTrio',
    'ServiceOfYalaharAzerus',
    'ServiceOfYalaharQuaraLeaders',
    'InquisitionBosses',
    'InquisitionUngreez',
    'KillingInTheNameOfKills',
    'KillingInTheNameOfKillss',
    'KillingInTheNameOfKillsss',
    'MastersVoiceServants',
    'SecretServiceBlackKnight',
    'ThievesGuildNomad',
    'WotELizardMagistratus',
    'WotELizardNoble',
    'WotEKeeper',
    'WotEBosses',
    'WotEZalamon',
    'WarzoneThree',
    'PlayerDeath',
    'AdvanceSave',
    'bossesWarzone',
    'AdvanceRookgaard',
    'PythiusTheRotten',
    'DropLoot',
    'Yielothax',
    'BossParticipation',
    'Energized Raging Mage',
    'Raging Mage',
    'modalMD1',
    'VibrantEgg',
    'DeathCounter',
    'KillCounter',
    'bless1',
    'tp_pad'
}
local function onMovementRemoveProtection(cid, oldPosition, time)
    local player = Player(cid)
    if not player then
        return true
    end
    local playerPosition = player:getPosition()
    if (playerPosition.x ~= oldPosition.x or playerPosition.y ~= oldPosition.y or playerPosition.z ~= oldPosition.z) or player:getTarget() then
        player:setStorageValue(Storage.combatProtectionStorage, 0)
        return true
    end
    addEvent(onMovementRemoveProtection, 1000, cid, oldPosition, time - 1)
end
function onLogin(player)
    local loginStr = 'Welcome to ' .. configManager.getString(configKeys.SERVER_NAME) .. '!'
    if player:getLastLoginSaved() <= 0 then
        loginStr = loginStr .. ' Please choose your outfit.'
        player:sendTutorial(1)
    else
        if loginStr ~= '' then
            player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)
        end

        loginStr = string.format('Your last visit was on %s.', os.date('%a %b %d %X %Y', player:getLastLoginSaved()))
    end
    player:sendTextMessage(MESSAGE_STATUS_DEFAULT, loginStr)

    local playerId = player:getId()
    -- Stamina
    nextUseStaminaTime[playerId] = 1
    -- STAMINA DEVIDO A QUEDAS START

    --local stamina_full = 42 * 60 -- config. 42 = horas
   -- if player:getStamina() >= stamina_full then
      --  player:sendCancelMessage("Your stamina is already full.")
   -- elseif player:getPremiumDays() < 1 then
     --   player:sendCancelMessage("You must have a premium account.")
   -- else
      --  player:setStamina(stamina_full)
     -- player:sendTextMessage(MESSAGE_INFO_DESCR, "Your stamina has been refilled.")    
   -- end

    -- STAMINA DEVIDO A QUEDAS END

    -- Promotion
   --[[ local vocation = player:getVocation()
    local promotion = vocation:getPromotion()
    if player:isPremium() then
        local value = player:getStorageValue(Storage.Promotion)
        if not promotion and value ~= 1 then
            player:setStorageValue(Storage.Promotion, 1)
        elseif value == 1 then
            player:setVocation(promotion)
        end
    elseif not promotion then
        player:setVocation(vocation:getDemotion())
    end--]]

     -- ABRIR CHANNELS
    if(not isInArray({1,2,3,5,6,7,8}, player:getVocation():getId()) or player:getLevel() < 6) then
   -- player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat
    player:openChannel(6)   -- advertsing rook main
    else
  --  player:openChannel(7)   -- help channel
    player:openChannel(3)   -- world chat
    player:openChannel(5)   -- advertsing main
    end

    --
    -- Rewards
    local rewards = #player:getRewardList()
    if(rewards > 0) then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, string.format("You have %d %s in your reward chest.", rewards, rewards > 1 and "rewards" or "reward"))
    end
    -- Update player id
    local stats = player:inBossFight()
    if stats then
        stats.playerId = player:getId()
    end
    -- fury gates

    if Game.getStorageValue(GlobalStorage.FuryGates, (9710)) == 1 then -- for venore
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Venore Today.')
elseif Game.getStorageValue(GlobalStorage.FuryGates, (9711)) == 2 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Abdendriel Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9712)) == 3 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Thais Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9713)) == 4 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Carlin Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9714)) == 5 then -- for ab...
      player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Edron Today.')
      elseif Game.getStorageValue(GlobalStorage.FuryGates, (9716)) == 6 then -- for ab...
     player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Fury Gate is on Kazordoon Today.')
      end
   

        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[INFORMATION] At your first login, please when you select your nation re-log to save it.')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[BONUS EXP] Command for check !exp.')
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, '[NATIONS WAR] Check the webpage and you can see the score of your nation.')

    -- Events
    for i = 1, #events do
        player:registerEvent(events[i])
    end
    if player:getStorageValue(Storage.combatProtectionStorage) <= os.time() then
        player:setStorageValue(Storage.combatProtectionStorage, os.time() + 10)
        onMovementRemoveProtection(playerId, player:getPosition(), 10)
    end
    return true
[LIST=1]
[*]end
[/LIST]
 
Back
Top