I have put together a mod to allow users to double their will for 5 minutes to do some power training. FOR REDUX
if you have any issues with it please feel free to post here
SQL's
ALTER TABLE `users` ADD `adren` TINYINT NOT NULL DEFAULT '0';
ALTER TABLE `users` ADD `adrenaline` INT NOT NULL DEFAULT '0';
double.php
<?php
require_once('./Global/globals.php');
global $userid, $h;
echo "<h2>Double Will Training</h2>";
echo "Would you like to double your will for training?<br />";
echo "The cost is 500 points<br /><br />";
echo "<a href='".gen_url('double',true)."&double=yes'><font color=green>Double My Will</font></a><br />";
$adren=$db->query("SELECT adrenaline, adren, second FROM users WHERE userid={$userid}");
$r = $db->fetch_row($adren);
if($_GET['double']=="yes")
{
if($r['second'] < 500){
echo "You do not have enough points to buy this";
$h->endpage();
exit;
}
elseif($r['adrenaline']>0){
echo "You already have double will";
$h->endpage();
exit;
}
else{
$db->query("UPDATE users SET adren=1, maxwill = maxwill*2, adrenaline = 5, will=maxwill, second=second-500 WHERE userid={$userid}");
echo "You now have double will.<br /><a href='".gen_url('gym',true)."'><font color=green>GO TO Gym</font></a><br />";
}
}
?>
then add this to the
minute cron
$db->query("UPDATE users SET adrenaline=adrenaline-1 WHERE adrenaline>0");
$adren=$db->query("SELECT userid, adrenaline, adren FROM users WHERE adren = 1 AND adrenaline=0");
while($adrenoff=$db->fetch_row($adren)){
$db->query("UPDATE users SET adren=0, maxwill = maxwill/2 WHERE userid={$adrenoff['userid']}");
$db->query("UPDATE users SET will=maxwill WHERE userid={$adrenoff['userid']}");
}
dont forget to add the link to it in your explore menu and index it in the index.php array so it can be accessed