Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

114
Vistas
I am making a mineflayer pvp bot but it only attacks once

I am trying to make a pvp minecraft bot using mineflayer in javascript. This is my function for if the bot is requested to pvp:

bot.loadPlugin(pvp)
bot.on('chat', (username, message) =>{
if (message === 'fight me') {
    const player = bot.players[username]

    if (!player) {
      bot.chat("I can't see you.")
      return
    }
    bot.chat("Get ready to PvP in 10 seconds!")
    const sword = bot.inventory.items().find(item => item.name.includes('sword'))
    if (sword) bot.equip(sword, 'hand')
    const shield = bot.inventory.items().find(item => item.name.includes('shield'))
    if (shield) bot.equip(shield, 'off-hand')
   
    sleep(1500).then(() => {
    
    beeingAlive()
    bot.chat(`/tp notbreadbutter ${username}`)
    bot.pvp.attack(player.entity)})
    
  }

  if (message === 'stop') {
    bot.pvp.stop()
    
  }})

I want the bot to know when the player gets killed. I also want the bot to know if the bot itself gets killed. How should i modify my code?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda