1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Timed Permissions

Discussion in 'Development' started by KinokiYT, May 9, 2020.

  1. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
    Hello, I was wondering if there was a way to make Timed Permissions. What I'm trying to do is, when a player votes, it sets them to have timed permissions for 2 hours. Yes, I know that I can just do timed ranks, but I don't want to have an override if a player buys a rank. If you can give me a hint on what to do, that will help. Thank you.
     
  2. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Where exactly are you stuck?
     
  3. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
    I'm stuck on getting the 2 hour timed permissions. I already know how to do the vote and set the permissions. I am stuck trying to automatically remove their permissions after their 2 hours pass.
     
  4. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Save the date when a player gets the permission with time() and check if the present time() minus the time() you stored is equal or is higher than 2 hours. If this returns true, remove the permission from the player.
     
    driver1848, Khaled and HimbeersaftLP like this.
  5. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    Yeah but that won't work
     
  6. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    You should use task, save player time then check the time in the task
     
  7. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    It does work, please don't say fake information just because you don't know how to write code.
    No. Use my method.
     
  8. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    No, you are
     
  9. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    You are the one start the war, learn the task plz!!!!!!
     
  10. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    time() function just send back a numeric value of the time!
     
  11. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    There are 2 way to solve this
    1. Using task and time()
    2. Using the code where need that permission for checking that
    For example: when player are voted, they got their permission, after that you save the time when player voted. The code will check every it called with the time() (current) with the time saved, if it equal 0, deal off
     
  12. NTT

    NTT Zombie

    Messages:
    311
    GitHub:
    NTT1906
    And @Diduhless, stop calling people don't know how to code. At least if they don't they need to have a help not damage their feeling
     
  13. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
    Can you give me an example?
     
  14. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
  15. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
  16. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    Did you also know you can save in a variable that a player bought a rank at 3pm and at 6pm check if 6-3 is higher than 2 without using a task that will execute every second?
     
  17. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
    I'm confused . . .
     
  18. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    What don't you understand
     
  19. KinokiYT

    KinokiYT Spider Jockey

    Messages:
    25
    GitHub:
    kinokiyt
    On how to make the timer. I already viewed the link, I still am confused.
     
  20. Diduhless

    Diduhless Baby Zombie

    Messages:
    199
    GitHub:
    Diduhless
    When you want to set a timed permission to a player, create a time() and assign it to the player into whatever (for example, an array). After that, check if the actual time minus the time that you stored of the player in before is higher to 2 hours (60*60*2). If it does, this means it has passed 2 hours, so you can remove him the permissions.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.