Ir para conteúdo
  • Cadastre-se

(Resolvido)[Pedido] Npc Reborn / Reset


Ir para solução Resolvido por Cerberus,

Posts Recomendados

Eai galera!  ^^ 

 

 

Estou precisando de um npc que resete o player. Sendo mais específico preciso que tenha as seguintes funções se possível:

 

Level minimo para resetar: 250.

Level máximo: 600.

Preço: 7 esferas do dragão.

Manter skills, ml, life/mana e adicionar +25k de life/mana.

Resete para o level 1.

E por fim, troque a vocação do player (exemplo: se ele esta na vocação 2 , que vá para a 3).

Aah, vale lembrar, que irei configurar várias vocações e não somente uma.

 

Distro Utilizada: tfs 0.4 rev.3884

Versão Do Servidor: 8.60

 

Antes de mais nada vale lembrar que procurei em vários tópicos aqui no forum e os que encontrei não consegui modificá-los ao ponto que eu quero.

Link para o post
Compartilhar em outros sites

 

ta fazendo um wodbo? caso queria ajuda manda pm ai. também tava afim de criar um

 

 

Estou sim, comecei criando do zero, peguei um servidor de tibia e comecei aos poucos baseando no DBOBrasil, já está quase pronto, mas ainda faltam algumas coisas importantes :D

 

~~~

Ainda preciso do Npc alguém poderia me ajudar?

