Jump to content
MakeWebGames

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...