# \[BUG\] multiplayer hack? Starting with zero health

**URL:** <https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487>\
**Category:** Bugs\
**Created:** [April 17, 2018, 8:08pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487 "2018-04-17T20:08:56Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![invapid](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@invapid](https://discourse.codecombat.com/u/invapid)\
**Post date:** [April 17, 2018, 8:08pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/1 "2018-04-17T20:08:56Z")

</div>

I’ve noticed Gab1234 has suddenly jumped very high up in many leaderboards, so I tried to fight his character.

When I try the following link, my character starts with 0 health, so he wins by default.

> **[CodeCombat: Learn to Code by Playing a Game](http://br.codecombat.com/play/level/harrowland?team=ogres&opponent=5984a230833174003907c12f&league=5522e6708391fc34054bd3a4)**
>
> Learn programming with a multiplayer live coding strategy game for beginners. Learn Python or JavaScript as you defeat ogres, solve mazes, and level up. Open source HTML5 game!

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [April 17, 2018, 8:16pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/2 "2018-04-17T20:16:27Z")

</div>

@maka

Sounds interesting. I’d be very interested in how that works.

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [April 17, 2018, 9:39pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/3 "2018-04-17T21:39:41Z")

</div>

> [@invapid](#):
>
> my character starts with 0 health, so he wins by default.

No, you don’t) I’ve noticed the same voodoo magic with this character (and one more player) and after a couple of minutes and editing my code I made a conclusion… Seems like your opponent sets yours (and everyone else, exept themselves and pets (couse thay have NaN health))health parameter to zero in the very beginning.

> [@SOLVED/KNOWN What's the way to set enemies health to 0?](https://discourse.codecombat.com/t/whats-the-way-to-set-enemies-health-to-0/14479):
>
> Seen this funny trick on cavern survival level and interested how it could be done?) Some magic with objects and their properties?

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [April 17, 2018, 10:57pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/4 "2018-04-17T22:57:56Z")

</div>

Yeah I noticed that too.

I tried doing that, but it says that I cannot change the settings for the health, so it doesn’t work.

---

<div class="post-metadata">

**Author:** ![invapid](https://avatars.discourse-cdn.com/v4/letter/i/ea666f/32.png) [@invapid](https://discourse.codecombat.com/u/invapid)\
**Post date:** [April 18, 2018, 6:51pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/5 "2018-04-18T18:51:48Z")

</div>

So I figured out his code:

```python
# Stay alive longer than the enemy hero!
def findStorgestEnemy():
    strogest = None
    health = 0
    enemies = hero.findEnemies()
    for enemy in enemies:
        if enemy.health > health:
            strogest = enemy
            health = enemy.health
    return strogest
while True:
    # Devise your own strategy. Be creative!
    enemy = findStorgestEnemy()
    if enemy:
        enemy.defeat()
    cost = hero.costOf(\"griffin-rider\")
    if hero.gold > cost:
        hero.summon(\"griffin-rider\")
    friends = hero.findFriends()
    for friend in friends:
        enemy = findStorgestEnemy()
        if enemy:
            if hero.distanceTo(enemy) < 15:
                enemy.defeat()
            else:
                hero.command(friend, \"move\", enemy.pos)

```

units have a “defeat” method that will instantly kill them, which Gab1234 is abusing.

```python
# will kill all enemies
for enemy in hero.findEnemies():
   enemy.defeat()

```

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [April 18, 2018, 10:35pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/6 "2018-04-18T22:35:56Z")

</div>

Here’s the code he uses in replayable levels

```python
# Stay alive for two minutes.
# If you win, it gets harder (and more rewarding).
# If you lose, you must wait a day before you can resubmit.
# Remember, each submission gets a new random seed.
def findStrongest():
    brawler = hero.findNearest(hero.findByType("brawler"))
    ogre = hero.findNearest(hero.findByType("ogre"))
    fangrider = hero.findNearest(hero.findByType("fangrider"))
    shaman = hero.findNearest(hero.findByType("shaman"))
    scout = hero.findNearest(hero.findByType("scout"))
    enemy = hero.findNearestEnemy()
    if brawler:
        if hero.distanceTo(brawler) < 30:
            return brawler
    elif fangrider:
        if hero.distanceTo(fangrider) < 30:
            return fangrider
    elif ogre:
        if hero.distanceTo(ogre) < 30:
            return ogre
    elif shaman:
        if hero.distanceTo(shaman) < 30:
            return shaman
    elif scout:
        if hero.distanceTo(scout) < 30:
            return scout
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            return enemy
while True:
    enemy = findStrongest()
    if enemy:
        enemy.defeat(enemy)
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            enemy.defeat()
    cost = hero.costOf("soldier")
    if hero.gold >= cost:
        hero.summon("soldier")
    friends = hero.findFriends()
    for friend in friends:
        enemy = friend.findNearestEnemy()
        if enemy:
            enemy.defeat()
while True:
    strongest = findStrongest()
    if strongest:
        if hero.isReady("chain-lightning"):
            hero.cast("chain-lightning", strongest)
        elif hero.isReady("bash"):
            hero.defeat(enemy)
        else:
            hero.defeat(enemy)
    else:
        enemy = hero.findNearestEnemy()
        if enemy:
            hero.defeat(enemy)
        else:
            hero.move({'x': 89, 'y': 70})
    if hero.gold > 50:
        hero.summon("griffin-rider")
    friends = hero.findFriends()
    for friend in friends:
        hero.command(friend, "defend", hero)

```

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 19, 2018, 8:06am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/7 "2018-04-19T08:06:49Z")

</div>

Thanks, guys! I’ve fixed it (maybe need some time for caching refreshing). We know where from this cheat appeared but not sure how long it has been working.

---

<div class="post-metadata">

**Author:** ![Alexbrand](https://avatars.discourse-cdn.com/v4/letter/a/e9bcb4/32.png) [@Alexbrand](https://discourse.codecombat.com/u/Alexbrand)\
**Post date:** [April 19, 2018, 8:37am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/8 "2018-04-19T08:37:42Z")

</div>

According to the leaderboards of replayable levels - not very long time)  
Thank you for fixing it)🤝

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [April 20, 2018, 12:20am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/9 "2018-04-20T00:20:21Z")

</div>

only 3 days. (20 i hate it)

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 20, 2018, 9:35am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/10 "2018-04-20T09:35:42Z")

