VitalEnd Posted July 26, 2010 Posted July 26, 2010 Basically i will post up here an energy refil function i use in my gym, i would like a little help please to edit this so it refils will, HOWEVER i want the cost to be 1 point per 1% refilled. so if you have 50% will already then it costs 50 points to refil it back to 100%. Here is the code i need edited: if($_GET['refill'] == 'energy') { if($ir['points'] < $set['ct_refillprice']) { echo "You don't have enough points! [url='gym.php']Back to Gym[/url]"; $h->endpage(); exit; } if($ir['energy'] == $ir['maxenergy']) { echo "You already have full energy. [url='gym.php']Back to Gym[/url]"; $h->endpage(); exit; } $RefilEnergy = sprintf("UPDATE users SET energy = maxenergy, points = points - %u WHERE (userid = %u)", $set['ct_refillprice'], $userid); $db->query($RefilEnergy); echo sprintf("You have paid %s points to refil your energy bar. <hr>", number_format($set['ct_refillprice'])); } Much appreciated if anyone can help :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.