...

View Full Version : Checking every 250 points in an if statement



masterofollies
06-05-2009, 11:28 PM
So I want something where if they have 250 points they can level up, at 500 points they level again, then again at 750.

Would this work?


$levelup = $row['level'] * 250;

if ($levelup == TRUE)
{
//Process level up
}

kbluhm
06-05-2009, 11:40 PM
$level = floor( $points / 250 );


< 250: level 0
>= 250: level 1
>= 500: level 2
>= 750: level 3, etc...

masterofollies
06-06-2009, 12:39 AM
So you mean like this?


$points = $row['points'];
$level = floor($points / 250 );

if ($level >= 250)
{
//Process
}
else {
//Add Points
}

By the way I plan to reset their points to 0 on every level up.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum