Postado Setembro 10, 2022 2 anos Salve TibiaKing!!! TFS 0.4 . 8.60 Estou implementando o Sistema do @WooX de Cave Exlusiva Link: Porem estou com um problema seguindo o tutorial completo dele acabo tendo um retorno de erro na Distro! E ja que o mesmo nao entra no forum deis de 14/01! Venho solicitar ajuda de vocês! Caso alguem tenha o Discord Dele Favor me Passe Vamos lá! Erro: Spoiler [12:42:35.898] [Error - Action Interface] [12:42:35.898] data/actions/scripts/cave_exclusiva/cave_action.lua:onUse [12:42:35.899] Description: [12:42:35.899] data/actions/scripts/cave_exclusiva/cave_action.lua:10: attempt to index field '?' (a nil value) [12:42:35.900] stack traceback: [12:42:35.900] data/actions/scripts/cave_exclusiva/cave_action.lua:10: in function <data/actions/scripts/cave_exclusiva/cave_action.lua:3> Script : Spoiler -- <action itemid="5074" script="cave_exclusiva/cave_action.lua"/>-- function onUse(cid, item, fromPosition, itemEx, toPosition) if itemEx.itemid == caveExclusiva.config.buyItemID then if getPlayerStorageValue(cid, caveExclusiva.storages.cave) > 0 then local caveName = caveExclusiva.caves[getPlayerStorageValue(cid, caveExclusiva.storages.cave)].caveName local timeLeft = getPlayerStorageValue(cid, caveExclusiva.storages.time) - os.time() doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você já é dono da cave de ".. caveName ..", aguarde ".. getTimeString(timeLeft) .." para comprar uma cave novamente.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) elseif getGlobalStorageValue(caveExclusiva.caves[itemEx.aid].gStor) > 0 then local ownerGUID = getGlobalStorageValue(caveExclusiva.caves[itemEx.aid].gStor) local ownerTimeLeft = nil if isPlayerOnline(getPlayerNameByGUID(ownerGUID)) then ownerTimeLeft = getPlayerStorageValue(getPlayerByGUID(ownerGUID), caveExclusiva.storages.time) - os.time() else ownerTimeLeft = getOfflinePlayerStorage(ownerGUID, caveExclusiva.storages.time) - os.time() end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "Esta cave já pertence ao player ".. getPlayerNameByGUID(ownerGUID) ..", restam ".. getTimeString(ownerTimeLeft) .." para a cave estar livre novamente.") doSendMagicEffect(getThingPos(cid), CONST_ME_POFF) else caveExclusiva.setCaveTo(cid, itemEx.aid) doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE) doRemoveItem(item.uid) end end return true end Lib Spoiler --- Lib Cave-Exclusiva 1.0 by WooX -- caveExclusiva = { config = { rentTime = 1 * 60, buyItemID = 5074, caveStats = true, buyMessage = "Você comprou a cave de %s por %s.", -- 1° [%s] = Variavel para nome da cave, 2° [%s] = Variavel para duração da cave timeLeftMessageInCave = "Seu tempo na cave de %s acabou e você foi teleportado para o templo.", -- Mensagem quando acabar o tempo e o player estiver dentro da cave timeLeftMessage = "Seu tempo na cave de %s acabou.", -- Mensagem quando acabar o tempo e o player estiver fora da cave signs = { useSigns = true, signID = 1815, signLook = "Esta cave pertence a %s, estará livre novamente as %s." -- 1° [%s] = Variavel para nome do player, 2° [%s] = Variavel para horário em que estara livre novamente } }, caves = { [9851] = { gStor = 7330, caveName = "Cave 1", enterPos = {x=489, y=512, z=8}, signPos = {x=492, y=524, z=8} }, [9852] = { gStor = 7331, caveName = "Cave 2", enterPos = {x=0, y=0, z=7}, signPos = {x=0, y=0, z=7} } }, storages = { cave = 35070, inCave = 35071, time = 35072 } } -- Funções -- caveExclusiva.getCavesID = function() local caves = {} for k, v in pairs(caveExclusiva.caves) do table.insert(caves, k) end table.sort(caves, function(a,b) return b > a end) return caves end caveExclusiva.setSign = function(guid, cave, time) if caveExclusiva.config.signs.useSigns then local sign = getTileItemById(caveExclusiva.caves[cave].signPos, caveExclusiva.config.signs.signID).uid doSetItemText(sign, caveExclusiva.config.signs.signLook:format(getPlayerNameByGUID(guid), os.date("%X", os.time() + time))) end end caveExclusiva.resetSign = function(cave) if caveExclusiva.config.signs.useSigns then local sign = getTileItemById(caveExclusiva.caves[cave].signPos, caveExclusiva.config.signs.signID).uid doSetItemText(sign, "Esta cave está livre!") end end caveExclusiva.setCaveTo = function(cid, cave) setGlobalStorageValue(caveExclusiva.caves[cave].gStor, getPlayerGUID(cid)) setPlayerStorageValue(cid, caveExclusiva.storages.cave, cave) setPlayerStorageValue(cid, caveExclusiva.storages.inCave, 0) setPlayerStorageValue(cid, caveExclusiva.storages.time, os.time() + caveExclusiva.config.rentTime) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, caveExclusiva.config.buyMessage:format(caveExclusiva.caves[cave].caveName, getTimeString(caveExclusiva.config.rentTime))) addEvent(caveExclusiva.doRemoveCave, caveExclusiva.config.rentTime*1000, getPlayerGUID(cid), cave) caveExclusiva.setSign(getPlayerGUID(cid), cave, caveExclusiva.config.rentTime) return true end caveExclusiva.doRemoveCave = function(guid, cave) setGlobalStorageValue(caveExclusiva.caves[cave].gStor, 0) caveExclusiva.resetSign(cave) if isPlayerOnline(getPlayerNameByGUID(guid)) then local cid = getPlayerByGUID(guid) setPlayerStorageValue(cid, caveExclusiva.storages.cave, 0) if getPlayerStorageValue(cid, caveExclusiva.storages.inCave) > 0 then setPlayerStorageValue(cid, caveExclusiva.storages.inCave, 0) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, caveExclusiva.config.timeLeftMessageInCave:format(caveExclusiva.caves[cave].caveName)) else doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, caveExclusiva.config.timeLeftMessage:format(caveExclusiva.caves[cave].caveName)) end setPlayerStorageValue(cid, caveExclusiva.storages.time, 0) end end caveExclusiva.onStartup = function() io.write(">> Setting Exclusive-Cave descriptions... ") for _, cave in pairs(caveExclusiva.getCavesID()) do local ownerGUID = getGlobalStorageValue(caveExclusiva.caves[cave].gStor) > 0 and getGlobalStorageValue(caveExclusiva.caves[cave].gStor) or false local timeLeft = ownerGUID and getOfflinePlayerStorage(ownerGUID, caveExclusiva.storages.time) - os.time() or false if ownerGUID then if timeLeft > 0 then addEvent(caveExclusiva.doRemoveCave, timeLeft*1000, ownerGUID, cave) caveExclusiva.setSign(ownerGUID, cave, timeLeft) else setGlobalStorageValue(caveExclusiva.caves[cave].gStor, 0) caveExclusiva.resetSign(cave) end end end io.write("done.", "\n") end Print Rme: Spoiler Lembrando que nao esta funcionando em geral, Acrédito que eu tenha pulado algo ou deixado passar despercebido! Espero que alguem consiga me ajudar vlw!
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.