N00b Posted April 7, 2007 Posted April 7, 2007 how do u make a med reduce hospital time it says in my owner panel in creating items but it dont work Quote
CraigF Posted April 8, 2007 Posted April 8, 2007 Re: Medical items dont work Open "Itemuse.php" When you make your item call it "Medi-Kit" Now in itemuse.php find: else if($r['itmtypename'] == 'Medical') { $f=mysql_query("SELECT * FROM medical WHERE item_id={$r['itmid']}",$c); $fr=mysql_fetch_array($f); mysql_query("UPDATE inventory SET inv_qty=inv_qty-1 WHERE inv_id={$_GET['ID']}",$c); mysql_query("DELETE FROM inventory WHERE inv_qty=0",$c); mysql_query("UPDATE users SET hp=hp+{$fr['health']} WHERE userid=$userid"); mysql_query("UPDATE users SET hp=maxhp WHERE hp > maxhp"); Add below it if($r['itmname'] == 'Medi-kit') { mysql_query("UPDATE users SET hospital=hospital-30 WHERE userid=$userid",$c); } print "You put a {$r['itmname']} onto your wounds, You feel healed and ready for the day."; } Quote
Vorlen Posted April 8, 2007 Posted April 8, 2007 Re: Medical items dont work Better approach... FIND: else if($r['itmtypename'] == 'Medical') { $f=mysql_query("SELECT * FROM medical WHERE item_id={$r['itmid']}",$c); $fr=mysql_fetch_array($f); mysql_query("UPDATE inventory SET inv_qty=inv_qty-1 WHERE inv_id={$_GET['ID']}",$c); mysql_query("DELETE FROM inventory WHERE inv_qty=0",$c); mysql_query("UPDATE users SET hp=hp+{$fr['health']} WHERE userid=$userid"); mysql_query("UPDATE users SET hp=maxhp WHERE hp > maxhp"); REPLACE WITH: else if($r['itmtypename'] == 'Medical') { $f=mysql_query("SELECT * FROM medical WHERE item_id={$r['itmid']}",$c); $fr=mysql_fetch_array($f); mysql_query("UPDATE inventory SET inv_qty=inv_qty-1 WHERE inv_id={$_GET['ID']}",$c); mysql_query("DELETE FROM inventory WHERE inv_qty=0",$c); mysql_query("UPDATE users SET hp=hp+{$fr['health']} WHERE userid=$userid"); mysql_query("UPDATE users SET hp=maxhp WHERE hp > maxhp"); mysql_query("UPDATE users SET hospital=hospital-{$fr['health']} WHERE userid=$userid"); mysql_query("UPDATE users SET hospital=0 WHERE hospital<0"); That will make it so when you create a med item, it takes off the time as it says it will. Quote
CraigF Posted April 8, 2007 Posted April 8, 2007 Re: Medical items dont work ¬¬ hat takes your hospital right down to 0 though, i didnt think he would want it like that Quote
Vorlen Posted April 8, 2007 Posted April 8, 2007 Re: Medical items dont work ¬¬ hat takes your hospital right down to 0 though, i didnt think he would want it like that No it doesn't. It reduces hospital time by the "health" column in the database, as defined while making a medical item. Then, if it brings you below 0, it sets it TO 0, so that you don't stay in hosp with negative minutes. Quote
CraigF Posted April 8, 2007 Posted April 8, 2007 Re: Medical items dont work oh i see! hospital=0 WHERE hospital<0 i didnt realise that bit properly :D Quote
N00b Posted April 8, 2007 Author Posted April 8, 2007 Re: Medical items dont work Ok kl thx for ur help Quote
Godfather Posted July 21, 2007 Posted July 21, 2007 Re: Medical items dont work yeah i had the same problem as this but now its fixed vorlen+1karma for you m8 wwwwwooooooooooooohhhhhhhooooooooo Quote
John99 Posted July 29, 2007 Posted July 29, 2007 Re: Medical items dont work Thanks got it to all work so MANY bugs in McCode 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.