Postado Abril 26, 2015 10 anos Galera, gostaria que alguém, me ajuda-se a fazer este script funcionar em 8.60, ele só funciona em tfs 1.1 Mostrar conteúdo oculto local tabela = { -- [level] = type = "item", id = ITEM_ID, id2 = QUANTIDADE, msg = "MENSAGEM"}, -- [level] = type = "addon", id = ID_ADDON_FEMALE, id2 = ID_ADDON_MALE, msg = "MENSAGEM"}, -- [level] = type = "mount", id = ID_MOUNT, id2 = 0, msg = "MENSAGEM"}, [20] = {type = "item", id = 2160, id2 = 2, msg = "Voce ganhou 2 crystal coins por alcancar o level 20!"}, [40] = {type = "addon", id = 136, id2 = 128, msg = "Voce ganhou o addon citizen full por alcancar o level 40!"}, [60] = {type = "mount", id = 2, id2 = 0, msg = "Voce ganhou a montaria x!"}, } local storage = 15000 function onAdvance(player, skill, oldLevel, newLevel) if (skill == 8) then for level, _ in pairs(tabela) do if player:getLevel() >= level and player:getStorageValue(storage) < level then if tabela[level].type == "item" then player:addItem(tabela[level].id, tabela[level].id2) elseif tabela[level].type == "addon" then player:addOutfitAddon(tabela[level].id, 3) player:addOutfitAddon(tabela[level].id2, 3) elseif tabela[level].type == "mount" then player:addMount(tabela[level].id) else return false end player:sendTextMessage(MESSAGE_EVENT_ADVANCE, tabela[level].msg) player:setStorageValue(storage, level) end end end player:save() -- salvando player return true end [progress=green]50[/progress]
Postado Abril 26, 2015 10 anos Solução Script, rewards.lua: local tabela = { -- [level] = type = "item", id = ITEM_ID, id2 = QUANTIDADE, msg = "MENSAGEM"}, -- [level] = type = "addon", id = ID_ADDON_FEMALE, id2 = ID_ADDON_MALE, msg = "MENSAGEM"}, [20] = {type = "item", id = 2160, id2 = 2, msg = "Voce ganhou 2 crystal coins por alcancar o level 20!"}, [40] = {type = "addon", id = 136, id2 = 128, msg = "Voce ganhou o addon citizen full por alcancar o level 40!"}, } local storage = 15000 function onAdvance(cid, skill, oldLevel, newLevel) if (skill == 8) then for level, _ in pairs(tabela) do if getPlayerLevel(cid) >= level and getPlayerStorageValue(cid, storage) < level then if tabela[level].type == "item" then doPlayerAddItem(cid, tabela[level].id, tabela[level].id2) elseif tabela[level].type == "addon" then doPlayerAddOutfit(cid, tabela[level].id, 3) doPlayerAddOutfit(cid, tabela[level].id2, 3) else return false end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, tabela[level].msg) setPlayerStorageValue(cid, storage, level) end end end doPlayerSave(cid) -- salvando player return true end TAG: <event type="advance" name="Rewards" event="script" value="rewards.lua"/> Registre no login.lua: registerCreatureEvent(cid, "Rewards") Só retirei a parte da mount, pois a função não existe no 8.60. ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 26, 2015 10 anos Em 26/04/2015 em 02:02, Farathor disse: Não sei porque, mas não funcionou Erro na distro? Fez todos os procedimentos corretamente e reiniciou o servidor? Testei aqui e funcionou normalmente. ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 26, 2015 10 anos local tabela = { -- [level] = type = "item", id = ITEM_ID, id2 = QUANTIDADE, msg = "MENSAGEM"}, -- [level] = type = "addon", id = ID_ADDON_FEMALE, id2 = ID_ADDON_MALE, msg = "MENSAGEM"}, [20] = {type = "item", id = 2160, id2 = 2, msg = "Voce ganhou 2 crystal coins por alcancar o level 20!"}, [40] = {type = "addon", id = 136, id2 = 128, msg = "Voce ganhou o addon citizen full por alcancar o level 40!"}, } local storage = 15000 function onAdvance(cid, skill, oldLevel, newLevel) if skill == 8 then for level, value in pairs(tabela) do if newLevel == level and getPlayerStorageValue(cid, storage) < level then if value.type == "item" then doPlayerAddItem(cid, value.id, value.id2) elseif value.type == "addon" then doPlayerAddOutfit(cid, value.id, 3) doPlayerAddOutfit(cid, value.id2, 3) end doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, value.msg) setPlayerStorageValue(cid, storage, level) end end end return true end function onLogin(player) registerCreatureEvent(player, "Rewards") -- body return true end <event type="advance" name="Rewards" event="script" value="rewards.lua"/> <event type="login" name="VerfRewards" event="script" value="rewards.lua"/> Editado Abril 26, 2015 10 anos por Stinger (veja o histórico de edições) I must not fear. Fear is the mind killer.
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.