Jump to content
MakeWebGames

Recommended Posts

Posted

Re: Looking For MedPack Fix

This is the code i use in itemuse.php and it works fine..

 

if($r['itmtypename'] == 'Medical')
{
$stat="Health";
$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");
if($r['itmname'] == 'Full Restore')
{
mysql_query("UPDATE users SET energy=maxenergy,will=maxwill,brave=maxbrave WHERE userid=$userid",$c);
$stat="Energy";
}
if($r['itmname'] == 'Motivation Potion')
{
$stat="Motivation";
mysql_query("UPDATE users SET will=maxwill WHERE userid=$userid",$c);
}
if($r['itmname'] == 'Small First Aid kit')
{
mysql_query("UPDATE users SET hospital=hospital-50 WHERE userid=$userid",$c);
}
if($r['itmname'] == 'First Aid Kit')
{
mysql_query("UPDATE users SET hospital=hospital-75 WHERE userid=$userid",$c);
}
if($r['itmname'] == 'Morphine')
{
mysql_query("UPDATE users SET hospital=hospital-100 WHERE userid=$userid",$c);
}

echo 'You use a '.$r['itmname'].'. You feel a bit of '.$stat.' coming back to you.';
mysql_query("UPDATE users SET hospital=0 WHERE hospital<0", $c);
}

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.

×
×
  • Create New...