Jump to content
MakeWebGames

Recommended Posts

Posted

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

Posted

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);
}
Posted

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");

Posted

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?

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...