Time in a region

  • 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 comminuty!

    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!

Ashey_Gamer

New Member
May 22, 2024
8
0
1
20
So how i go about making a timer for a player's time spent in a region?

so far ive got

command /afktime:
trigger:
if "%region at player%" contains "afk":

would i use a timespan expression??? idk :/
sorry I'm new to skript and still learning.
 
I made an afk reward thing earlier that you can use as a reference if you want
 
I made an afk reward thing earlier that you can use as a reference if you want
sorry i may of been unclear what i meant, so we have an afk reward system every 30 mins and 2 hrs but players wanted to check how long they have been afk and this time carries over if they leave and come back into afk region.
 
every 30 minutes:
loop all players:
if "%region at loop-player%" contains "afk":
console command "/coins give %loop-player% 2"
console command "/codex unlock %loop-player% objectives 2"
send "&8[&3&l!&8] &3&lAFK &8→ &7You have been given &f2x Coins &7for being AFK!" to loop-player

every 120 minutes:
loop all players:
if "%region at loop-player%" contains "afk":
console command "/excellentcrates:crate key give %loop-player% common 1"
console command "/codex unlock %loop-player% objectives 2"
send "&8[&3&l!&8] &3&lAFK &8→ &7You have been given &f1x Common Key &7for being AFK!" to loop-player

on region enter:
wait 2 ticks
if "%region at player%" contains "afk":
send "&8[&3&l!&8] &3&lAFK &8→ &aYou will now receive afk rewards!"

on region exit:
if "%region at player%" contains "afk":
send "&8[&3&l!&8] &3&lAFK &8→ &cYou will no longer receive afk rewards!"
this how they set-up the rewards system (i did not make this)
and a command is wanted to check how long they player has afk at the pool (time spent in region)
 
Oh, yeah i dont like those systems. If you display the timer people will just jump in the afk pool right before the timer goes off and then go back to whatever they are doing. They dont actually have to be there the whole time, just when the timer goes off. If you do want to use that i would set a variable to now when the rewards are given and then use difference between 30 minutes and (difference between {variable} and now)

Or, if you just want to track how long they have been in the pool you can set a variable to now when they enter and then make a while loop that works as long as the region at the player is the afk region. In that loop you can send the time since the variable
 
Last edited:
Oh, yeah i dont like those systems. If you display the timer people will just jump in the afk pool right before the timer goes off and then go back to whatever they are doing. They dont actually have to be there the whole time, just when the timer goes off. If you do want to use that i would set a variable to now when the rewards are given and then use difference between 30 minutes and (difference between {variable} and now)

Or, if you just want to track how long they have been in the pool you can set a variable to now when they enter and then make a while loop that works as long as the region at the player is the afk region. In that loop you can send the time since the variable
yes the second part is what im after but i have got a clue how i would even do that