gigobyte / HLTV

The unofficial HLTV Node.js API
MIT License
398 stars 107 forks source link

Get the scorebot data in a single line, readable form #477

Closed dadodiciassette closed 3 years ago

dadodiciassette commented 3 years ago

Hi guys sorry if I bother you, I'm not an good at programming but i really like this tool so that's why I'm asking you to help me. codice I made the following code that connects me to a game and sends me back the information as you see in the image. Cattura My question is how can I output that data like the real HLTV scorebot (for example only a line with: "EliGE killed falleN with AK47", or "olofmeister disconnected"). Thanks for your help

gigobyte commented 3 years ago

You can construct any strings you want from the data object, for example:

onLogUpdate: (data) => {
 const event = Object.keys(data)[0]
 const eventData = data[event]

  if (event === 'Kill') {
      console.log(`${eventData.killerNick} killed ${eventData.victimNick} using ${eventData.weapon}`)
  }
}

I'll be closing this issue since it's not related to the library at all.