Error: Division by 0???

General Chat, Comments
Post Reply
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Error: Division by 0???

Post by cbsarge »

I'm getting this error for one user but, not others. What can I do to get this user working again?

Thank you.

Code: Select all

Error: Division by zero
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 220
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 232
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 288
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/content.php
Line 4
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/libs/common.php
Line 554
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/index.php
Line 321

Please help us to improve the game by providing as much information regards any bugs.
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: Error: Division by 0???

Post by KaL »

What did you do? Well the easiest way is to delete that user. Then recreate him again. It should work!
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Error: Division by 0???

Post by KyleMassacre »

Look at the users stats. Something is 0 and shouldnt be
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Error: Division by 0???

Post by cbsarge »

I had just edited the combat module to try using the player avatar rather than the standard image. The player tried entering combat and received an error. After that they could no longer log in and instead just saw the error above when trying to go to the game page.
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Error: Division by 0???

Post by KyleMassacre »

I tried taking a look into adding the avatar to the combat module but my image kept showing as a broken image but no console error.

But you problem is that you are trying to use what I think is the $user variable in the combat/lib.php file, that is incorrect because the $user variable is an array of just the users stats. So what you can try is adding $userId to your global declaration in the function and use that variable instead. Otherwise this error will happen to everyone with and avatar
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Error: Division by 0???

Post by cbsarge »

Where can I clear out that a player has an avatar to fix the broken account (s)?
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Error: Division by 0???

Post by KyleMassacre »

If you remove the avatar code you added, it should work. The reason they are getting that no matter what is because combat blocks them in that module. If that doesn't work, try avatar/images/<userid>.png
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Re: Error: Division by 0???

Post by cbsarge »

UGH! Still have some users getting the error below. I'm not sure what to edit to try to resolve this. I'd rather not have to delete the accounts. I have access to both the PHP files directly as well as PHPAdmin to access the database. IS there something in the database I can flush out to fix the broken users?

Code: Select all

Error: Division by zero
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 220
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 232
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/lib.php
Line 287
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/modules/combat/content.php
Line 4
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/libs/common.php
Line 554
Error in /hermes/bosnaweb03a/b2751/ipg.cbsargecom/VillainsandHeroes/index.php
Line 321
The first line mentioned in the error is:

Code: Select all

echo "<td style='background-color: black;'><div style='width: 15px; height: " . ($stats['health'] * 180 / $stats['max_health']) . "px; background-color: red;'></div></td>";
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Error: Division by 0???

Post by KyleMassacre »

Restore the combat module to its original state:
An easy way to do so to make sure it's original is edit the config.xml to change the version to any prior version than its current version and click to update it like any other module.

Find any user that has their blocked module user variable set to combat and set it to blank. That should get rid of the problem
KaL
Posts: 344
Joined: Mon Jan 13, 2014 5:44 am

Re: Error: Division by 0???

Post by KaL »

I say just clone the user stats and delete the bad one. DONE!

It's hard for us to fix it because we can see the code or database.
Post Reply

Return to “General”