DragonPrime - LoGD Resource Community
Welcome Guest
  • Good morning, Guest.
    Please log in, or register.
  • June 17, 2019, 05:50:28 AM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: hungery and thirsty  (Read 2783 times)
0 Members and 1 Guest are viewing this topic.
« on: March 19, 2004, 05:06:03 PM »

I just started coding php and I am trying to make it where you can starve. every day you loose 10 hungry points and 10 thirsty point when they get to 0 this should happen. I put checkfood() at the end of the newday function. I put this code in common.php but every day it say thinks the if is true. I already made it subtract 10 of both every day and put the hungry and thirsty in the mysql database and made the default 100 and 50 and it shows them with every thing in vital info. On my server instead of dying you get put in prison.

function checkfood(){
if ($session['user']['hungry']<=1 || $session['user']['thirsty']<=1){
output("`n`nYou realize you haven't had anything to eat in a long time. Suddenly, men in black suits");
output("run at you. You try to fight them off, but you lack the strength because of your hunger.`n");
output("They take you to the prison. `n`n");
output("They strip you of your gold but only half your gems because you");
output("kept them hidden in a secret pocket.");
$session['user']['hitpoints']== 0;
addnav("Go to the Prison","prison.php");
addnews($session['user']['name']." was carried away by kidnapers because he almost starved!");
« Reply #1 on: March 19, 2004, 07:00:28 PM »

Try adding

global $session;

right after

function checkfood(){

Else "$session" is unknowen in this function and so "if ($session['user']['hungry']<=1 || $session['user']['thirsty']<=1)" always is true. Wink

« Reply #2 on: March 19, 2004, 09:41:20 PM »

that works thanks  Smiley
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Please take the time to read the FAQ and browse the DragonPedia

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
90 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search