Timer problem

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

funny

Member
Nov 2, 2021
2
0
1
Timer problem when there is one person on the server, then the timer is only for him, but when the second person comes in and more, then the timer becomes common for everyone, how to make each player have a separate timer?
 
Timer problem when there is one person on the server, then the timer is only for him, but when the second person comes in and more, then the timer becomes common for everyone, how to make each player have a separate timer?
Make the variables player based by adding %player's uuid%
 
Make the variables player based by adding %player's uuid%
If you can help, I'll throw off the code


  1. every tick in "Parkour_Biomes":
  2. loop all players:
  3. if {%loop-player%.hours} is not set:
  4. set {%loop-player%.hours} to 0
  5. if {%loop-player%.minutes} is not set:
  6. set {%loop-player%.minutes} to 0
  7. if {timer} is true:
  8. set {%loop-player%.hours} to 0
  9. if {%loop-player%.minutes} is 60:
  10. add 1 to {%loop-player%.hours}
  11. set {%loop-player%.minutes} to 0
  12. if {%loop-player%.seconds} is 60:
  13. add 1 to {%loop-player%.minutes}
  14. set {%loop-player%.seconds} to 0

  15. on rightclick holding a structure void:
  16. if player is in "Parkour_Biomes":
  17. set {timer} to true
  18. set {hours} to 0
  19. set {minutes} to 0
  20. set {seconds} to 0

  21. every 1 second in "Parkour_Biomes":
  22. loop all players:
  23. if {timer} is true:
  24. add 1 to {%loop-player%.seconds}
  25. set action bar of loop-player to "&7%{%loop-player%.hours}% h. &e: &7%{%loop-player%.minutes}% min. &e: &7%{%loop-player%.seconds}% sec."
  26. else:
  27. stop
 
If you can help, I'll throw off the code


  1. every tick in "Parkour_Biomes":
  2. loop all players:
  3. if {%loop-player%.hours} is not set:
  4. set {%loop-player%.hours} to 0
  5. if {%loop-player%.minutes} is not set:
  6. set {%loop-player%.minutes} to 0
  7. if {timer} is true:
  8. set {%loop-player%.hours} to 0
  9. if {%loop-player%.minutes} is 60:
  10. add 1 to {%loop-player%.hours}
  11. set {%loop-player%.minutes} to 0
  12. if {%loop-player%.seconds} is 60:
  13. add 1 to {%loop-player%.minutes}
  14. set {%loop-player%.seconds} to 0

  15. on rightclick holding a structure void:
  16. if player is in "Parkour_Biomes":
  17. set {timer} to true
  18. set {hours} to 0
  19. set {minutes} to 0
  20. set {seconds} to 0

  21. every 1 second in "Parkour_Biomes":
  22. loop all players:
  23. if {timer} is true:
  24. add 1 to {%loop-player%.seconds}
  25. set action bar of loop-player to "&7%{%loop-player%.hours}% h. &e: &7%{%loop-player%.minutes}% min. &e: &7%{%loop-player%.seconds}% sec."
  26. else:
  27. stop
where to start...

1. Use the code block function in the forums
2. use list variables, not this {%loop-player%.minutes} bull
3. looping all players every tick is just asking for lag
4. indent it
5. you dont need a "stop" at line 29, or a "else:" at line 28
 
If you can help, I'll throw off the code


  1. every tick in "Parkour_Biomes":
  2. loop all players:
  3. if {%loop-player%.hours} is not set:
  4. set {%loop-player%.hours} to 0
  5. if {%loop-player%.minutes} is not set:
  6. set {%loop-player%.minutes} to 0
  7. if {timer} is true:
  8. set {%loop-player%.hours} to 0
  9. if {%loop-player%.minutes} is 60:
  10. add 1 to {%loop-player%.hours}
  11. set {%loop-player%.minutes} to 0
  12. if {%loop-player%.seconds} is 60:
  13. add 1 to {%loop-player%.minutes}
  14. set {%loop-player%.seconds} to 0

  15. on rightclick holding a structure void:
  16. if player is in "Parkour_Biomes":
  17. set {timer} to true
  18. set {hours} to 0
  19. set {minutes} to 0
  20. set {seconds} to 0

  21. every 1 second in "Parkour_Biomes":
  22. loop all players:
  23. if {timer} is true:
  24. add 1 to {%loop-player%.seconds}
  25. set action bar of loop-player to "&7%{%loop-player%.hours}% h. &e: &7%{%loop-player%.minutes}% min. &e: &7%{%loop-player%.seconds}% sec."
  26. else:
  27. stop
You should really join SkUnity discord or any other discord as I think you could learn more stuff there, quicker replies. This right here is everyone's nightmare, everything that you could do wrong has been done here
 
Status
Not open for further replies.