Ir para conteúdo

zipter98

Herói
  • Total de itens

    2553
  • Registro em

  • Última visita

  • Dias Ganhos

    72

Tudo que zipter98 postou

  1. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  2. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  3. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  4. Aqui, veja se é isso mesmo que você quer: 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 local certificado = 6088 local cfg = { ["hidan amulet"] = 11396, ["semana premium"] = 8981, } if msgcontains(msg, "Certificado") then if getPlayerStorageValue(cid, 98815) >= 1 then selfSay("Desculpe, você já pegou seu item.", cid) talkState[talkUser] = 0 return true else selfSay("Oh, posso lhe dar em troca de um certificado um {hidan amulet} ou {semana premium}. Qual você prefere?", cid) talkState[talkUser] = 1 return true end elseif talkState[talkUser] == 1 then if cfg[msg:lower()] then if getPlayerItemCount(cid, certificado) >= 1 then selfSay("Obrigado, aqui está seu "..msg..".", cid) setPlayerStorageValue(cid, 98815, 1) doPlayerRemoveItem(cid, certificado, 1) doPlayerAddItem(cid, cfg[msg:lower()], 1) talkState[talkUser] = 0 return true else selfSay("Desculpe, você não tem um certificado.", cid) talkState[talkUser] = 0 return true end else selfSay("Desculpe, eu não troco esse item.", cid) talkState[talkUser] = 0 return true end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  5. Área incorreta. Pelo fato de sua dúvida ser relacionada à um servidor derivado (Pokémon), a correta seria Pedidos e dúvidas - Servidores derivados. Mais cuidado da próxima vez. Tópico movido.
  6. Opa, eu que agradeço por postar a resolução. Sanado, movido.
  7. Depende do sistema e da dúvida. Se for relacionado à servidores derivados (como Naruto, Pokémon, etc), você deve fazer o tópico nessa área. Se não for, faça-o nessa área. E não é necessário deletar esse tópico, eu já o movi para a área correta.
  8. Opa, área incorreta. A que você postou é direcionada à códigos prontos, e não à pedidos e/ou dúvidas. Para isso, opte por postar na devida área: Pedidos e dúvidas - Scripting. Mais cuidado da próxima vez. Tópico movido.
  9. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  10. Primeiramente, em 050-function.lua, adicione a seguinte função: function getPlayersInArea(pos1,pos2) local players = {} if pos1.x and pos1.y and pos2.x and pos2.y and pos1.z == pos2.z then for a = pos1.x, pos2.x do for b = pos1.y,pos2.y do local pos = {x=a,y=b,z=pos1.z} if isPlayer(getTopCreature(pos).uid) then table.insert(players,getTopCreature(pos).uid) end end end return players else return false end end Agora, em data/talkactions, abra o arquivo .xml e adicione a seguinte tag: <talkaction words="!abrirevento;!irevento;!fecharevento" script="evento.lua"/> Depois, crie um arquivo com extensão .lua (em data/talkactions/scripts), nomeie-o evento, e coloque o seguinte conteúdo: local cfg = { event_area = {x = x, y = y, z = z}, --Para onde os jogadores serão teleportados ao usar o comando !irevento. inicial_pos = {x = x, y = y, z = z}, --Coordenadas da posição superior esquerda da área. final_pos = {x = x, y = y, z = z}, --Coordenadas da posição inferior direita da área. id = xxx, --Group ID necessário para abrir/fechar o evento. } function onSay(cid, words) if words == "!abrirevento" then if getPlayerGroupId(cid) <= (cfg.id - 1) then return doPlayerSendCancel(cid, "Sorry, not possible.") elseif getGlobalStorageValue(98762) >= 1 then return doPlayerSendCancel(cid, "O evento já está aberto!") end broadcastMessage("O evento foi aberto! Para participar, basta digitar !irevento.", 25) doPlayerSendTextMessage(cid, 27, "Você abriu o evento. Para fechá-lo, digite !fecharevento.") setGlobalStorageValue(98762, 1) elseif words == "!irevento" then if getGlobalStorageValue(98762) <= 0 then return doPlayerSendCancel(cid, "Desculpe, o evento está fechado.") elseif isInArea(getThingPos(cid), cfg.inicial_pos, cfg.final_pos) then return doPlayerSendCancel(cid, "Você já está participando do evento!") end doPlayerSendTextMessage(cid, 27, "Bem vindo, e boa sorte!") doTeleportThing(cid, cfg.event_area) elseif words == "!fecharevento" then if getPlayerGroupId(cid) <= (cfg.id - 1) then return doPlayerSendCancel(cid, "Sorry, not possible.") elseif getGlobalStorageValue(98762) <= 0 then return doPlayerSendCancel(cid, "O evento já está fechado!") end broadcastMessage("O evento foi fechado! Todos os jogadores que estavam na área foram teleportados para o Centro Pokémon!") doPlayerSendTextMessage(cid, 27, "Você fechou o evento. Para abrí-lo, digite !abrirevento.") setGlobalStorageValue(98762, 0) local jogadores = getPlayersInArea(cfg.inicial_pos, cfg.final_pos) if #jogadores >= 1 then for _, b in pairs(jogadores) do doTeleportThing(b, getTownTemplePosition(getPlayerTown(b))) end end end return true end
  11. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  12. O quê acontecerá com os jogadores que estiverem na área do evento, quando o ADM usar o comando para fechá-lo? Serão teleportados, certo? Se sim, poderia dizer para onde?
  13. Tenta assim (gambiarra rs):
  14. Opa, área incorreta. Pelo fato de seu pedido estar relacionado à um servidor derivado (Pokémon), a correta seria: Pedidos e dúvidas - Servidores derivados. Mais cuidado da próxima vez. Tópico movido. Poderia postar seu catch.lua, localizado em data/actions/scripts?
  15. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  16. Em data/npc/scripts, crie um arquivo com extensão .lua, nomeie-o travelnpc, e coloque nele o seguinte conteúdo: 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 local cfg = { storage = 13500, --Storage. pos = {x = x, y = y, z = z}, --Para onde o jogador será teleportado. } if msgcontains(msg, "travel") or msgcontains(msg, "viajar") then selfSay("Você gostaria de viajar? Para isso, você precisa ser VIP.", cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, cfg.storage) >= 1 then selfSay("Boa viajem!", cid) doTeleportThing(cid, cfg.pos) talkState[talkUser] = 0 return true else selfSay("Desculpe, você não é VIP.", cid) talkState[talkUser] = 0 return true end elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Tudo bem, então...", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Depois, em data/npc, crie um arquivo com extensão .xml, e adicione neste o seguinte conteúdo: <?xml version="1.0" encoding="UTF-8"?> <npc name="Nome do NPC" script="travelnpc.lua" walkinterval="0" floorchange="0" access="5" level="1" maglevel="1"> <health now="150" max="150"/> <look type="523" head="114" body="119" legs="114" feet="114" corpse="2212"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|, would you like to {travel}?"/> </parameters> </npc> OBS: Não se esqueça de alterar o nome e a outfit do NPC no arquivo acima.
  17. Área incorreta, tópico movido. Pelo fato de suas dúvidas serem relacionadas à um servidor derivado (Pokémon), a correta seria Pedidos e dúvidas - Servidores derivados. Mais cuidado da próxima vez. Tópico movido.
  18. Vou entender isso como dúvida sanada. Sanado, movido.
  19. Tópico movido para a seção de dúvidas e pedidos resolvidos.
  20. Hm, agora realmente complicou. Não tenho a mínima ideia do quê está fazendo seu servidor cair. Aparentemente, está tudo certinho (como eu disse, funcionou aqui). O jeito vai ser ir testando de linha em linha. Talvez seja uma única função usada que está causando isso. Se esta for descoberta, ficará mais fácil resolver. Se não se importar, poderia ir testando cada vez com uma função diferente após o else? Por exemplo, function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else setGlobalStorageValue(amoebaZombie.playerStorage, getGlobalStorageValue(amoebaZombie.playerStorage)-1) end end end return true end Depois, se o anterior funcionar, function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else setGlobalStorageValue(amoebaZombie.playerStorage, getGlobalStorageValue(amoebaZombie.playerStorage)-1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") end end end return true end E assim vai. Ou, se o primeiro não funcionar, function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") end end end return true end aí depois, se funcionar function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doBroadcastMessage(getPlayerName(cid) .." foi " .. artigo .. " pelos zombies!") end end end return true end e assim vai ._.
  21. Como já informado pelo Ikarus, área incorreta. Pelo fato de seu pedido ser relacionado ao OTClient, a correta seria Dúvidas e Pedidos - Mods/Modules. Mais cuidado da próxima vez. Tópico movido.
  22. Tópicos que estão sem atividade do autor e da comunidade por mais de 7 dias são movidos para a seção de resolvidos.
  23. Opa, área incorreta. Pelo fato do seu pedido ser relacionado à um servidor derivado (no caso, Pokémon), a correta seria: Pedidos e dúvidas - Servidores derivados. Mais cuidado da próxima vez.
  24. zipter98

    Ajuda Npc +rep

    Tópico movido para a seção de dúvidas e pedidos resolvidos.
  25. Hm, dessas duas seguintes maneiras, o servidor fecha, ou ocorre certinho o quê está escrito no código? function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else setGlobalStorageValue(amoebaZombie.playerStorage, getGlobalStorageValue(amoebaZombie.playerStorage)-1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doBroadcastMessage(getPlayerName(cid) .." foi " .. artigo .. " pelos zombies!") doPlayerAddItem(cid, amoebaZombie.consolo[1], amoebaZombie.consolo[2]) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setPlayerStorageValue(cid, 834412, 0) addEvent(winZombieEvent, 1000) addEvent(removeZombies, 1000) end end end return true end function onStatsChange(cid, attacker, type, combat, value) local artigo = getPlayerSex(cid) == 0 and "comida" or "comido" local max_hits = 3 --Quantos hits o jogador irá levar, no máximo. 3 = 3 hits do Zombie. if getCreatureName(attacker) == "Event Zombie" and isInArea(getCreaturePosition(cid), amoebaZombie.fromPosition, amoebaZombie.toPosition) then if type == STATSCHANGE_HEALTHLOSS then if getPlayerStorageValue(cid, 834412) <= (max_hits - 2) then setPlayerStorageValue(cid, 834412, getPlayerStorageValue(cid, 834412) + 1) else setGlobalStorageValue(amoebaZombie.playerStorage, getGlobalStorageValue(amoebaZombie.playerStorage)-1) local corpse = doCreateItem(3058, 1, getPlayerPosition(cid)) doItemSetAttribute(corpse, "description", "You recognize " .. getCreatureName(cid) .. ". He was killed by "..(isMonster(attacker) and "a "..string.lower(getCreatureName(attacker)) or isCreature(attacker) and getCreatureName(attacker) or "a field item")..".") doBroadcastMessage(getPlayerName(cid) .." foi " .. artigo .. " pelos zombies!") doPlayerAddItem(cid, amoebaZombie.consolo[1], amoebaZombie.consolo[2]) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) setPlayerStorageValue(cid, 834412, 0) end end end return true end
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...