Thread: PI - Time Played

Results 1 to 6 of 6
  1. #1 PI - Time Played 
    Banned
    Join Date
    Jan 2012
    Posts
    265
    Thanks given
    6
    Thanks received
    14
    Rep Power
    0
    Okay, I'm creating time played on server by my self. I am having an issue making the timer start. Some reason when you log on the timer don't start and it doesn't sendMessage like it should. If someone could maybe teamviewer me and maybe help me with this issue?
    Reply With Quote  
     

  2. #2  
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Where are you adding this timer?
    Most proper place would be in the initialize void in client.java

    Advertise your RSPS cheap on my website: www.BryceBux.com

    ^ PM me and I will give you a few dollars for FREE on my website for advertisements ^
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jan 2012
    Posts
    265
    Thanks given
    6
    Thanks received
    14
    Rep Power
    0
    Quote Originally Posted by BryceTheCoder View Post
    Where are you adding this timer?
    Most proper place would be in the initialize void in client.java
    I alright have it placed in there. The issue is the timer is not starting for some reason. I have this placed in "initialize":
    getPA().loadTimer();

    and in playerassistant:

    public void loadTimer()
    {
    c.timePlayed = (System.currentTimeMillis() - c.timePlayed) / 1000;
    if (c.timePlayed >= 60000) {// if at least 60 seconds have passed
    c.timePlayed -= 60000;
    c.timePlayedmin += 1;
    c.timePlayed = System.currentTimeMillis();
    }
    if (c.timePlayedmin >= 60) {
    c.timePlayedmin -= 60;
    c.timePlayedhrs += 1;
    }
    }

    That might not be correct but it was set so if it was at "0" timer it would start counting up. The issue is the timer dont start up like it should have.
    Reply With Quote  
     

  4. #4  
    Registered Member Ronbo's Avatar
    Join Date
    Feb 2013
    Age
    12
    Posts
    167
    Thanks given
    0
    Thanks received
    47
    Rep Power
    17
    Here's a better way to do it in my opinion: (on my phone so I will abbreviate)
    Have just two variables, c.timePlayed and c.thisSession.
    In initialize() add a c.thisSession = Sys.currentTime
    In destruct add c.timePlayed += Sys.time - c.thisSession
    No need to save thisSession.
    If you want you can change the savePlayer method to also update this number (be sure to reset thisSession to the time of the save then)

    For minutes and hours and stuff, just have a method that returns an int array after calculating those values.
    Did I help answer your question? Signs of appreciation are always, well, appreciated!!!


    Reply With Quote  
     

  5. #5  
    Registered Member Ronbo's Avatar
    Join Date
    Feb 2013
    Age
    12
    Posts
    167
    Thanks given
    0
    Thanks received
    47
    Rep Power
    17
    Also your way doesn't work because nothing is in process(). You're just loading the timer once and never checking it again afterwards.
    Did I help answer your question? Signs of appreciation are always, well, appreciated!!!


    Reply With Quote  
     

  6. #6  
    Hella Hard Homie


    Join Date
    Jan 2011
    Posts
    600
    Thanks given
    185
    Thanks received
    43
    Rep Power
    111
    Quote Originally Posted by Ronbo View Post
    Here's a better way to do it in my opinion: (on my phone so I will abbreviate)
    Have just two variables, c.timePlayed and c.thisSession.
    In initialize() add a c.thisSession = Sys.currentTime
    In destruct add c.timePlayed += Sys.time - c.thisSession
    No need to save thisSession.
    If you want you can change the savePlayer method to also update this number (be sure to reset thisSession to the time of the save then)

    For minutes and hours and stuff, just have a method that returns an int array after calculating those values.
    I actually never thought of doing it that way, I would just save the first join date and count the days. Thanks might use in the future.


    Anyway, OT: I suggest you don't put it in process or make a timer like that at all.. As it will cause alot of lag (depending on your player base). Use what Ronbo posted

    Quote Originally Posted by Winston Churchill
    "Success is the ability to go from one failure to another with no loss of enthusiasm"
    Austin still owes me $43
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. [PI] Time of Day/Date/Month/Year
    By a box in forum Help
    Replies: 3
    Last Post: 09-01-2011, 06:27 AM
  2. [PI] Timed points
    By EricFtw in forum Help
    Replies: 1
    Last Post: 07-27-2011, 11:45 AM
  3. [PI]Timed dupe deletion
    By Arithium in forum Help
    Replies: 0
    Last Post: 06-16-2011, 06:22 AM
  4. [pi]Timed kick
    By HobbyCoding in forum Requests
    Replies: 4
    Last Post: 05-27-2011, 03:47 PM
  5. Time Played Timer
    By Solid in forum Help
    Replies: 7
    Last Post: 08-21-2010, 06:13 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •