My goal is to have the player need to eat daily the day ending at 12am.
i made a hungry value in the database under player. and i think what needs to be done is have a code that alters this value at say 12am everyday to hungry then when the player uses say steak... this moves the value to not hungry?
but I have no idea how to have this value alter at the designated time everyday...
any ideas?
this is how it would look if this was a change from hungry to not hungry i think.
Where i would be using 0 and 1 to differ between hunger and not hungry.
Code: Select all
<?php
 if (isset($_GET['randid']))
    {
       $randid=$_GET['randid'];
       $iteminfo="SELECT * from inventory where randid='$randid'";
    $iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
    $iteminfo3=mysql_fetch_array($iteminfo2);
    if (!$iteminfo3['name'])
    {
    }
    else
    {
    $name = $iteminfo3['name'];
    $stats = $iteminfo3['stats'];
    $statadd = $iteminfo3['statadd'];
    $type = $iteminfo3['type'];
    if ($type == "food")
    {
       $newhunger = $statadd + $playerhunger;
       if ($newhunger > $playerinfo3['maxhunger'])
       {
        $newhunger = $playerinfo3['maxhunger'];
       }
        $updateplayer="update players set hunger='$newhunger' where name='$player'";
      mysql_query($updateplayer) or die("Could not update player");
        $updateitem="DELETE from inventory where name='$name' AND randid='$randid' limit 1";
      mysql_query($updateitem) or die("Could not delete item");
       
       $playerhunger = $newhunger;
     
      echo "Used " . $name . " and recovered " . $statadd . ".<br>";
    }
    }}
  ?>
<?php

