DELETE-ME-NOW- Posted July 17, 2010 Share Posted July 17, 2010 What code would i modify to add 'refill will' You can currently do energy and all that, but not will and i want to add that to my game :) Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted July 17, 2010 Share Posted July 17, 2010 refill by using an item - itemuse.php like how you would on the inventory page with the relevant item ID. refill over time auto - in the cronjobs so if its not working then check there Quote Link to comment Share on other sites More sharing options...
Danny696 Posted July 17, 2010 Share Posted July 17, 2010 Check the crons. Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted July 17, 2010 Author Share Posted July 17, 2010 No. I mean, what code to i add in crystletemple.php ? Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted July 17, 2010 Share Posted July 17, 2010 In the same way it does this for brave. Set a cost for the will Create the appropriate link and mysql queries. Make sure its secure so nobody can cheat it. Quote Link to comment Share on other sites More sharing options...
Equinox Posted July 17, 2010 Share Posted July 17, 2010 Add the link: <a href = "crystaltemple.com?spend=wrefill">Refill Will</a> Now add the code: if($_GET['spend'] == 'wrefill') { if($ir['will'] >= $ir['maxwill']) { echo 'You have full will'; } if($ir['crystals'] < 10) { echo 'You don\'t have enough crystals'; } else { mysql_query("UPDATE `users` SET `crystals` = `crystals` - 10, `will` = ".$ir['maxwill']." WHERE (`userid` = ".$_SESSION['userid'].")"); echo 'Will refilled'; } } Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted July 17, 2010 Author Share Posted July 17, 2010 if($_GET['spend'] == 'wrefill') { if($ir['will'] >= $ir['maxwill']) { echo 'You have full will'; } if($ir['crystals'] < 10) { echo 'You don\'t have enough crystals'; } else { mysql_query("UPDATE `users` SET `crystals` = `crystals` - 10, `will` = ".$ir['maxwill']." WHERE (`userid` = ".$_SESSION['userid'].")"); echo 'Will refilled'; } } Thanks. Added that longer code just before the ?> in my code, also added that smaller code, but when i clcik on, 'refill will, it says theres no place there on my server. "Oops! This link appears to be broken." Quote Link to comment Share on other sites More sharing options...
BoGFx Posted July 17, 2010 Share Posted July 17, 2010 else if($_GET['spend'] == 'wrefill') { print "Type in the percent of will you need to refill. You have [b]{$ir['crystals']}[/b] points. "; $wiperc1=(int) ($ir['will']/$ir['maxwill']*100); $wiperc=100-$wiperc1; print "One point = One Percent <form action='crystaltemple.php?spend=willrefill' method='post'><input type='text' name='willperc' value='{$wiperc}'/> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'willrefill') { $_POST['willperc']=(int) $_POST['willperc']; if($_POST['willperc'] <= 0 || $_POST['willperc'] > $ir['crystals']) { print "You do not have enough points, or you did not fill out the form right. [url='crystaltemple.php?spend=money']Back[/url]"; } else { $_POST['willperc']=abs((int) $_POST['willperc']); $willgain1=$_POST['willperc']/100; $willgain2=$willgain1 * $ir['maxwill']; $wiperc1=(int) ($ir['will']/$ir['maxwill']*100); $wiperc=100-$wiperc1; if($_POST['willperc'] > $wiperc) { die ("You do not have that much will."); $h->endpage(); } if($willgain2 > $ir['maxwill']) { print "You do not have that much will."; $h->endpage(); } $db->query("UPDATE users SET crystals=crystals-{$_POST['willperc']},will=will+{$willgain2} WHERE userid=$userid"); print "You successfully refilled ".$_POST['willperc']."% will!"; } } Lets choosers use how much to refill . 1 Points per % Quote Link to comment Share on other sites More sharing options...
DELETE-ME-NOW- Posted July 17, 2010 Author Share Posted July 17, 2010 else if($_GET['spend'] == 'wrefill') { print "Type in the percent of will you need to refill.<br /> You have {$ir['crystals']} points.<br />"; $wiperc1=(int) ($ir['will']/$ir['maxwill']*100); $wiperc=100-$wiperc1; print "One point = One Percent <form action='crystaltemple.php?spend=willrefill' method='post'><input type='text' name='willperc' value='{$wiperc}'/><br /><input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'willrefill') { $_POST['willperc']=(int) $_POST['willperc']; if($_POST['willperc'] <= 0 || $_POST['willperc'] > $ir['crystals']) { print "You do not have enough points, or you did not fill out the form right.<br /> Back"; } else { $_POST['willperc']=abs((int) $_POST['willperc']); $willgain1=$_POST['willperc']/100; $willgain2=$willgain1 * $ir['maxwill']; $wiperc1=(int) ($ir['will']/$ir['maxwill']*100); $wiperc=100-$wiperc1; if($_POST['willperc'] > $wiperc) { die ("You do not have that much will."); $h->endpage(); } if($willgain2 > $ir['maxwill']) { print "You do not have that much will."; $h->endpage(); } $db->query("UPDATE users SET crystals=crystals-{$_POST['willperc']},will=will+{$willgain2} WHERE userid=$userid"); print "You successfully refilled ".$_POST['willperc']."% will!"; } } Where exactly do i add that code? Quote Link to comment Share on other sites More sharing options...
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.