Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Visite Xtibia.com para saber mais.
- Créditos Caronte ]]
- -- Crie um arquivo.lua em Creaturescripts/scripts
- -- Nele adicione:
- --------------------------------
- function onModalWindow(player, modalWindowId, buttonId, choiceId)
- if modalWindowId == 5468 then
- local entry = player:getStorageValue(5468)
- if (entry == (nil or -1)) or tonumber(entry) > 123 then
- entry = ""
- end
- if buttonId == 100 then
- dofile('data/movements/scripts/passwordTile.lua')
- --creature:setNoMove(false)
- if tonumber(entry) == password then
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "Welcome")
- player:getPosition():sendMagicEffect(13)
- player:unregisterEvent("modal_password")
- addEvent(function() player:setStorageValue(5468, -1) end, 10000)
- else
- player:teleportTo(fromPos)
- player:getPosition():sendMagicEffect(14)
- player:sendTextMessage(MESSAGE_STATUS_SMALL, "Get OFF")
- player:unregisterEvent("modal_password")
- player:setStorageValue(5468, -1)
- end
- else
- entry = entry .."".. (buttonId - 100)
- player:setStorageValue(5468, (tonumber(entry)))
- return pass_window:sendToPlayer(player)
- end
- end
- if modalWindowId == 5469 then
- pass_window:sendToPlayer(player)
- end
- return
- end
- -------------------------
- --[[ Agora em creaturescripts.xml adicione a seguinte tag:
- <event type="ModalWindow" name="modal_password" script="modalpass.lua" />
- ]]
- -- Crie um arquivo.lua em Movements/scripts
- -- Nele adicione:
- -----------------------
- function onStepIn(creature, item, position, fromPosition)
- password = 123
- if creature:getStorageValue(5468) == password then
- creature:sendTextMessage(MESSAGE_STATUS_SMALL, "Welcome")
- creature:getPosition():sendMagicEffect(13)
- return true
- end
- dofile('data/lib/passwordWindow.lua')
- creature:registerEvent("modal_password")
- fpass_window:sendToPlayer(creature)
- --creature:setNoMove(true)
- fromPos = fromPosition
- return true
- end
- --------------------------
- --[[ Agora em movements.xml adicione a seguinte tag:
- <movevent event="StepIn" actionid="5468" script="passwordTile.lua" />
- ]]
- -- Por último e não menos importante, crie um aquivo em data/lib, e adicione isto dentro:
- pass_title = "Password Please!"
- pass_message = "To pass, you have to digit your password!"
- pass_window = ModalWindow(5468, pass_title, pass_message)
- pass_window:addButton(103, "3")
- pass_window:addButton(100, "Ok")
- pass_window:addButton(102, "2")
- pass_window:addButton(101, "1")
- pass_window:setDefaultEnterButton(100)
- fpass_window = ModalWindow(5469, "Notification", "Opsss, to continue you have to digit password!")
- fpass_window:addButton(100, "Ok")
- fpass_window:setDefaultEnterButton(100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement