Hi all,
It sure has been a while since I last posted here. So long my old user got purged, but it is good to be back :)
I have a query which is driving me a bit insane. In short, every time a user clicks on a crime it reduces x amount of brave and it replenishes in y amount of time. Basic stuff. So I have a timer countdown which depletes time. That all works great. MY problem is that when it reaches 0, I would expect it to restart counting down from x and it is not. Obviously, if I go to another page, the counter works fine, but I would like it to start counting down again automatically. This is what I have:
// BRAVE UPDATE
if ($brave < $maxbrave) {
?>
<script type="text/javascript">
$(function () {
$('#bminimal').countdown({until: +<?echo $time_Bra;?>, compact: true,
format: 'MS', expiryUrl: '<?echo $_SERVER["REQUEST_URI"];?>'});
return false;
});
</script>
<?
if ($time_Bra < 0) {
if ($ns1['nextBra'] <= $microtime) {
if (($maxbrave-$brave) <= (($maxbrave/10)+0.5)) {
$db->query("UPDATE ue_userstats SET userstat_brave=userstat_maxbrave WHERE userstat_id=$userid");
}else{
$db->query("UPDATE ue_userstats SET userstat_brave=userstat_brave+((userstat_maxbrave/10)+0.5) WHERE userstat_id=$userid");
$db->query("UPDATE ue_nextstats SET nextBra=$bnextstat WHERE nextUser=$userid");
}
}
}
}else{
?>
<script type="text/javascript">
$(function () {
$('#bminimal').countdown({until: +0, compact: true,
format: 'MS'});
});
</script>
<?
}
Any help appreciated.