Postado Novembro 14, 2018 6 anos Autor Em 14/11/2018 em 16:05, tataboy67 disse: @ghunalma local storageChests = 202049 -- Storage local config = { [1] = { actionID = 1234, -- ActionID Bau questName = "Hybrid Quest", -- Nome da Quest levelNec = 400, -- Nivel necessário reward = { [1] = {2160, 10}, -- {ItemID, Count} } }, [2] = { actionID = 1235, questName = "Afonso Quest", levelNec = 200, reward = { [1] = {2159, 15}, [2] = {2160, 100}, } }, } for i = 1, #config do storageChests = storageChests + i end function onUse(cid, item, fromPos, item2, count, toPos) for k, v in ipairs(config) do if item.actionid == v.actionID then if storageChests >= 1 then doPlayerSendTextMessage(cid, 22, "You have completed this quest.") return true end if getPlayerLevel(cid) <= v.levelNec then doPlayerSendTextMessage(cid, 22, "You need a level "..v.levelNec..".") return true end for i = 1, #v.reward do doPlayerAddItem(cid, i[1], i[2]) end setPlayerStorageValue(cid, storageChests, 1) doPlayerSendTextMessage(cid, 22, "Congratulations, you completed the quest: {"..v.questName.."}.") end end end Faça o teste amigo. (Não testado) Valeu, vou testar e jaja posto de funcionou. Obrigado. Nao funcionou aqui amigo. Nem com a modificação do @lordzetros citou.
Postado Novembro 15, 2018 6 anos local storageChests = 202049 -- Storage local config = { ---------------------------------------- { actionID = 1234, -- ActionID Bau questName = "Hybrid Quest", -- Nome da Quest levelNec = 400, -- Nivel necessário reward = { [1] = {2160, 10}, -- {ItemID, Count} } }, ---------------------------------------- { actionID = 1235, questName = "Afonso Quest", levelNec = 200, reward = { [1] = {2159, 15}, [2] = {2160, 100}, } }, ---------------------------------------- } function onUse(cid, item, fromPos, item2, toPos) for k, v in ipairs(config) do if item.actionid == v.actionID then if (getPlayerStorageValue(cid, (storageChests + k)) ~= -1) then doPlayerSendTextMessage(cid, 22, "You have completed this quest.") return true end if (getPlayerLevel(cid) <= v.levelNec) then doPlayerSendTextMessage(cid, 22, "You need a level "..v.levelNec..".") return true end for i = 1, #v.reward do doPlayerAddItem(cid, v.reward[i][1], v.reward[i][2]) end setPlayerStorageValue(cid, storageChests + k, 1) doPlayerSendTextMessage(cid, 22, "Congratulations, you completed the quest: {"..v.questName.."}.") end end end Não cheguei a testar, mas dá um feedback depois, caso tenha dado algum problema. Editado Novembro 15, 2018 6 anos por lordzetros (veja o histórico de edições) Feliz daquele que ensina o que sabe, e aprende o que ensina.
Postado Novembro 15, 2018 6 anos Em 15/11/2018 em 00:29, lordzetros disse: local storageChests = 202049 -- Storage local config = { ---------------------------------------- { actionID = 1234, -- ActionID Bau questName = "Hybrid Quest", -- Nome da Quest levelNec = 400, -- Nivel necessário reward = { [1] = {2160, 10}, -- {ItemID, Count} } }, ---------------------------------------- { actionID = 1235, questName = "Afonso Quest", levelNec = 200, reward = { [1] = {2159, 15}, [2] = {2160, 100}, } }, ---------------------------------------- } function onUse(cid, item, fromPos, item2, toPos) for k, v in ipairs(config) do if item.actionid == v.actionID then if (getPlayerStorageValue(cid, (storageChests + k)) ~= -1) then doPlayerSendTextMessage(cid, 22, "You have completed this quest.") return true end if (getPlayerLevel(cid) <= v.levelNec) then doPlayerSendTextMessage(cid, 22, "You need a level "..v.levelNec..".") return true end for i = 1, #v.reward do doPlayerAddItem(cid, v.reward[i][1], v.reward[i][2]) end setPlayerStorageValue(cid, storageChests + k, 1) doPlayerSendTextMessage(cid, 22, "Congratulations, you completed the quest: {"..v.questName.."}.") end end end Não cheguei a testar, mas dá um feedback depois, caso tenha dado algum problema. Opa, se der algum problema vc concerta pra ele? acabei de fazer no corre aqui Meus trabalhos: [Movements] TFS 1.1+ Area Hardcore [Movements] TFS 1.1+ Tile Party [Action] TFS 1.1+ Bau diário [Action] TFS 1.1+ Guild Dungeon Lever [Talkactions] TFS 0.3.6 / 0.4 Quest Hunt por Tempo Contato: Discord: Tataboy67#4934
Postado Novembro 15, 2018 6 anos @tataboy67 Claro, colega, pode ficar tranquilo, ?. Aguardando resposta de @ghunalma. Feliz daquele que ensina o que sabe, e aprende o que ensina.
Postado Novembro 16, 2018 6 anos local config = { [1234] = { -- ActionId do baú rewards { [1] = {itemId = 2160, amount = 25} -- Item ID e quantidade, por padrão quantidade é 1 }, storage = 213213 }, [1235] = { rewards = { [1] = {itemId = 2195} }, storage = 213213 }, [1231] = { rewards = { [1] = {itemId = 3121} }, storage = 213213 } } function onUse(cid, item, fromPos, item2, count, toPos) local tmpConfig = config[item.actionid] if tmpConfig == nil then return false end if player:getStorageValue(tmpConfig.storage) > 0 then doPlayerSendTextMessage(cid, 22, 'It is empty.') return true end local weight = 0 for i = 1, #tmpConfig.rewards do local reward = tmpConfig.rewards[i] local weightReward = getItemWeightById(reward.itemId, reward.amount or 1) weight = weight + weightReward end if getPlayerFreeCap(cid) < weight then doPlayerSendTextMessage(cid, 22, 'You have found a reward. It weighs '.. weight ..'.00 and it is too heavy.') return true end local backpack = getPlayerSlotItem(cid, CONST_SLOT_BACKPACK).uid local freeSlots = math.max(0, getContainerCap(backpack) - getContainerSize(backpack)) if freeSlots < #tmpConfig.rewards then doPlayerSendTextMessage(cid, 22, 'You have found a reward, but you need a free slot.') return true end for i = 1, #tmpConfig.rewards do local reward = tmpConfig.rewards[i] doPlayerSendTextMessage(cid, 22, 'You have found a '.. getItemNameById(reward.itemId) ..'.') doPlayerAddItem(cid, reward.itemId, reward.amount or 1) end setPlayerStorageValue(cid, tmpConfig.storage, 1) return true end Testa aí, depois me fala... Eu não testei
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.