Editado por bhelliip (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Veja meu tópico e veja se te ajuda, porem ele so necessita do LEVEL. Depois faço algumas modificações pra ajudar você.

http://www.tibiaking.com/forum/topic/42613-npc-reborn/

I helped you ? REP +.

 

Att: Abreu

Link para o post
Compartilhar em outros sites

 

Veja meu tópico e veja se te ajuda, porem ele so necessita do LEVEL. Depois faço algumas modificações pra ajudar você.

http://www.tibiaking.com/forum/topic/42613-npc-reborn/

 

Infelizmente não deu certo, creio que seja por causa das diferentes versões, o meu server é 8.60 mas vai ganhar um REP+ pela intenção de ajudar!  ^^

Link para o post
Compartilhar em outros sites

Da algum erro quando tu tentou usar o script do amigo ali?

 

Sim, funciona normalmente até o momento que digo "yes" para rebornar, olha o erro: 

http://prntscr.com/4pl0hc

Link para o post
Compartilhar em outros sites

e so mudar a tag (doReborn) para getPromotedVocation(voc)

 

Então ficaria assim?

 

elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 300 and getPlayerVocation(cid) == 8 then
setPlayerStorageValue(cid,30023,1)
getPromotedVocation(voc)(cid, 1, 42, 9)
talk_state = 0
 
Se for assim deu o seguinte erro:

http://prntscr.com/4qd7nm

Link para o post
Compartilhar em outros sites

para funcionar o script dele ele tem que pegar na lib essa função 

 

doReborn

 

foi criada na lib dele o npc so funciona se tiver essa função da lib dele.


procurei na net  não sei bem se vc vai saber configurar mais e so por ela na sua lib.

 

nesse lib/050-function

function doReborn(cid, level, looktype, vocation)
db.executeQuery("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
doRemoveCreature(cid)
return TRUE

end

Editado por kbpaulo (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

para funcionar o script dele ele tem que pegar na lib essa função 

 

doReborn

 

foi criada na lib dele o npc so funciona se tiver essa função da lib dele.

procurei na net  não sei bem se vc vai saber configurar mais e so por ela na sua lib.

 

nesse lib/050-function

function doReborn(cid, level, looktype, vocation)
db.executeQuery("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
doRemoveCreature(cid)
return TRUE

end

 

Adicionei certinho, porém ainda assim quando eu digo "yes" para rebornar ocorre o seguinte erro:

http://prntscr.com/4qdl5e

 

~~ EDIT ~~

Creio que o erro se encontra nesse "db.executeQuery" então alterei para "db.query" e não da erro, porém só faz o char deslogar e nada acontece, não reseta, nem da vocação nem nada rsrs...

Editado por bhelliip (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
  • Solução

ve ae lek

 

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('?????.')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello. If you ready I can "Reborn" you.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! Hey!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then
selfSay('Sorry, but you are after reborn.')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30023) ~= 4 then
selfSay('Hehe, I say If you READY. You do not have 250 lvl.')
elseif msgcontains(msg, 'reborn') then
selfSay('Are you sure?')
talk_state = 2
--_GOKU_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 1 then
doReborn(cid,1,152,109)
talk_state = 0
--_VEGETA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 7 then
doReborn(cid,1,129,118)
talk_state = 0
--_GOHAN_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 13 then
doReborn(cid,1,147,127)
talk_state = 0
--_TRUNKS_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 19 then
doReborn(cid,1,131,136)
talk_state = 0
--_CELL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 25 then
doReborn(cid,1,127,145)
talk_state = 0
--_FREEZA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 31 then
doReborn(cid,1,9,154)
talk_state = 0
--_UUB_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 37 then
doReborn(cid,1,233,163)
talk_state = 0
--_C17_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 43 then
doReborn(cid,1,100,172)
talk_state = 0
--_C18_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 49 then
doReborn(cid,1,292,181)
talk_state = 0
--_PICOLLO_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 55 then
doReborn(cid,1,262,190)
talk_state = 0
--_DENDE_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 61 then
doReborn(cid,1,225,199)
talk_state = 0
--_TSUFUL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 67 then
doReborn(cid,1,81,208)
talk_state = 0
--_BARDOCK_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 73 then
doReborn(cid,1,319,217)
talk_state = 0
--_BROLLY_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 79 then
doReborn(cid,1,263,226)
talk_state = 0
--_C16_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 85 then
doReborn(cid,1,301,235)
talk_state = 0
--_COOLER_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 91 then
doReborn(cid,1,242,244)
talk_state = 0
--_JANEMBA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 97 then
doReborn(cid,1,551,253)
talk_state = 0
--_TAPION_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 103 then
doReborn(cid,1,577,262)
talk_state = 0

elseif msgcontains(msg, 'yes') and talk_state == 2 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert.')


elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye.')
focus = 0
talk_start = 0
end
end
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end

 

function doReborn(cid, level, looktype, vocation)
setGlobalStorageValue(1000,getPlayerGUID(cid))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
return TRUE
end

 

tenta ae peguei de 1 site ja pronto se não der vo olhar serio e vo fazer ele do 0..

Link para o post
Compartilhar em outros sites

ve ae lek

 

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('?????.')
focus = 0
talk_start = 0
end
end

function onCreatureTurn(creature)
end

function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello. If you ready I can "Reborn" you.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! Hey!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'reborn') and getPlayerStorageValue(cid,30023) == 4 then
selfSay('Sorry, but you are after reborn.')
focus = 0
talk_start = 0
elseif msgcontains(msg, 'reborn') and getPlayerLevel(cid) < 250 and getPlayerStorageValue(cid,30023) ~= 4 then
selfSay('Hehe, I say If you READY. You do not have 250 lvl.')
elseif msgcontains(msg, 'reborn') then
selfSay('Are you sure?')
talk_state = 2
--_GOKU_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 1 then
doReborn(cid,1,152,109)
talk_state = 0
--_VEGETA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 7 then
doReborn(cid,1,129,118)
talk_state = 0
--_GOHAN_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 13 then
doReborn(cid,1,147,127)
talk_state = 0
--_TRUNKS_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 19 then
doReborn(cid,1,131,136)
talk_state = 0
--_CELL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 25 then
doReborn(cid,1,127,145)
talk_state = 0
--_FREEZA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 31 then
doReborn(cid,1,9,154)
talk_state = 0
--_UUB_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 37 then
doReborn(cid,1,233,163)
talk_state = 0
--_C17_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 43 then
doReborn(cid,1,100,172)
talk_state = 0
--_C18_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 49 then
doReborn(cid,1,292,181)
talk_state = 0
--_PICOLLO_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 55 then
doReborn(cid,1,262,190)
talk_state = 0
--_DENDE_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 61 then
doReborn(cid,1,225,199)
talk_state = 0
--_TSUFUL_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 67 then
doReborn(cid,1,81,208)
talk_state = 0
--_BARDOCK_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 73 then
doReborn(cid,1,319,217)
talk_state = 0
--_BROLLY_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 79 then
doReborn(cid,1,263,226)
talk_state = 0
--_C16_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 85 then
doReborn(cid,1,301,235)
talk_state = 0
--_COOLER_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 91 then
doReborn(cid,1,242,244)
talk_state = 0
--_JANEMBA_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 97 then
doReborn(cid,1,551,253)
talk_state = 0
--_TAPION_--
elseif msgcontains(msg, 'yes') and talk_state == 2 and getPlayerLevel(cid) >= 250 and getPlayerLevel(cid) <= 1400 and getPlayerVocation(cid) == 103 then
doReborn(cid,1,577,262)
talk_state = 0

elseif msgcontains(msg, 'yes') and talk_state == 2 then
selfSay('Sorry, ' .. getCreatureName(cid) .. '! You must revert.')


elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye.')
focus = 0
talk_start = 0
end
end
end

function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 45 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end

 

function doReborn(cid, level, looktype, vocation)
setGlobalStorageValue(1000,getPlayerGUID(cid))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = " .. level .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `looktype` = " .. looktype .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
db.executeQuery("UPDATE `players` SET `vocation` = " .. vocation .. " WHERE `id` = " .. getGlobalStorageValue(1000) .. ";")
return TRUE
end

 

tenta ae peguei de 1 site ja pronto se não der vo olhar serio e vo fazer ele do 0..

FUNCIONOOOUUU CARAAA! MUIITO OBRIGADOOO VEYY! Nem to acreditando rsrs

a única coisa que eu tive que mudar foi esse comando "db.executeQuery" para "db.query" fora isso funcionou perfeitamente!

REP +++++

Link para o post
Compartilhar em outros sites

se resolveu ta blz então xd.. so reportar para fecharem xD.

Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por L3K0T
      TUTORIAL BY L3K0T PT~EN
       
      Olá pessoal, trago a vocês uma atualização que fiz no sistema, contendo 3 novas funcionalidades de movimentação de itens e uma proteção contra Elf Bot. Estas adições foram cuidadosamente implementadas para aperfeiçoar a experiência de jogo e manter a integridade do seu servidor.
      As novas funcionalidades têm a função vital de impedir que jogadores deixem itens indesejados em locais inapropriados, como na entrada de sua casa, em cima de seus depósitos ou em teleportes. Agora, apenas proprietários, subproprietários e convidados têm permissão para manipular itens nesses locais.
      Este pacote de atualização foi meticulosamente revisado para evitar abusos por parte de jogadores mal-intencionados e garantir um ambiente de jogo justo e equilibrado para todos os usuários.
       
       
       
      Iniciando o Tutorial
      1Abra o arquivo "creatureevents.cpp" com o editor de sua preferência. Eu pessoalmente recomendo o Notepad++. 
       
       
      Em creatureevents.cpp:
      return "onPrepareDeath"; Adicione abaixo:
      case CREATURE_EVENT_MOVEITEM: return "onMoveItem"; case CREATURE_EVENT_MOVEITEM2: return "onMoveItem2";  
      Em:
      return "cid, deathList"; Adicione abaixo:
      case CREATURE_EVENT_MOVEITEM: return "moveItem, frompos, topos, cid"; case CREATURE_EVENT_MOVEITEM2: return "cid, item, count, toContainer, fromContainer, fromPos, toPos";  
      Em:
      m_type = CREATURE_EVENT_PREPAREDEATH; Adicione abaixo:
      else if(tmpStr == "moveitem") m_type = CREATURE_EVENT_MOVEITEM; else if(tmpStr == "moveitem2") m_type = CREATURE_EVENT_MOVEITEM2;  
      Procure por:
      bool CreatureEvents::playerLogout(Player* player, bool forceLogout) { //fire global event if is registered bool result = true; for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if((*it)->getEventType() == CREATURE_EVENT_LOGOUT && (*it)->isLoaded() && !(*it)->executeLogout(player, forceLogout) && result) result = false; } return result; } Adicione abaixo:
      uint32_t CreatureEvents::executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos) { // fire global event if is registered for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if((*it)->getEventType() == CREATURE_EVENT_MOVEITEM) { if(!(*it)->executeMoveItem(actor, item, frompos, pos)) return 0; } } return 1; }  
      Em:
      bool CreatureEvents::playerLogin(Player* player) { //fire global event if is registered bool result = true; for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { if((*it)->getEventType() == CREATURE_EVENT_LOGIN && (*it)->isLoaded() && !(*it)->executeLogin(player) && result) result = false; } if (result) { for(CreatureEventList::iterator it = m_creatureEvents.begin(); it != m_creatureEvents.end(); ++it) { CreatureEvent* event = *it; if(event->isLoaded() && ( event->getRegister() == "player" || event->getRegister() == "all") ) player->registerCreatureEvent(event->getName()); } } return result; } Adicione Abaixo:
      uint32_t CreatureEvent::executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos) { //onMoveItem(moveItem, frompos, position, cid) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(pos); std::stringstream scriptstream; env->streamThing(scriptstream, "moveItem", item, env->addThing(item)); env->streamPosition(scriptstream, "position", frompos, 0); env->streamPosition(scriptstream, "position", pos, 0); scriptstream << "local cid = " << env->addThing(actor) << std::endl; scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[35]; sprintf(desc, "%s", player->getName().c_str()); env->setEventDesc(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(pos); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); LuaInterface::pushThing(L, item, env->addThing(item)); LuaInterface::pushPosition(L, frompos, 0); LuaInterface::pushPosition(L, pos, 0); lua_pushnumber(L, env->addThing(actor)); bool result = m_interface->callFunction(4); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } } uint32_t CreatureEvent::executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack) { //onMoveItem2(cid, item, count, toContainer, fromContainer, fromPos, toPos) if(m_interface->reserveEnv()) { ScriptEnviroment* env = m_interface->getEnv(); if(m_scripted == EVENT_SCRIPT_BUFFER) { env->setRealPos(player->getPosition()); std::stringstream scriptstream; scriptstream << "local cid = " << env->addThing(player) << std::endl; env->streamThing(scriptstream, "item", item, env->addThing(item)); scriptstream << "local count = " << count << std::endl; env->streamThing(scriptstream, "toContainer", toContainer, env->addThing(toContainer)); env->streamThing(scriptstream, "fromContainer", fromContainer, env->addThing(fromContainer)); env->streamPosition(scriptstream, "fromPos", fromPos, fstack); env->streamPosition(scriptstream, "toPos", toPos, 0); scriptstream << m_scriptData; bool result = true; if(m_interface->loadBuffer(scriptstream.str())) { lua_State* L = m_interface->getState(); result = m_interface->getGlobalBool(L, "_result", true); } m_interface->releaseEnv(); return result; } else { #ifdef __DEBUG_LUASCRIPTS__ char desc[30]; sprintf(desc, "%s", player->getName().c_str()); env->setEvent(desc); #endif env->setScriptId(m_scriptId, m_interface); env->setRealPos(player->getPosition()); lua_State* L = m_interface->getState(); m_interface->pushFunction(m_scriptId); lua_pushnumber(L, env->addThing(player)); LuaInterface::pushThing(L, item, env->addThing(item)); lua_pushnumber(L, count); LuaInterface::pushThing(L, toContainer, env->addThing(toContainer)); LuaInterface::pushThing(L, fromContainer, env->addThing(fromContainer)); LuaInterface::pushPosition(L, fromPos, fstack); LuaInterface::pushPosition(L, toPos, 0); //lua_pushnumber(L, env->addThing(actor)); bool result = m_interface->callFunction(7); m_interface->releaseEnv(); return result; } } else { std::clog << "[Error - CreatureEvent::executeMoveItem] Call stack overflow." << std::endl; return 0; } }  
       
       
      Agora em em creatureevents.h:
      CREATURE_EVENT_PREPAREDEATH, Adicione abaixo:
      CREATURE_EVENT_MOVEITEM, CREATURE_EVENT_MOVEITEM2  
      Em:
      uint32_t executePrepareDeath(Creature* creature, DeathList deathList); Adicione abaixo:
      uint32_t executeMoveItem(Creature* actor, Item* item, const Position& frompos, const Position& pos); uint32_t executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack);  
      Em:
      bool playerLogout(Player* player, bool forceLogout); Abaixo adicone também
      uint32_t executeMoveItems(Creature* actor, Item* item, const Position& frompos, const Position& pos); uint32_t executeMoveItem2(Player* player, Item* item, uint8_t count, const Position& fromPos, const Position& toPos, Item* toContainer, Item* fromContainer, int16_t fstack);  
       
      Agora em em game.cpp:
      if(!canThrowObjectTo(mapFromPos, mapToPos) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere)) { player->sendCancelMessage(RET_CANNOTTHROW); return false; } ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL); if(ret == RET_NOERROR) return true; player->sendCancelMessage(ret); return false; } Altere para:
      if (!canThrowObjectTo(mapFromPos, mapToPos) && !player->hasCustomFlag(PlayerCustomFlag_CanThrowAnywhere)) { player->sendCancelMessage(RET_CANNOTTHROW); return false; } bool success = true; CreatureEventList moveitemEvents = player->getCreatureEvents(CREATURE_EVENT_MOVEITEM2); for (CreatureEventList::iterator it = moveitemEvents.begin(); it != moveitemEvents.end(); ++it) { Item* toContainer = toCylinder->getItem(); Item* fromContainer = fromCylinder->getItem(); if (!(*it)->executeMoveItem2(player, item, count, fromPos, toPos, (toContainer ? toContainer : 0), (fromContainer ? fromContainer : 0), fromStackpos) && success) success = false; } if (!success) return false; if (g_config.getBool(ConfigManager::ANTI_PUSH)) { std::string antiPushItems = g_config.getString(ConfigManager::ANTI_PUSH_ITEMS); IntegerVec tmpVec = vectorAtoi(explodeString(antiPushItems, ",")); if (tmpVec[0] != 0) { for (IntegerVec::iterator it = tmpVec.begin(); it != tmpVec.end(); ++it) { if (item->getID() == uint32_t(*it) && player->hasCondition(CONDITION_EXHAUST, 1)) { player->sendTextMessage(MSG_STATUS_SMALL, "Please wait a few seconds to move this item."); return false; } } } } int32_t delay = g_config.getNumber(ConfigManager::ANTI_PUSH_DELAY); if (Condition* condition = Condition::createCondition(CONDITIONID_DEFAULT, CONDITION_EXHAUST, delay, 0, false, 1)) player->addCondition(condition); if (!g_creatureEvents->executeMoveItems(player, item, mapFromPos, mapToPos)) return false; ReturnValue ret = internalMoveItem(player, fromCylinder, toCylinder, toIndex, item, count, NULL); if (ret != RET_NOERROR) { player->sendCancelMessage(ret); return false; } player->setNextAction(OTSYS_TIME() + g_config.getNumber(ConfigManager::ACTIONS_DELAY_INTERVAL) - 10); return true; }  
      Agora em configmanager.h
      ADMIN_ENCRYPTION_DATA Adicione abaixo:
      ANTI_PUSH_ITEMS,  
      em:
      STAMINA_DESTROY_LOOT, Adicione abaixo:
      ANTI_PUSH_DELAY,  
      em:
      ADDONS_PREMIUM, Adicione abaixo:
      ANTI_PUSH  
      Agora você pode compilar a Source.
       
       
      Configurando no servidor:
       
      Abra seu config.lua do servidor e adicione isso dentro qualquer lugar:
      -- Anti-Push useAntiPush = true antiPushItems = "2148,2152,2160,3976" antiPushDelay = 500  
       
      Navegue até o diretório 'creaturescripts' e localize o arquivo 'login.lua'.
      em resgistros de eventos adicione:
      login.lua
      registerCreatureEvent(cid, "MoveItem") registerCreatureEvent(cid, "MoveItem2")  
      Agora abra o aquivo creaturescript .xml
      <event type="moveitem" name="MoveItem" event="script" value="houseprotecao.lua"/> <event type="moveitem2" name="MoveItem2" event="script" value="moveitem2.lua"/>  
      Crie um novo arquivo lua em scripts com o nome houseprotecao.lua e adicione isso:
      function onMoveItem(moveItem, frompos, position, cid) if position.x == CONTAINER_POSITION then return true end local house = getHouseFromPos(frompos) or getHouseFromPos(position) --correção 100% if type(house) == "number" then local owner = getHouseOwner(house) if owner == 0 then return false, doPlayerSendCancel(cid, "Isso não é Possível.") end if owner ~= getPlayerGUID(cid) then local sub = getHouseAccessList(house, 0x101):explode("\n") local guest = getHouseAccessList(house, 0x100):explode("\n") local isInvited = false if (#sub > 0) and isInArray(sub, getCreatureName(cid)) then isInvited = true end if (#guest > 0) and isInArray(guest, getCreatureName(cid)) then isInvited = true end if not isInvited then return false, doPlayerSendCancel(cid, "Desculpe, você não está invitado.") end end end return true end  
      Crie um novo arquivo lua em scripts com o nome moveitem2.lua e adicione isso abaixo:
      local depottiles = {} --piso pra n jogar local depots = {2589} --id dos dps local group = 3 --id dos group 6 é todos. local function checkIfThrow(pos,topos) if topos.x == 0xffff then return false end local thing = getThingFromPos(pos) if isInArray(depottiles,thing.itemid) then if not isInArea(topos,{x=pos.x-1,y=pos.y-1,z=pos.z},{x=pos.x+1,y=pos.y+1, z=pos.z}) then return true end else for i = 1, #depots do if depots[i] == getTileItemById(topos,depots[i]).itemid or getTileInfo(topos).actionid == 7483 then return true end end end return false end function onMoveItem2(cid, item, count, toContainer, fromContainer, fromPos, toPos) if isPlayer(cid) then local pos = getThingPos(cid) if getPlayerGroupId(cid) > group then return true end if checkIfThrow({x=pos.x,y=pos.y,z=pos.z,stackpos=0},toPos) then doPlayerSendCancel(cid,"Não jogue item ai!!") doSendMagicEffect(getThingPos(cid),CONST_ME_POFF) return false end end return true end  
      ajudei?? REP+
      CRÉDITOS:
      @L3K0T
      Fir3element
      Summ
      Wise
      GOD Wille
      Yan Lima
       
       
       
       
    • Por L3K0T
      Não jogar itens pelo teleportes C++
       

       

       
       
      Bom.. o nome já diz, qualquer um que jogar itens nos teleportes do seu otserv, o mesmo será removido, como aquelas lixeiras, porem esse sistema é pela source, descartando scripts .LUA.
       
       
      Em teleporte.cpp ache:
       
      void Teleport::__addThing(Creature* actor, int32_t, Thing* thing) { if(!thing || thing->isRemoved()) return; Tile* destTile = g_game.getTile(destination); if(!destTile) return; if(Creature* creature = thing->getCreature()) { g_game.addMagicEffect(creature->getPosition(), MAGIC_EFFECT_TELEPORT, creature->isGhost()); creature->getTile()->moveCreature(actor, creature, destTile); g_game.addMagicEffect(destTile->getPosition(), MAGIC_EFFECT_TELEPORT, creature->isGhost()); } else if(Item* item = thing->getItem()) { g_game.addMagicEffect(item->getPosition(), MAGIC_EFFECT_TELEPORT); g_game.internalMoveItem(actor, item->getTile(), destTile, INDEX_WHEREEVER, item, item->getItemCount(), NULL); g_game.addMagicEffect(destTile->getPosition(), MAGIC_EFFECT_TELEPORT); } }  
      Altere ele todo para:
       
      void Teleport::__addThing(Creature* actor, int32_t, Thing* thing) { if (!thing || thing->isRemoved()) return; Tile* destTile = g_game.getTile(destination); if (!destTile) return; if (Creature* creature = thing->getCreature()) { g_game.addMagicEffect(creature->getPosition(), MAGIC_EFFECT_TELEPORT, creature->isGhost()); creature->getTile()->moveCreature(actor, creature, destTile); g_game.addMagicEffect(destTile->getPosition(), MAGIC_EFFECT_TELEPORT, creature->isGhost()); } else { Player* player = dynamic_cast<Player*>(actor); if (player) { player->sendTextMessage(MSG_STATUS_SMALL, "You cannot teleport items."); // Remover o item Item* item = dynamic_cast<Item*>(thing); if (item) { g_game.internalRemoveItem(actor, item); } } return; } } agora é só compilar no modo Rebuilder e ligar o servidor, créditos a mim L3K0T pela alterações.
    • Por ambrozii0
      Gostaria de fazer um pedido de um NPC de Task progressiva,

      Ele iniciaria dando missões para level 8 para caçar Troll, Rotworm e Ghoul.
       
      No level 30 liberaria: Cyclops, Dragon e Wyrm... e assim em diante se puder deixar comentado eu faço as criaturas na sequencia dos leveis seguintes.
       
      O jogador pode fazer as tasks dos leveis anteriores mesmo que já tenha ultrapassado o level do próximo nível de task.
       
      E o jogador ao terminar a missão poderia escolher a recompensa em gold ou experiência. As tasks podem se repetir sem problema, mas apenas pode pegar uma de cada vez.
       
      Ao finalizar todas as tasks o jogador ganha uma montaria.
       
      Minha versão de cliente é 12.91
      Versão da Canary 2.6.1
      Não sei qual o TFS do meu servidor.
    • Por Thony D. Serv
      tfs 0.4 (não testei em outras apenas na 0.4)
      Esse script eu fiz pois, meu servidor sempre que reiniciava todos os players voltavam sem bless, então para sanar isso eu fiz um check de bless pela database para poder sempre que cair o servidor os players não morressem sem bless e dropassem os itens
      vamos lá!

      Primeiro Execute Este Comando Em Sua Db:
       

      Va No Fim E Adicione
      050-function.lua 
       

      Agora vá no seu comando de Bless ou Npc e ponha cada um no seu devido lugar
       
       
      Agora Em Creaturescript/scripts Crie Uma Pasta Chamada Bless E Ponha La Dentro:

      blessingdeath.lua
       

      blessinglogin.lua
       

      Adicione Ambas No Login.lua
       
       
      Creaturescript.xml
       

      -- Creditos A Mim Mesmo hahaha. Espero Ajudar Vocês ?
    • Por Imperius
      Tinha visto isso no servidor do MegaTibia / Kaldrox e achei bem interessante.
       
      Todos os tópicos que encontrei sobre o assunto de alterar a cor das mensagens dos GMs, CMs e ADM no channel Help para vermelho, falavam que tinham que fazer uma configuração na própria source do servidor.
       
      Fiz uma gambiarra que funciona, sem a necessidade de mexer na source do servidor e de utilizar comandos para isso. Testei somente em TFS 0.4 e funciona tranquilamente.
       
      segue abaixo como configurar em seu otserver:
       
      data > talkactions > scripts > crie um arquivo chamado gmsayred.lua e cole o código abaixo:
       
      function onSay(cid, words, param, channel) if channel == CHANNEL_HELP then for _, pid in ipairs(getPlayersOnline()) do doPlayerSendChannelMessage(pid, '', "".. getCreatureName(cid) .. ": ".. words, TALKTYPE_CHANNEL_R1, CHANNEL_HELP) end return true end end  
      em talkactions.xml cole a tag abaixo:

       
      <!-- Gamemasters --> <talkaction default="yes" filter="quotation" logged="no" access="3" event="script" value="gmsayred.lua"/>    
      e pronto! Agora é só enviar alguma mensagem no Help que a mensagem ficará em vermelho.
       

       
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo