Rdogg Posted February 19, 2009 Posted February 19, 2009 i added that mod but on the database the default for crimeITEM is "0" and users dont have the item id "0" in their inventorie how could i make it so if the Crime item = 0 they can do it without it? criminal.php <?php $macropage="criminal.php"; include "globals.php"; if($ir['jail'] or $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } $q2=$db->query("SELECT * FROM crimes ORDER BY crimeBRAVE ASC"); while ($r2=$db->fetch_row($q2)) { $crimes[]=$r2; } $q=$db->query("SELECT * FROM crimegroups ORDER by cgORDER ASC"); print "[b]Criminal Centre[/b] <table width='75%' cellspacing=1 class='table'><tr><th>Crime</th><th>Cost</th><th>Item Needed</th><th>Do</th></tr>"; while($r=$db->fetch_row($q)) { print "<tr><td colspan='3' class='h'>{$r['cgNAME']}</td></tr>"; foreach($crimes as $v) { $qn=$db->query("SELECT itmname FROM items where itmid={$v['crimeITEM']}"); $n=$db->fetch_row($qn); $name=$n['itmname']; if($v['crimeGROUP'] == $r['cgID']) { print "<tr><td>{$v['crimeNAME']}</td><td>{$v['crimeBRAVE']} Brave</td><td>$name</td><td>[url='docrime.php?c={$v[']Do[/url]</td></tr>"; } } } print "</table>"; $h->endpage(); ?> docrime.php <?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']); if(!$_GET['c']) { print "Invalid crime"; } else { $q=mysql_query("SELECT * FROM crimes WHERE crimeID={$_GET['c']}",$c); $r=mysql_fetch_array($q); $qi=$db->query("SELECT inv_itemid FROM inventory where inv_itemid={$r['crimeITEM']} AND inv_userid=$userid"); $n=$db->fetch_row($qn); if($ir['brave'] < $r['crimeBRAVE']) { print "You do not have enough Brave to perform this crime."; } else if($n['inv_itemid'] != $r['crimeITEM']) { print "You do not have the required item needed 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 $r['crimeITEXT']; $ir['brave']-=$r['crimeBRAVE']; mysql_query("UPDATE users SET brave={$ir['brave']} WHERE userid=$userid",$c); if(rand(1,100) <= $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); if($r['crimeSUCCESSITEM']) { item_add($userid, $r['crimeSUCCESSITEM'], 1); } } else { if(rand(1, 2) == 1) { print $r['crimeFTEXT']; } else { print $r['crimeJTEXT']; $db->query("UPDATE `users` SET `jail` = '$r[crimeJAILTIME]', `jail_reason` = '$r[crimeJREASON]' WHERE `userid` = '$userid'"); } } print " [url='docrime.php?c={$_GET[']Try Again[/url] [url='criminal.php']Crimes[/url]"; } } $h->endpage(); ?> Quote
John99 Posted February 19, 2009 Posted February 19, 2009 Re: [item Needed for crime] ALTER TABLE `crimes` ADD `crimeITEM` INT(11) NOT NULL DEFAULT `0`; Should work.. Quote
AlabamaHit Posted February 19, 2009 Posted February 19, 2009 Re: [item Needed for crime] just go into database. and chagne the default of crimeITEM to the item ID of the crime.... Quote
Rdogg Posted February 19, 2009 Author Posted February 19, 2009 Re: [item Needed for crime] still not working =[ Quote
AlabamaHit Posted February 20, 2009 Posted February 20, 2009 Re: [item Needed for crime] you could go into the code and take out the crimeITEM and just enter the item number in the code itself..... 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.