<?php
include("functions.php");
connect();
$get_users = mysql_query("SELECT * FROM `stats`") or die(mysql_error());
while($user = mysql_fetch_assoc($get_users)){
$update = mysql_query("UPDATE `stats` SET
`gold`=`gold`+'".$user['income']."',
`food`=`food`+'".$user['farming']."',
`turns`=`turns`+'5' WHERE `id`='".$user['id']."'") or die(mysql_error());
$update = mysql_query("UPDATE `stats` SET
`turns`=`turns`+'5' WHERE `id`='".$user['id']."'") or die(mysql_error());
}
if(!isset($_SESSION['uid'])){
}else{
if ($stats['turns'] > $stats['maxturns']) {
$update = mysql_query("update stats set maxturns = $stats[maxturns] WHERE id='$id'") or die ("Could not update player");
}
}
?>
Well you have to say I'm persistent LOL. No fix yet, but I'll get there when I'm fully bald LOL. I know I'm closeity close close YAY. Time for more coffee?
Blame Halls LOL, he duh one that said to come on over and keep ya'll busy
<?php
$currenttime = time();
////////////////////static variables////////////////////
//// Everything is done in seconds////
$hptime = 30;
$healedhealth = 2;
//////////////////////////////////////////////////////
if($stats['crontime'] < 1)
{
$updateplayer="update stats set crontime='$currenttime' where id='$id'";
mysql_query($updateplayer) or die("Could not update player");
}
else
{
$timepassed = $currenttime - $stats['crontime'];
if($timepassed > $hptime)
{
$intervals = $timepassed / $hptime;
$intervals = (int)$intervals;
$healedhealth = $intervals * $healedhealth;
$totalhealth = $stats['hpoints'] + $healedhealth;
if($totalhealth > $stats['maxhp']){$totalhealth = $stats['maxhp'];}
$updateplayer="update stats set crontime='$currenttime',hpoints='$totalhealth' where id='$id'";
mysql_query($updateplayer) or die("Could not update player");
}
}
?>
Basically I want to copy and paste that entire thing and use it for turns too. But I've tried and I keep getting an invalid if statement. Frustrating. So how to continue past this part?