xzfc / agar-expose

Yet another ogar client
12 stars 12 forks source link

How could i use "top" to change someones name on the leaderboard? #18

Open BoatXD opened 8 years ago

BoatXD commented 8 years ago

If "top" would have the letters "Hello" within their name they would have a red name, how could i do that? (I know it says read only but is there a way or how could i do so in any way possible)

xzfc commented 8 years ago

A quick and dirty solution is:

window.agar.hooks.updateLeaderboard = () => {
  for (var item of window.agar.top)
    if (item.name.includes("Hello")) {
      item.id = window.agar.myCells[0] // make agar code think that this item is yours
      item.name += " ~♡" // you can change name as well
    }
}

Hovewer, if you wanna a clean solution, I suggest you to draw your own leaderboard UI. Just create a div on top of game canvas and update it inside updateLeaderboard hook:

window.agar.hooks.updateLeaderboard = () => {
    // update your div contents here with contents of `window.agar.top`
    return true // do not draw original leaderboard UI
}
BoatXD commented 8 years ago

the first think didnt even work

BoatXD commented 8 years ago

and with window.agar.hooks.updateLeaderboard = () => { // update your div contents here with contents of window.agar.top return true // do not draw original leaderboard UI } could i use html in the "div" area? and how could i make it if it includes something in their name it colors it