Absolute Zero Posted August 17, 2007 Share Posted August 17, 2007 Hi, I don't post for much help but I couldn't figure out how to do this! With V1 it already comes with: Create New Item, Give Item To User, Edit Item, Delete An Item. When clicking "Create New Item" you can look through a list which has such things as: "Armor, Gun and Medical". When selecting medical you have the option to only "gain health" I would like to know how to minus hospital time with this. Any help is appreciated, and I thank all of you who try. -Absolute Zero Quote Link to comment Share on other sites More sharing options...
seanybob Posted August 17, 2007 Share Posted August 17, 2007 Re: Medical - Reduce Hospital Time I'm gonna try and do this from memory... open up "useitem.php" find the part where it's something like... (psuedocode) if(item_type=medical) { mysql_query(UPDATE users SET hp=maxhp WHERE userid=$userid); } What that code does is just increase a user's health when they use a medical item. Alter the query like so if(item_type=medical) { mysql_query(UPDATE users SET hp=maxhp,hospital=hospital-50 WHERE userid=$userid); } Quote Link to comment Share on other sites More sharing options...
YoungGold Posted August 17, 2007 Share Posted August 17, 2007 Re: Medical - Reduce Hospital Time well in mine i have: } 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['hosp_time']} where userid=$userid"); mysql_query("UPDATE users SET hospital=0 WHERE hospital < 0"); 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-1000 where userid=$userid"); mysql_query("UPDATE users SET hospital=0 WHERE hospital < 0"); Quote Link to comment Share on other sites More sharing options...
Absolute Zero Posted August 17, 2007 Author Share Posted August 17, 2007 Re: Medical - Reduce Hospital Time Tried both: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ',1)' at line 1 Any ideas? Quote Link to comment Share on other sites More sharing options...
Absolute Zero Posted August 17, 2007 Author Share Posted August 17, 2007 Re: Medical - Reduce Hospital Time .... The topic or board you are looking for appears to be either missing or off limits to you. Quote Link to comment Share on other sites More sharing options...
iseeyou94056 Posted August 18, 2007 Share Posted August 18, 2007 Re: Medical - Reduce Hospital Time can you make the same thing but for jail time Quote Link to comment Share on other sites More sharing options...
Absolute Zero Posted August 20, 2007 Author Share Posted August 20, 2007 Re: Medical - Reduce Hospital Time Works great LostOne! Thanks for the help. 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.