• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] Divide by zero
#1
Code:
ExpProgress(playerid)

{

? ? new Float:exp = playerData[playerid][pExp]*100/PlayerRequiredExp(playerid);

? ? return exp;

}



PlayerRequiredExp(playerid)

{

? ? new requiredexp = playerData[playerid][pLevel] * 2000;

return requiredexp;

}



pExp are always start from 0 when you're level up

So crashdetect always give me this?Run time error 11: "Divide by zero"

I need some idea how to get pass this one

I just want to popup exp to % but I need pExp to start by 0 when level up

Is that possible?
  Reply
#2
PHP Code:
ExpProgress(playerid)
{
? ? return 
playerData[playerid][pExp] == :?playerData[playerid][pExp]*100/PlayerRequiredExp(playerid);



I think doing this check should work, try testing.
  Reply


Forum Jump: