Jump to content
MakeWebGames

Medical items dont work


N00b
 Share

Recommended Posts

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.";
}
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...