#Skript rewards every 30 seconds in a specific region

1 messages · Page 1 of 1 (latest)

quick zenith
#

im not receving no rewards and there are no errors in the skript.

on region enter:
    if "%region at player%" contains "afk":
        set {_afk.%player's UUID%} to true

on region enter:
    if "%event-region%" contains "afk":
        send title "&e&lAFK &lAREA" with subtitle "AFK Crate Key every 30 minutes here." for 999 days
        
on region exit:
    if "%event-region%" contains "afk":
        reset title
        set {_afk.%player's UUID%} to false
        
on region enter:
    if "%event-region%" contains "afk":
        if {_afk.%player's UUID%} is true:
            wait 3 seconds
            give player yellow dye of mending 1 named "&e&lAFK &lKEY &lTOKEN"
jade dune
quick zenith
#

dots look cool :p

#

@jade dune I have added a simple debug command and I removed the giving of rewards to player for now. and I saw that {afk::%player's UUID%} doesnt change to true even after I enter the afk region:

on region enter:
    if "%region at player%" contains "afk":
        set {afk::%player's UUID%} to true

on region enter:
    if "%event-region%" contains "afk":
        send title "&e&lAFK &lAREA" with subtitle "AFK Crate Key every 30 minutes here." for 999 days
        
on region exit:
    if "%event-region%" contains "afk":
        reset title
        set {afk::%player's UUID%} to false

command /afkdebug [<text>]:
    trigger:
        if arg-1 is not set:
            send "%{afk::%player's UUID%}%" to player
        if arg-1 is set:
            if arg-1 is "false":
                set {afk::%player's UUID%} to false
            if arg-1 is "true":
                set {afk::%player's UUID%} to true
#

(when i exit it works properly and it sets the {afk::%player's UUID%} to false after I manualy set it to true)

#

nvm I somehow fixed it

#
on region enter:
    if "%event-region%" contains "afk":
        reset title
        set {afk::%player's UUID%} to true


on region enter:
    if "%event-region%" contains "afk":
        send title "&e&lAFK &lAREA" with subtitle "AFK Crate Key every 30 minutes here." for 999 days
        
on region exit:
    if "%event-region%" contains "afk":
        reset title
        set {afk::%player's UUID%} to false

command /afkdebug [<text>]:
    trigger:
        if arg-1 is not set:
            send "%{afk::%player's UUID%}%" to player
        if arg-1 is set:
            if arg-1 is "false":
                set {afk::%player's UUID%} to false
            if arg-1 is "true":
                set {afk::%player's UUID%} to true
#

that works somehow

#

prob was a 1 symbol error

lost oyster
#

Instead of setting it to false delete it

#

Then you save space

#

Also you can combine the on region enter events and if statements

teal drift
#

You could do something like

on region enter
if event region is XYZ
while region at player is XYZ
wait 1 seconds
add 1 second to {afk::%player%}
if afk::player is 30 minutes:
reward them
reset afk::player

#

and delete afk::player when they leave the region

#

you could send them a title do like "%difference between 30 minutes and {afk::%player%}%" to tell them how long it'll be

#

This way each player has their own timer

#

I'm on mobile so it's a pain to type everything out