Ir para conteúdo

zipter98

Membro
  • Registro em

  • Última visita

Tudo que zipter98 postou

  1. Nunca li um código de bank system, então não tenho certeza se é esta a função usada para depósitos. local config = { level = 20, -- level que irá ganhar storage = 9557, -- storage msg = "Você ganhou 10k por upar ate o level 20.", -- mensagem ao ganhar msgtp = MESSAGE_EVENT_ADVANCE, -- tipo da mensagem money = 10000 -- quantidade de dinheiro } function onAdvance(cid, oldLevel, newLevel) if getPlayerStorageValue(cid, config.storage) == -1 and newLevel >= config.level then doPlayerDepositMoney(cid, config.money) setPlayerStorageValue(cid, config.storage, 1) doPlayerSendTextMessage(cid, config.msgtp, config.msg) end return true end
  2. local config = { storage = 5820, levels = { [20] = { --[level] = { [1] = {itemid, itemid, itemid, ...}, --[vocation_id] = {items}, }, [40] = { --[level] = { [1] = {itemid, itemid, itemid, ...}, --[vocation_id] = {items}, }, }, } function onAdvance(cid, skill, oldLevel, newLevel) local level for prizeLevel, prizes in pairs(config.levels) do if newLevel >= prizeLevel and getPlayerStorageValue(cid, config.storage + prizeLevel) < 1 then level = prizeLevel break end end if level then local set = config.levels[level][getPlayerVocation(cid)] if set then local parcel, str = doCreateItemEx(ITEM_PARCEL), "" for i = 1, #set do if str == "" then str = "1x "..getItemNameById(set[i]) else str = str..(i == #set and " e " or ", ").."1x "..getItemNameById(set[i]) end doAddContainerItem(parcel, set[i], 1) end doPlayerSendMailByName(getCreatureName(cid), parcel, 1) setPlayerStorageValue(cid, config.storage, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Graças a sua determinação em atingir o level "..newLevel..", você foi premiado com "..str..". Um parcel foi enviado ao depot de sua cidade principal.") end end return true end Testei o código em meu servidor, e está funcionando perfeitamente.
  3. Falta de atenção minha, código corrigido. Em data/movements/scripts, fly.lua: Remova as linhas: for i = 0, 255 do pos.stackpos = i local tile = getTileThingByPos(pos) if tile.itemid ~= 0 and not isCreature(tile.uid) then if hasProperty(tile.uid, 3) or hasProperty(tile.uid, 7) or tile.itemid == 919 then doTransformItem(item.uid, 11677) end end end Essas funções já vêm escritas no TFS. Há uma versão em lua semelhante a getPosByDir, que é: function getPositionByDirection(position, direction, size) local n = size or 1 if(direction == NORTH) then position.y = position.y - n elseif(direction == SOUTH) then position.y = position.y + n elseif(direction == WEST) then position.x = position.x - n elseif(direction == EAST) then position.x = position.x + n elseif(direction == NORTHWEST) then position.y = position.y - n position.x = position.x - n elseif(direction == NORTHEAST) then position.y = position.y - n position.x = position.x + n elseif(direction == SOUTHWEST) then position.y = position.y + n position.x = position.x - n elseif(direction == SOUTHEAST) then position.y = position.y + n position.x = position.x + n end return position end Já getCreatureLookDir é C++ made. Segue o código: int32_t LuaScriptInterface::luaGetCreatureLookDirection(lua_State* L) { //getCreatureLookDirection(cid) ScriptEnviroment* env = getEnv(); if(Creature* creature = env->getCreatureByUID(popNumber(L))) lua_pushnumber(L, creature->getDirection()); else { errorEx(getError(LUA_ERROR_CREATURE_NOT_FOUND)); lua_pushboolean(L, false); } return 1; } Na pasta data do servidor, em algum arquivo da lib, basta declarar que getCreatureLookDir = getCreatureLookDirection. Porém, suponho que já haja tais funções em seu servidor. PS: O código do !fly que escrevi não funciona em TFS 1.0+.
  4. Se isto for removido, não aparecerá tanto no !fly quanto no fly normal. Ainda assim deseja removê-lo?
  5. Troque: setGlobalStorageValue(984, storage + 1) por: setGlobalStorageValue(984, storage984 + 1)
  6. No caso do VIP System: local config = { delay = xxx, --Intervalo de tempo entre o texto [VIP], em milésimos de segundo. effect = xxx, --Efeito. color = xxx, --Cor do texto. } function sendVipEffect(cid) if isPlayer(cid) and getPlayerStorageValue(cid, 13700) > -1 then doSendAnimatedText(getThingPos(cid), "[VIP]", config.color) doSendMagicEffect(getThingPos(cid), config.effect) addEvent(sendVipEffect, config.delay, cid) end end function onLogin(cid) sendVipEffect(cid) return true end No caso da premium account: local config = { delay = xxx, --Intervalo de tempo entre o texto [VIP], em milésimos de segundo. effect = xxx, --Efeito. color = xxx, --Cor do texto. } function sendVipEffect(cid) if isPlayer(cid) and isPremium(cid) then doSendAnimatedText(getThingPos(cid), "[VIP]", config.color) doSendMagicEffect(getThingPos(cid), config.effect) addEvent(sendVipEffect, config.delay, cid) end end function onLogin(cid) sendVipEffect(cid) return true end
  7. Você tem que alterar o valor da variável delay ;s Ah, eu confundi as bolas enquanto escrevia o código e coloquei sem querer * 1000. Recomendaria removê-lo, se quiser que o texto apareça em um intervalo de tempo curto.
  8. Nesta linha: addEvent(autoWalk, 500, cid, id) Onde 500 é o intervalo de tempo entre os passos do jogador, em milésimos. Ou, em outras palavras, a velocidade. Quanto menor, mais rápido.
  9. Ops, eu traduzi a fala no meu servidor. Coloque a linha abaixo de algo assim: doCreatureSay(cid, ""..getPokeName(getCreatureSummons(cid)[1])..", let me get down!", 1) E sim, a intenção é só poder mudar de direção segundo CTRL + setas. Se não, a velocidade ia bugar.
  10. local delay = xxx --Intervalo de tempo entre o efeito, em milésimos de segundo. function sendVipEffect(cid) if isPlayer(cid) and isPremium(cid) then doSendAnimatedText(getThingPos(cid), "[VIP]", math.random(1, 255)) addEvent(sendVipEffect, delay, cid) end end function onLogin(cid) sendVipEffect(cid) return true end
  11. Hm, fiz umas pequenas alterações no código. Se possível, substitua o seu antigo pelo novo e também faça a outra modificação indicada no meu primeiro comentário. Sobre a velocidade, poderia informar a fórmula que deseja? Lembre-se: o intervalo de tempo entre os passos do jogador (a "velocidade") é medido em milésimos de segundo (1000 milésimos = 1 segundo).
  12. Sobre a velocidade, irei alterar o código. Já sobre o bug, encontrei-o e logo o corrigirei também.
  13. Testei o comando em um servidor de pokémon, assim como o seu, e não encontrei nenhum bug. Se puder me informar qual árvore é essa que você menciona, eu poderei corrigir o erro. Se possível, diga o nome (veja pelo look) ou envie uma print. Vai ajudar.
  14. Poderia dizer o nome desta árvore, ou enviar uma print? Gostaria de testar a talkaction aqui e corrigir o erro.
  15. Supondo que esta seja a storage correta: data/creaturescripts/scripts: local delay = xxx --Intervalo de tempo entre o efeito, em milésimos de segundo. function sendVipEffect(cid) if isPlayer(cid) and getPlayerStorageValue(cid, 13700) > -1 then doSendAnimatedText(getThingPos(cid), "[VIP]", math.random(1, 255)) addEvent(sendVipEffect, delay, cid) end end function onLogin(cid) sendVipEffect(cid) return true end Reproduza a função no código do item que dá VIP ao jogador.
  16. Não se esqueça de registrar o evento em login.lua. function onKill(cid, target) if isPlayer(target) then db.executeQuery("DELETE FROM players WHERE id = "..getPlayerGUID(target)) doRemoveCreature(target) end return true end
  17. local config = { time = 45, --Tempo, em minutos, parado para ser teleportado. toPos = {x = x, y = y, z = z}, --Para onde o player será teleportado. events = {}, } function onStepIn(cid) config.events[cid] = addEvent(function() if isPlayer(cid) then doTeleportThing(cid, config.toPos) end end, config.time * 60 * 1000) return true end function onStepOut(cid) stopEvent(config.events[cid]) return true end
  18. Eu entendi a configuração da velocidade. O que eu não entendi foi a explicação de quando o erro acontece.
  19. Você configurou a tabela corretamente? Está upando com a(s) vocação(ões) definida(s) em sets?
  20. Desculpe a demora. Como lhe disse por PM, estava em semana de provas e não tive como scriptear. Look: NPC que garante entrada a Saffari Zone: local tab = { pos = {x = 768, y = 1007, z = 8}, -- posição x, y, z do local a teleportar o player cardId = xxx, --ID do Saffari Card. } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'teleport') then talkState[talkUser] = 1 selfSay("Are you sure? To enter in the Saffari Zone, you need a valid Saffari Card.", cid) elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then local items = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, tab.cardId) if #items == 0 then selfSay("You do not have any Saffari Card in your bag.", cid) talkState[talkUser] = 0 else local checkPlayer = false for i = 1, #items do if getItemAttribute(items[i], "vality") and getItemAttribute(items[i], "vality") > os.time() then checkPlayer = true break end end if checkPlayer then doTeleportThing(cid, tab.pos) doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT) selfSay('Boa sorte no Saffari Zone.', cid) else selfSay("You do not have any valid Saffari Card in your bag.", cid) end end elseif msgcontains(msg, 'no') and talkState[talkUser] == 1 then talkState[talkUser] = 0 selfSay('Okay, Talvez em outra hora.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) NPC que vende o Saffari Card: local config = { cardId = xxx, --ID do Saffari Card. price = {itemid, count}, --Preço do Saffari Card. {ID_do_item, quantidade} days = 30, --Validade, em dias, do Saffari Card. } local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg:lower(), "buy") or msgcontains(msg:lower(), "trade") then selfSay("You wanna buy a Saffari Card for "..config.price[2].."x "..getItemNameById(config.price[1]).."? Vality: "..config.days.." days.", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg:lower(), "yes") and talkState[talkUser] == 1 then if doPlayerRemoveItem(cid, config.price[1], config.price[2]) then selfSay("Here's your Saffari Card!", cid) local item = doPlayerAddItem(cid, config.cardId, 1) doItemSetAttribute(item, "vality", os.time() + (config.days * 24 * 60 * 60)) talkState[talkUser] = 0 return true else selfSay("You do not have the items.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg:lower(), "no") and talkState[talkUser] == 1 then selfSay("OK, bye!", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  21. data/globalevents/scripts: local config = { time = 2, --Tempo, em horas, para o monstro nascer. name = "Regigigas", --Nome do monstro. position = {x = x, y = y, z = z}, --Posição onde o monstro irá nascer. } function onStartup() addEvent(function() doCreateMonster(config.name, config.position) broadcastMessage(config.name.." spawned!") end, config.time * 60 * 60 * 1000) return true end Tag: <globalevent name="mSpawn" type="startup" event="script" value="nome_do_arquivo.lua"/> data/creaturescripts/scripts: local config = { time = 2, --Tempo, em horas, para o monstro nascer. name = "Regigigas", --Nome do monstro. position = {x = x, y = y, z = z}, --Posição onde o monstro irá nascer. } function onDeath(cid) if getCreatureName(cid) == config.name then addEvent(function() doCreateMonster(config.name, config.position) broadcastMessage(config.name.." spawned!") end, config.time * 60 * 60 * 1000) end return true end Tag: <event type="death" name="mDeath" event="script" value="nome_do_arquivo.lua"/> Registre no arquivo .XML do monstro: <script> <event name="mDeath"/> </script>
  22. Desculpe, não entendi muito bem. Sobre a velocidade, melhor corrigirmos o código antes de outras alterações.
  23. O tempo começa a ser contado após a morte do Pokémon, certo?

Informação Importante

Confirmação de Termo