vampireduff Posted September 7, 2009 Posted September 7, 2009 this is my honor exchange php, it works as it is but I would like to know how I could make it so when players exchange their honors they would get the reward per level. so the higher the level the more you gain. <?php include "globals.php"; if(!$_GET['spend']) { print "Welcome to the Honor Award Exchange Center! You have [b]{$ir['honors']}[/b] Honor Awards. What would you like to spend your Honor Awards on? [url='honorexchange.php?spend=IQ']IQ - 200 IQ per Honor Award[/url] [url='honorexchange.php?spend=labour3']Trade for Labour Points - 10,000 Labour Points per Honor Award[/url] [url='honorexchange.php?spend=guard3']Trade for Defense - 10,000 Defense per Honor Award[/url] [url='honorexchange.php?spend=agility3']Trade for Agility - 10,000 Speed per Honor Award[/url] [url='honorexchange.php?spend=strength3']Trade for Strength - 10,000 strength per Honor Award[/url] [url='honorexchange.php?spend=money']Money - \$10,000 per Honor Award[/url] "; } else if($_GET['spend'] == 'IQ') { print "Type in the amount of Honor Awards you want to swap for IQ. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = 200 IQ.<form action='honorexchange.php?spend=IQ2' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'IQ2') { $_POST['honors']=(int) $_POST['honors']; if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=IQ']Back[/url]"; } else { $iqgain=$_POST['honors']*200; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $db->query("UPDATE users SET honors=honors-{$_POST['honors']} WHERE userid=$userid",$c); $db->query("UPDATE userstats SET IQ=IQ+$iqgain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for $iqgain IQ."; } } else if($_GET['spend'] == 'labour3') { print "Type in the amount of Honor Awards you want to swap for labour points. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = 10,000 labour points.<form action='honorexchange.php?spend=labour4' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'labour4') { $_POST['honors']=(int) $_POST['honors']; if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=labour3']Back[/url]"; } else { $labourgain=$_POST['honors']*10000; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $db->query("UPDATE users SET honors=honors-{$_POST['honors']} WHERE userid=$userid",$c); $db->query("UPDATE userstats SET labour=labour+$labourgain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for $labourgain labour points."; } } else if($_GET['spend'] == 'guard3') { print "Type in the amount of Honor Awards you want to swap for Defense. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = 10,000 Defense.<form action='honorexchange.php?spend=guard4' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'guard4') { $_POST['honors']=(int) $_POST['honors']; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=guard3']Back[/url]"; } else { $guardgain=$_POST['honors']*10000; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $db->query("UPDATE users SET honors=honors-{$_POST['honors']} WHERE userid=$userid",$c); $db->query("UPDATE userstats SET guard=guard+$guardgain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for $guardgain Defense."; } } else if($_GET['spend'] == 'agility3') { print "Type in the amount of Honor Awards you want to swap for Agility. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = 10,000 Agility.<form action='honorexchange.php?spend=agility4' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'agility4') { $_POST['honors']=(int) $_POST['honors']; if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=agility3']Back[/url]"; } else { $agilitygain=$_POST['honors']*10000; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $db->query("UPDATE users SET honors=honors-{$_POST['honors']} WHERE userid=$userid",$c); $db->query("UPDATE userstats SET agility=agility+$agilitygain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for $agilitygain Agility."; } } else if($_GET['spend'] == 'strength3') { print "Type in the amount of Honor Awards you want to swap for Strength. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = 10,000 Strength.<form action='honorexchange.php?spend=strength4' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'strength4') { $_POST['honors']=(int) $_POST['honors']; if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=strength3']Back[/url]"; } else { $strengthgain=$_POST['honors']*10000; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $db->query("UPDATE users SET honors=honors-{$_POST['honors']} WHERE userid=$userid",$c); $db->query("UPDATE userstats SET strength=strength+$strengthgain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for $strengthgain Strength."; } } else if($_GET['spend'] == 'money') { print "Type in the amount of Honor Awards you want to swap for \$\$\$. You have [b]{$ir['honors']}[/b] Honor Awards. One Honor Award = \$10,000.<form action='honorexchange.php?spend=money2' method='post'><input type='text' name='honors' /> <input type='submit' value='Swap' /></form>"; } else if($_GET['spend'] == 'money2') { $_POST['honors']=(int) $_POST['honors']; if($_POST['honors'] <= 0 || $_POST['honors'] > $ir['honors']) { print "Error, you either do not have enough Honor Awards or did not fill out the form. [url='honorexchange.php?spend=money']Back[/url]"; } else { $moneygain=$_POST['honors']*10000; $_POST['honors']=strip_tags($_POST['honors']); $_POST['honors']=abs((int)($_POST['honors'])); $_POST['money']=strip_tags($_POST['money']); $_POST['money']=abs($_POST['money']); $db->query("UPDATE users SET honors=honors-{$_POST['honors']},money=money+$moneygain WHERE userid=$userid",$c); print "You traded {$_POST['honors']} Honor Awards for \$$moneygain."; } } $h->endpage(); ?> just a thought as my higher level players are saying it is not worth exchanging the honors because they don't get much for it. Also is there a way to buy items for honors? so I could add special items where you can only buy them for so many (set) honors thanks for any help on this Quote
chicka Posted September 7, 2009 Posted September 7, 2009 Re: [Help] Honor Exchange well you could use something like if($ir['level']==5) { and put your content under that.. The exchange won't show up until they get to that level.. not exactly sure if this will work the way you want but its an idea. Quote
vampireduff Posted September 7, 2009 Author Posted September 7, 2009 Re: [Help] Honor Exchange I meant instead of just getting 200 IQ or 10,000 for the other stats, you would 200 IQ per your level, or 10,000 of the other stats per you level so higher your level the higher stats you would get. thanks replying anyways :) Quote
Mike09 Posted September 15, 2009 Posted September 15, 2009 See on the gain variable where it says *(number) just change those to *$ir['level']*(number) then the number will be times by the level IE: level is 2 Honour exchange is 1,000 User gets 2,000 for the award. Quote
vampireduff Posted September 27, 2009 Author Posted September 27, 2009 Sorted, thanks guys for the help :) I used mike09 method for the parts I wanted it to effect and it works great. so thanks again 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.