Postado Agosto 3, 2018 6 anos Version: TFS 0.4 Base: Olá. Eu tenho esse script, mas ele não está funcionando corretamente, ele deveria regenerar a resistência, mas quando eu usá-lo eu tenho 3 erros no console e não funciona.aqui está o roteiro. também a roupa não está na posição correta (veja imagem) Qual erro está surgindo? [17:52:07.767] [Error - Action Interface] [17:52:07.773] data/actions/scripts/resting.lua:onUse [17:52:07.775] Description: [17:52:07.778] attempt to index a number value [17:52:07.783] stack traceback: [17:52:07.785] [C]: in function 'getTileItemById' [17:52:07.788] data/actions/scripts/resting.lua:44: in function <data/actions/scripts/resting.lua:1> [17:52:13.080] [Error - Action Interface] [17:52:13.098] data/actions/scripts/resting.lua:onUse [17:52:13.118] Description: [17:52:13.140] attempt to index a number value [17:52:13.143] stack traceback: [17:52:13.145] [C]: in function 'doTeleportThing' [17:52:13.156] data/actions/scripts/resting.lua:41: in function <data/actions/scripts/resting.lua:1> Script: function onUse(cid, item, fromPosition, itemEx, toPosition) local config = { soul = 0, -- amount of souls to start timer = 1, -- time in minutes rateStamina = 10, -- percent } if getPlayerSoul(cid) >= config.soul then local myOutfit, cstamina, secondPos, changeType, changeStraw, straw = getCreatureOutfit(cid), getPlayerStamina(cid), toPosition, 0, 0, 0 local clookType = myOutfit.lookType if itemEx.itemid == 5501 then toPosition = toPosition.x - 1 straw = 5500 elseif itemEx.itemid == 5503 then toPosition = toPosition.y - 1 straw = 5502 elseif itemEx.itemid == 5500 then secondPos = secondPos.x + 1 straw = itemEx.itemid elseif itemEx.itemid == 5502 then secondPos = secondPos.y + 1 straw = itemEx.itemid end if itemEx.itemid == 5500 or 5501 then if getPlayerSex(cid) == PLAYERSEX_FEMALE then changeType = 7841 changeStraw = 7842 else changeType = 5496 changeStraw = 5497 end elseif itemEx.itemid == 5502 or 5503 then if getPlayerSex(cid) == PLAYERSEX_FEMALE then changeType = 7843 changeStraw = 7844 else changeType = 5498 changeStraw = 5499 end end doTeleportThing(cid, toPosition, false) doCreatureChangeOutfit(cid, {lookTypeEx = changeType}) doCreatureSetNoMove(cid, true) doTransformItem(getTileItemById(secondPos, straw).uid, changeStraw) doSendAnimatedText(toPosition, "RESTING", TEXTCOLOR_ORANGE) addEvent(function() if isPlayer(cid) then doPlayerSetStamina(cid, cstamina + cstamina * config.rateStamina) doCreatureChangeOutfit(cid, {lookType = clookType}) doRemoveItem(getTileItemById(secondPos, changeStraw).uid, 1) doCreateItem(straw, 1, secondPos) doCreatureSetNoMove(cid, false) doSendAnimatedText(toPosition, "RESTED", TEXTCOLOR_GREEN) end end, config.timer * 60 * 1000) end return true end Imagem Editado Agosto 3, 2018 6 anos por Nelsorco (veja o histórico de edições)
Postado Agosto 3, 2018 6 anos Spoiler local config = { soul = 0, -- amount of souls to start timer = 1, -- time in minutes rateStamina = 10, -- percent } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerSoul(cid) >= config.soul then local changeConfig, secondPos, cstamina = {}, {x = toPosition.x, y = toPosition.y, z = toPosition.z}, getPlayerStamina(cid) local straw = itemEx.itemid if isInArray({5500, 5501}, itemEx.itemid) then local offset = (itemEx.itemid == 5500 and 1 or -1) secondPos.x = secondPos.x + offset changeConfig = getPlayerSex(cid) == PLAYERSEX_FEMALE and (offset == 1 and {7843, 5499} or {5499, 7843}) or (offset == 1 and {5498, 5499} or {5499, 5498}) straw = offset ~= 1 and 5500 or 5501 elseif isInArray({5502, 5503}, itemEx.itemid) then local offset = (itemEx.itemid == 5502 and 1 or -1) secondPos.y = secondPos.y + offset changeConfig = getPlayerSex(cid) == PLAYERSEX_FEMALE and (offset == 1 and {7841, 5497} or {5497, 7841}) or (offset == 1 and {5496, 5497} or {5497, 5496}) straw = offset ~= 1 and 5502 or 5503 else return false end doTeleportThing(cid, toPosition, false) local outfit = getCreatureOutfit(cid) outfit.lookTypeEx = changeConfig[1] doSetCreatureOutfit(cid, {lookTypeEx = changeConfig[1]}, config.timer * 60 * 1000) doCreatureSetNoMove(cid, true) local corpseStraw = getTileItemById(secondPos, straw) if corpseStraw.uid > 0 then doTransformItem(corpseStraw.uid, changeConfig[2]) doSendAnimatedText(toPosition, "RESTING", TEXTCOLOR_ORANGE) end addEvent(function() if isPlayer(cid) then doPlayerSetStamina(cid, cstamina*(1 + .01 * config.rateStamina)) local corpse = getTileItemById(secondPos, changeConfig[2]) if corpse.uid > 0 then doRemoveItem(corpse.uid, 1) end doCreateItem(straw, 1, secondPos) doCreatureSetNoMove(cid, false) doSendAnimatedText(toPosition, "RESTED", TEXTCOLOR_GREEN) end end, config.timer * 60 * 1000) end return true end Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Agosto 4, 2018 6 anos Autor 20 horas atrás, Dwarfer disse: Mostrar conteúdo oculto local config = { soul = 0, -- amount of souls to start timer = 1, -- time in minutes rateStamina = 10, -- percent } function onUse(cid, item, fromPosition, itemEx, toPosition) if getPlayerSoul(cid) >= config.soul then local changeConfig, secondPos, cstamina = {}, {x = toPosition.x, y = toPosition.y, z = toPosition.z}, getPlayerStamina(cid) local straw = itemEx.itemid if isInArray({5500, 5501}, itemEx.itemid) then local offset = (itemEx.itemid == 5500 and 1 or -1) secondPos.x = secondPos.x + offset changeConfig = getPlayerSex(cid) == PLAYERSEX_FEMALE and (offset == 1 and {7843, 5499} or {5499, 7843}) or (offset == 1 and {5498, 5499} or {5499, 5498}) straw = offset ~= 1 and 5500 or 5501 elseif isInArray({5502, 5503}, itemEx.itemid) then local offset = (itemEx.itemid == 5502 and 1 or -1) secondPos.y = secondPos.y + offset changeConfig = getPlayerSex(cid) == PLAYERSEX_FEMALE and (offset == 1 and {7841, 5497} or {5497, 7841}) or (offset == 1 and {5496, 5497} or {5497, 5496}) straw = offset ~= 1 and 5502 or 5503 else return false end doTeleportThing(cid, toPosition, false) local outfit = getCreatureOutfit(cid) outfit.lookTypeEx = changeConfig[1] doSetCreatureOutfit(cid, {lookTypeEx = changeConfig[1]}, config.timer * 60 * 1000) doCreatureSetNoMove(cid, true) local corpseStraw = getTileItemById(secondPos, straw) if corpseStraw.uid > 0 then doTransformItem(corpseStraw.uid, changeConfig[2]) doSendAnimatedText(toPosition, "RESTING", TEXTCOLOR_ORANGE) end addEvent(function() if isPlayer(cid) then doPlayerSetStamina(cid, cstamina*(1 + .01 * config.rateStamina)) local corpse = getTileItemById(secondPos, changeConfig[2]) if corpse.uid > 0 then doRemoveItem(corpse.uid, 1) end doCreateItem(straw, 1, secondPos) doCreatureSetNoMove(cid, false) doSendAnimatedText(toPosition, "RESTED", TEXTCOLOR_GREEN) end end, config.timer * 60 * 1000) end return true end Olá, obrigado por seu apoio, mas eu ainda tenho a parte inferior da safra. Como a imagem Editado Agosto 4, 2018 6 anos por Nelsorco (veja o histórico de edições)
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.