Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- gsto = 21216, -- Não precisa mexer
- tempo = 30, -- Tempo em Segundos para Resetar
- rockID = 1497, -- ID da Pedra
- rockPos = {x=000, y=000, z=0}, -- Posição da Pedra
- ordem = {
- [1] = {posX = 1234}, -- PosX da Primeira Alavanca
- [2] = {posX = 1235}, -- PosX da Segunda Alavanca
- [3] = {posX = 1236}, -- PosX da Terceira Alavanca
- },
- msg = {
- [1] = "Primeira alavanca liberada",
- [2] = "Segunda alavanca liberada",
- [3] = "A pedra foi removida, você tem 2 minutos até a pedra aparecer",
- },
- }
- function onUse(cid, item, fromPosition, itemEx, toPosition)
- getOrder = getLeverOrdemBySwatt(getThingPosition(item.uid))
- if getGlobalStorageValue(config.gsto) < 0 then setGlobalStorageValue(config.gsto, 0) end
- gstorage = getGlobalStorageValue(config.gsto)
- if getOrder == (gstorage+1) and (gstorage+1) < 4 then
- setGlobalStorageValue(config.gsto, getOrder+1)
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msg[getOrder])
- if getGlobalStorageValue(config.gsto) == 4 then
- rock = getTileItemById(config.rockPos, config.rockID)
- if rock.uid > 0 then
- doRemoveItem(rock.uid)
- doSendMagicEffect(config.rockPos, CONST_ME_POFF)
- addEvent(function()
- doSendMagicEffect(config.rockPos, CONST_ME_POFF)
- doCreateItem(config.rockID, 1, config.rockPos)
- setGlobalStorageValue(config.gsto, 0)
- end, config.tempo * 1000)
- end
- end
- if(item.itemid == 1946) then
- doTransformItem(item.uid, item.itemid - 1)
- else
- doTransformItem(item.uid, item.itemid + 1)
- end
- else
- doPlayerSendCancel(cid, "You need follow the lever's order or wait the block rock reset.")
- return false
- end
- end
- function getLeverOrdemBySwatt(pos)
- local order = 0
- for a = 1, #config.ordem do
- if config.ordem[a].posX == pos.x then
- order = a
- end
- end
- return order
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement