Thread: ::claimcustompoints (once a day)

Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1 ::claimcustompoints (once a day) 
    Registered Member
    Join Date
    Apr 2016
    Posts
    176
    Thanks given
    25
    Thanks received
    3
    Rep Power
    63
    Okay so I had an idea, but I'm not sure how to go about it. I just want to make a command that can be used only once a day. The command I have is just going to allow the user to claim some points, once a day. The part I'm stuck on is the once a day part. I have seen examples of this somewhere on here, but cannot remember what I was even looking at. Does anyone know where I can read an example of this to better understand it? I know how to make point systems and the rest of it
    Reply With Quote  
     

  2. #2  
    omw 2 steal yo gurl

    Goody's Avatar
    Join Date
    Aug 2016
    Posts
    356
    Thanks given
    59
    Thanks received
    52
    Rep Power
    144
    Well I guess first you would want to decide if you want it to be 24 hours after the player does the command or just at 12:00 am I guess. The Calender and TimeUnit Java classes are pretty helpful either way so in theory you would create a task system and set it to run at "x" time. You could probably add a boolean to your player file and set it to true once you execute the command and while it's true the command is unable to be used. Then once the task completes you set it to false so that the player can use the command again. Theres probably a bit more to it than that like your variable to false once the player logs in, assuming they're offline when the task runs. And you would have to add checks for that as well like an array to carry the list of all the people that have logged in for the day so you aren't setting it to false every time someone logs out and back in
    Best excuse for scamming i've gotten yet



    Ruse Services [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. #3  
    Donator

    Expand's Avatar
    Join Date
    Aug 2017
    Posts
    232
    Thanks given
    123
    Thanks received
    50
    Rep Power
    88
    i wouldn't run a task per person, id just make a fixed reset time at 00:00 from your servers side, add a boolean to the player and on login after reset, resets the boolean. pretty much how rs3 handles it (requires you to log out and log back in to claim anything from reset)
    Last edited by Expand; 06-12-2018 at 04:53 AM.
    Reply With Quote  
     

  4. #4  
    Donator


    Join Date
    Jan 2010
    Age
    24
    Posts
    3,704
    Thanks given
    227
    Thanks received
    372
    Rep Power
    229
    no, just make a long called something like lastClaim, and when someone claims the points succesfully set the variable with System.currentTimeMillis() + (1000 * 60 * 60 * 24) and then inside the command check if the currentTimeMillis < lastClaim then return. and just make that variable save in your char file

    That will ensure that everybody can claim it every 24 hours
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Aug 2017
    Posts
    40
    Thanks given
    0
    Thanks received
    2
    Rep Power
    28
    Quote Originally Posted by Nighel View Post
    no, just make a long called something like lastClaim, and when someone claims the points succesfully set the variable with System.currentTimeMillis() + (1000 * 60 * 60 * 24) and then inside the command check if the currentTimeMillis < lastClaim then return. and just make that variable save in your char file

    That will ensure that everybody can claim it every 24 hours
    And the server shutting down would allow everyone to claim it again. Use the joda library DateTime:
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Registered Member Hyperion.'s Avatar
    Join Date
    Jun 2018
    Posts
    62
    Thanks given
    0
    Thanks received
    16
    Rep Power
    24
    An easy way to do it would be to save the current time in milliseconds to the player save. And then check if a day in milliseconds has passed before they can do what you want them to do again.

    [Only registered and activated users can see links. ]

    Quote Originally Posted by Nevy View Post
    And the server shutting down would allow everyone to claim it again. Use the joda library DateTime:
    [Only registered and activated users can see links. ]
    He said save the variable to the character, so no it wouldn't.
    [Only registered and activated users can see links. ]
    Coming Mid June 2018

    PM me for Discord link
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Aug 2017
    Posts
    40
    Thanks given
    0
    Thanks received
    2
    Rep Power
    28
    If the server restarts the currentTimeMillis would be set back to 0...
    Reply With Quote  
     

  8. #8  
    Registered Member Hyperion.'s Avatar
    Join Date
    Jun 2018
    Posts
    62
    Thanks given
    0
    Thanks received
    16
    Rep Power
    24
    Quote Originally Posted by Nevy View Post
    If the server restarts the currentTimeMillis would be set back to 0...
    System.currenttimeMillis() is the time in milliseconds since 1st January 1970. System.currentTimeMillis() is the same for everyone on every computer across the world providing your system's clock is set to the correct time.
    [Only registered and activated users can see links. ]
    Coming Mid June 2018

    PM me for Discord link
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Aug 2017
    Posts
    40
    Thanks given
    0
    Thanks received
    2
    Rep Power
    28
    Hmm alright. Nonetheless, why would you want to set it as a long instead of just a Datetime? It's much easier to work with Datetime if you want to adjust the system
    Reply With Quote  
     

  10. #10  
    Registered Member Hyperion.'s Avatar
    Join Date
    Jun 2018
    Posts
    62
    Thanks given
    0
    Thanks received
    16
    Rep Power
    24
    Quote Originally Posted by Nevy View Post
    Hmm alright. Nonetheless, why would you want to set it as a long instead of just a Datetime? It's much easier to work with Datetime if you want to adjust the system
    I just suggested an easy way I knew, if your way is better fair play.
    [Only registered and activated users can see links. ]
    Coming Mid June 2018

    PM me for Discord link
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

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

Similar Threads

  1. I see this at least once a day
    By KaiserCo in forum Complaints
    Replies: 1
    Last Post: 07-31-2012, 12:08 AM
  2. Click Here To Play (Only once a day)
    By VlPPY in forum Forum Games
    Replies: 21
    Last Post: 11-18-2011, 01:26 PM
  3. Replies: 1
    Last Post: 09-08-2011, 07:06 AM
  4. making a command only able to do once a day
    By Kc Royals in forum Help
    Replies: 3
    Last Post: 01-30-2011, 01:09 AM
  5. The site is now officially DDOSED once a day
    By iPhoneGuy in forum Complaints
    Replies: 12
    Last Post: 07-21-2009, 04:18 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •