I'm working on a sleep / fatigue system for my server but I'm having trouble with this loop.
How to make it work?
First problem, every minute does not work without a world on it. The docs says it should, as the example has some timespans without a world select (just "every second:", for example).
The other problem is that the skript says there's no player in a periodical event. How I would do it then? The loop player should be set, as I used "loop all players" first.
The code:
How to make it work?
First problem, every minute does not work without a world on it. The docs says it should, as the example has some timespans without a world select (just "every second:", for example).
The other problem is that the skript says there's no player in a periodical event. How I would do it then? The loop player should be set, as I used "loop all players" first.
The code:
code_language.skript:
every minute:
loop all players:
subtract 1 from {sono.%player%}
if {sono.bypass} is set:
stop
if {sono.%loop-player%} < 25:
apply Mining Fatigue to the loop-player for 60 seconds
if {sono.%loop-player%} < 20:
remove mining fatigue from the loop-player
apply Mining Fatigue 2 to the loop-player for 60 seconds
if {sono.%loop-player%} < 10:
remove mining fatigue from the loop-player
apply Mining Fatigue 3 to the loop-player for 60 seconds
if {sono.%loop-player%} < 5:
message "§b§oE-e... estou muito cansado... p-preciso dormir"
apply slowness 1 to the loop-player for 60 seconds
apply Mining Fatigue 5 to the loop-player for 60 seconds
if {sono.%loop-player%} < -1:
apply blindness 2 to the loop-player for 60 seconds
stop
if {sono.%loop-player%} < 1:
apply blindness 1 to the loop-player for 60 seconds
remove mining fatigue from the loop-player
apply Mining Fatigue 9 to the loop-player for 60 seconds
stop
if {sono.%loop-player%} < 2:
apply blindness 1 to the player for 30 seconds
remove mining fatigue from the player
apply Mining Fatigue 8 to the player for 60 seconds
stop
if {sono.%loop-player%} < 3:
apply blindness 1 to the player for 15 seconds
remove mining fatigue from the player
apply Mining Fatigue 7 to the player for 60 seconds
stop
if {sono.%loop-player%} < 4:
apply blindness 1 to the player for 10 seconds
remove mining fatigue from the player
apply Mining Fatigue 6 to the player for 60 seconds
stop