~Destiny-Gaming~ Posted May 5, 2008 Share Posted May 5, 2008 Hey I Have A Little Problem that i can not quite fix: when i use an item it uses 2! for some strange reason i have checked itemuse.php and there is no problem in there as i can NOT! Release my game if i don't fix this you may understand what i mean But if some one could help it would be greatly appreciated Thank You Here is my itemuse.php! <?php include "globals.php"; $_GET['ID'] = abs((int) $_GET['ID']); //Food if(!$_GET['ID']) { print "Invalid use of file"; } else { $i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid"); if(mysql_num_rows($i) == 0) { print "Invalid item ID"; } else { $r=$db->fetch_row($i); if(!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on']) { die("Sorry, this item cannot be used as it has no effect."); } if($r['effect1_on']) { $einfo=unserialize($r['effect1']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } } if($r['effect2_on']) { $einfo=unserialize($r['effect2']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } } if($r['effect3_on']) { $einfo=unserialize($r['effect3']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } } print "{$r['itmname']} used successfully!"; item_remove($userid, $r['inv_itemid'], 1); } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Halo Posted May 5, 2008 Share Posted May 5, 2008 Re: Slight Problem! Need Help Thats odd, did you edit this recently if you did re-upload your old itemuse.php Quote Link to comment Share on other sites More sharing options...
jimmytubbs Posted May 5, 2008 Share Posted May 5, 2008 Re: Slight Problem! Need Help <?phpinclude "globals.php";$_GET['ID'] = abs((int) $_GET['ID']);//Foodif(!$_GET['ID']){print "Invalid use of file";}else{$i=$db->query("SELECT iv.*,i.*,it.* FROM inventory iv LEFT JOIN items i ON iv.inv_itemid=i.itmid LEFT JOIN itemtypes it ON i.itmtype=it.itmtypeid WHERE iv.inv_id={$_GET['ID']} AND iv.inv_userid=$userid");if(mysql_num_rows($i) == 0){print "Invalid item ID";}else{$r=$db->fetch_row($i);if(!$r['effect1_on'] && !$r['effect2_on'] && !$r['effect3_on']){ die("Sorry, this item cannot be used as it has no effect.");}if($r['effect1_on']){ $einfo=unserialize($r['effect1']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); }}if($r['effect2_on']){ $einfo=unserialize($r['effect2']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); }}if($r['effect3_on']){ $einfo=unserialize($r['effect3']); if($einfo['inc_type']=="percent") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $inc=round($ir['max'.$einfo['stat']]/100*$einfo['inc_amount']); } else { $inc=round($ir[$einfo['stat']]/100*$einfo['inc_amount']); } } else { $inc=$einfo['inc_amount']; } if($einfo['dir']=="pos") { if(in_array($einfo['stat'],array('energy','will','brave','hp'))) { $ir[$einfo['stat']]=min($ir[$einfo['stat']]+$inc, $ir['max'.$einfo['stat']]); } else { $ir[$einfo['stat']]+=$inc; } } else { $ir[$einfo['stat']]=max($ir[$einfo['stat']]-$inc, 0); } $upd=$ir[$einfo['stat']]; if(in_array($einfo['stat'], array('strength', 'agility', 'guard', 'labour', 'IQ'))) { $db->query("UPDATE `userstats` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); } else { $db->query("UPDATE `users` SET {$einfo['stat']} = '{$upd}' WHERE userid={$userid}"); }}print "{$r['itmname']} used successfully!";}}$h->endpage();?> soz if it doesnt work Quote Link to comment Share on other sites More sharing options...
~Destiny-Gaming~ Posted May 5, 2008 Author Share Posted May 5, 2008 Re: Slight Problem! Need Help I Will Try That One Jimmytubbs And No i have not edited it ! Lol Quote Link to comment Share on other sites More sharing options...
~Destiny-Gaming~ Posted May 5, 2008 Author Share Posted May 5, 2008 Re: Slight Problem! Need Help No Sorry Jimmytubbs It Does Not Work ! Quote Link to comment Share on other sites More sharing options...
Klikoka Posted May 5, 2008 Share Posted May 5, 2008 Re: Slight Problem! Need Help Its most likely in your inventory.php file so check that everything in there is ok. Quote Link to comment Share on other sites More sharing options...
~Destiny-Gaming~ Posted May 6, 2008 Author Share Posted May 6, 2008 Re: Slight Problem! Need Help Yes Klikoka I Have Checked Inventory.php And I Can Not See A Problem So i Really Don't Know What It Is :? Quote Link to comment Share on other sites More sharing options...
Magictallguy Posted May 9, 2008 Share Posted May 9, 2008 Re: Slight Problem! Need Help Did you double click it by accident? Sometimes that happens.. Quote Link to comment Share on other sites More sharing options...
~Destiny-Gaming~ Posted May 13, 2008 Author Share Posted May 13, 2008 Re: Slight Problem! Need Help LOL Hahahahah No MTG I Didn't But Anyways 8-) 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.