SHAD Posted March 5, 2010 Share Posted March 5, 2010 Ok i have 3 different sucess texts, and they are called "crimeSTEXT" "crimeSSTEXT" "crimeSSSTEXT". But how do i add these in the docrime.php, so it selects one of these at random. <?php $macropage="docrime.php?c={$_GET['c']}"; include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $_GET['c']=abs((int) $_GET['c']); echo' <span style="font-variant: small-caps;"><h2>Crimes</h2></span>'; print" <hr color=#303030 width=85%/> "; if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else { $ec="\$sucrate=".str_replace(array("LEVEL","CRIMEXP","EXP","WILL","IQ"), array($ir['level'], $ir['crimexp'], $ir['exp'], $ir['will'], $ir['IQ']),$r['crimePERCFORM']).";"; eval($ec); print"<font color=green>[b]"; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,175) <= $sucrate) { print str_replace("{money}",$r['crimeSUCCESSMUNY'],$r['crimeSTEXT']); $ir['money']+=$r['crimeSUCCESSMUNY']; $ir['crystals']+=$r['crimeSUCCESSCRYS']; $ir['exp']+=(int) ($r['crimeSUCCESSMUNY']/8); mysql_query("UPDATE users SET money={$ir['money']}, crystals={$ir['crystals']}, exp={$ir['exp']},crimexp=crimexp+{$r['crimeXP']} WHERE userid=$userid",$c); print"</font>"; if($r['crimeSUCCESSITEM']) { item_add($userid, $r['crimeSUCCESSITEM'], 1); } } else { if(rand(1, 2) == 1) { print"<font color=brown>"; print $r['crimeFTEXT']; print"</font>"; } else { print"<font color=red>"; print $r['crimeJTEXT']; print"</font>"; $db->query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'"); } } print " "; print " <hr color=#303030 width=85%/>[url='docrime.php?c={$_GET[']• Try Again[/url] [url='crimes.php']• Crimes[/url]<hr color=#303030 width=85%/>"; } }print" "; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted March 5, 2010 Share Posted March 5, 2010 I thought it already picked the outcome at random Quote Link to comment Share on other sites More sharing options...
SHAD Posted March 5, 2010 Author Share Posted March 5, 2010 I thought it already picked the outcome at random Yea it does,but it only has a single outcome for success text,and i have made 3 but i dont know how to implant them in to docrime.php so it select one of those success texts instead of selecting just one sucess text. Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted March 5, 2010 Share Posted March 5, 2010 $randstextnum=rand(1,3); if($randstextnum==1) { $crstext=$r['crimeSTEXT']; } elseif($randstextnum==2) { $crstext=$r['crimeSSTEXT']; } else { $crstext=$r['crimeSSSTEXT']; } 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.