</div>

I think this cheat was here much longer. Maybe it was just found several days ago by cheater users (who used it silently)

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 26, 2018, 12:51pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/11 "2018-04-26T12:51:18Z")

</div>

As I can see you’ve used this cheat on some ladder levels too.

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [April 26, 2018, 8:07pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/12 "2018-04-26T20:07:37Z")

</div>

@Bryukh, is there a way that you can delete the code if those people who’ve used the cheat as well as their score? It’s unfair to people like me who haven’t used it.

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [April 26, 2018, 11:00pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/13 "2018-04-26T23:00:27Z")

</div>

the code doesn’t work anymore

---

<div class="post-metadata">

**Author:** ![MunkeyShynes](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/munkeyshynes/32/9277_2.png) [@MunkeyShynes](https://discourse.codecombat.com/u/MunkeyShynes)\
**Post date:** [April 26, 2018, 11:09pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/14 "2018-04-26T23:09:22Z")

</div>

I think Chaboi is talking about removing the scores on the leader board for the ones who used the cheat.

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [April 26, 2018, 11:35pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/15 "2018-04-26T23:35:22Z")

</div>

But it still remains in the leaderboard.

---

<div class="post-metadata">

**Author:** ![Seojin\_Roy\_Lee](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/seojin_roy_lee/32/23539_2.png) [@Seojin\_Roy\_Lee](https://discourse.codecombat.com/u/Seojin_Roy_Lee)\
**Post date:** [April 26, 2018, 11:47pm UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/16 "2018-04-26T23:47:29Z")

</div>

The score or the fact that it still works?

---

<div class="post-metadata">

**Author:** ![I\_can\_rob\_you](https://avatars.discourse-cdn.com/v4/letter/i/ed655f/32.png) [@I\_can\_rob\_you](https://discourse.codecombat.com/u/I_can_rob_you)\
**Post date:** [April 27, 2018, 4:22am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/17 "2018-04-27T04:22:52Z")

</div>

looks like codecombat hasn’t done a thorough scan of hacks. lol. (I don’t blame them tho, it would be pretty hard to fix up these)

---

<div class="post-metadata">

**Author:** ![Bryukh](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/bryukh/32/19597_2.png) [@Bryukh](https://discourse.codecombat.com/u/Bryukh)\
**Post date:** [April 27, 2018, 7:23am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/18 "2018-04-27T07:23:02Z")

</div>

We’ve removed them. Current @Seojin_Roy_Lee 's code is honest and placed on 1st placed honestly (it’s just good)

---

<div class="post-metadata">

**Author:** ![Chaboi\_3000](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.codecombat.com/chaboi_3000/32/48486_2.png) [@Chaboi\_3000](https://discourse.codecombat.com/u/Chaboi_3000)\
**Post date:** [April 27, 2018, 8:41am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/19 "2018-04-27T08:41:14Z")

</div>

Ok thanks! I’ll check some sneaky cheaters today and I’ll PM who did it and what level. 😉

---

<div class="post-metadata">

**Author:** ![I\_can\_rob\_you](https://avatars.discourse-cdn.com/v4/letter/i/ed655f/32.png) [@I\_can\_rob\_you](https://discourse.codecombat.com/u/I_can_rob_you)\
**Post date:** [May 30, 2018, 1:37am UTC](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487/20 "2018-05-30T01:37:38Z")

</div>

On cloudrip mountain, for the seige, there are 2 people who used the cheat

[Next page](https://discourse.codecombat.com/t/bug-multiplayer-hack-starting-with-zero-health/14487.md?page=2)
