Jump to content
MakeWebGames

Timers


Canjucks

Recommended Posts

Bare with me still new lol.... I'm wanting to update timers for character stats. I have changed the maximums and names. I'm working on new mod ideas and this timer for say Energy will come into that. At the moment it increase by 4 points / 100. What I want to find out is how to change that to say 5 and see what timer its on so I can change this if say a player pays for a subscription to 10. (I have loads of ideas but am going to build this differently from my past games where I just dumped a heap of things in and really it got a bit lost).

I'll edit my post. What I want to do is put in a timer in the Energy/Will/Health character stats with the totals (done those). Increase the timer and create new ones. Add in conditional checks on pages if you're in hospital not just jail and create the hospital timer for different aspects of the game like Russian roulette for instance where you lose all your energy, will and health plus 30000 minutes in hospital (the only way out is either a medical item or wait it out). For the hospital does it need a seperate table in the db? with jail as users might be able to bust/bail and revive. For awards I need to add one to count so they can be recorded.

Edited by padre
  • Thanks 1
Link to comment
Share on other sites

I still don't have the code tag at in the menus @Dave

Here's a quick rundown from some code used in my schooling mod. I added some quick comments          

          //checks if there is a timer
    if (!$this->user->checkTimer('timerName')) {
      //gets how many minutes are left till reaches zero
     $time = $this->user->getTimer('timerName');
     //a display message timer
     $schoolError = array(
       "timer" => "school",
        "text"=>"You cant take another class until this one is finished!",
        "time" => $this->user->getTimer("timerName")
     );
     
     //puts timer on page
     $this->html .= $this->page->buildElement('timer', $schoolError); 
    }          





//Create or update a timer. This creates a timer if it doesnt exist already.

$this->user->updateTimer("timerName", $classInfo['seconds'] * 60, true);



//No need to update databases to update the timers.

 

 

 

Edit: I'm glad someone finally posting coding questions on this form. 🙂

  • Like 2
Link to comment
Share on other sites

the health bar is inaccurate as it pulls from two tables (rank and userstats). As I want to make that upgrade able i'm thinking I might just make a new field for userstats for maxhealth. I love your code there sim that is something I'm going to add in (you may have written it for me lol). I now need to work out (if someone knows please tell me) how to reduce time in hospital using an item or revive button that costs energy or money. With that I need to cut off pages from being accessible while in jail and hospital.

Link to comment
Share on other sites

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