Postado Maio 29, 2015 10 anos Obrigado ,Snowsz era oque eu precisava. EDIT: Cara não pensei que a aula 1 seria tao produtiva por ser uma Introdução. Fica o REP pela indicação sem igual! Editado Maio 30, 2015 10 anos por klipstyle (veja o histórico de edições) www.pokemiw.com 24 Horas Online - 1º 2º 3º 4º 5º 6º 7º gerações 100%
Postado Maio 30, 2015 10 anos Autor local cfg = { soul = 0, time = 3600, level = 1 } local t = { [{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"}, [{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"}, [{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"}, [{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"} } function onUse(cid, item, frompos, item2, topos) local S = getPlayerSoul(cid) local L = getPlayerLevel(cid) for i, k in pairs(t) do if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then addEvent(function() local i = getTileItemById(k.NFTree, topos).uid if i > 0 then doTransformItem(i, item.itemid) end end, cfg.time * 1000) doTransformItem(item.uid, k.NFTree) doPlayerAddItem(cid, k.fruit, math.random(1, 10)) doPlayerAddSoul(cid, -cfg.soul) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".") elseif (S < cfg.soul) then doPlayerSendCancel(cid, "You do not have soul to harvest the plant.") elseif (L < cfg.level) then doPLayerSendCancel(cid, "You are not in the requiered level to harvest.") end end return true end [29/05/2015 22:14:09] [Error - Action Interface] [29/05/2015 22:14:09] In a timer event called from: [29/05/2015 22:14:09] data/actions/scripts/harvest plants.lua:onUse [29/05/2015 22:14:09] Description: [29/05/2015 22:14:09] attempt to index a number value [29/05/2015 22:14:09] stack traceback: [29/05/2015 22:14:09] [C]: in function 'getTileItemById' [29/05/2015 22:14:09] data/actions/scripts/harvest plants.lua:18: in function <data/actions/scripts/harvest plants.lua:17>
Postado Maio 30, 2015 10 anos Solução local cfg = { soul = 0, time = 3600, level = 1 } local t = { [{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"}, [{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"}, [{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"}, [{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"} } function onUse(cid, item, frompos, item2, topos) local S = getPlayerSoul(cid) local L = getPlayerLevel(cid) for i, k in pairs(t) do if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then local info = {fromId = k.NFTree, toId = item.itemid, pos = topos} addEvent(function() local i = getTileItemById(info.pos, info.fromId).uid if i > 0 then doTransformItem(i, info.toId) end end, cfg.time * 1000) doTransformItem(item.uid, k.NFTree) doPlayerAddItem(cid, k.fruit, math.random(1, 10)) doPlayerAddSoul(cid, -cfg.soul) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".") elseif (S < cfg.soul) then doPlayerSendCancel(cid, "You do not have soul to harvest the plant.") elseif (L < cfg.level) then doPLayerSendCancel(cid, "You are not in the requiered level to harvest.") end end return true end Editado Maio 30, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
Postado Maio 30, 2015 10 anos Autor local cfg = { soul = 0, time = 3600, level = 1 } local t = { [{11419}] = {fruit = 2675, NFTree = 4008, fName = "Orange"}, [{5094}] = {fruit = 2676, NFTree = 5092, fName = "Banana"}, [{5096}] = {fruit = 2678, NFTree = 2726, fName = "Coconut"}, [{5157}] = {fruit = 5097, NFTree = 5156, fName = "Mango"} } function onUse(cid, item, frompos, item2, topos) local S = getPlayerSoul(cid) local L = getPlayerLevel(cid) for i, k in pairs(t) do if (isInArray(i, item.itemid) == true) and (S >= cfg.soul) and (L >= cfg.level) then local info = {fromId = k.NFTree, toId = item.itemid, pos = topos} addEvent(function() local i = getTileItemById(info.fromId, info.pos).uid if i > 0 then doTransformItem(i, info.toId) end end, cfg.time * 1000) doTransformItem(item.uid, k.NFTree) doPlayerAddItem(cid, k.fruit, math.random(1, 10)) doPlayerAddSoul(cid, -cfg.soul) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You got some "..k.fName..".") elseif (S < cfg.soul) then doPlayerSendCancel(cid, "You do not have soul to harvest the plant.") elseif (L < cfg.level) then doPLayerSendCancel(cid, "You are not in the requiered level to harvest.") end end return true end [29/05/2015 23:17:38] [Error - Action Interface] [29/05/2015 23:17:38] In a timer event called from: [29/05/2015 23:17:38] data/actions/scripts/harvest plants.lua:onUse [29/05/2015 23:17:38] Description: [29/05/2015 23:17:38] attempt to index a number value [29/05/2015 23:17:38] stack traceback: [29/05/2015 23:17:38] [C]: in function 'getTileItemById' [29/05/2015 23:17:38] data/actions/scripts/harvest plants.lua:19: in function <data/actions/scripts/harvest plants.lua:18>
Postado Maio 30, 2015 10 anos Ops, agora que reparei que troquei os argumentos da função lol corrigido Editado Maio 30, 2015 10 anos por zipter98 (veja o histórico de edições) não respondo pms solicitando suporte em programação/scripting
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.