Solved AFK Region Help

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

VisualMCINC

New Member
Oct 9, 2023
7
0
1
I am trying to make it so if a player is in a specific region, they will get 3% of their balance every 15minutes.
I've got the code here, however, I am getting the error: I'm really, really new to skripting, never done it in my life up until about a week ago. So I'm trying to learn. I've tried changing a few things around to debug the code at the bottom of this post, but i'm having no luck.
1698253968532.png


Code:
on load:
    every 15 minutes:
        loop all players:
            set {_player} to loop-player
            set {_region} to region at location of {_player}
           
            if {_region} is "AFKTEST":
                execute console command "essentials:balance %{_player}%"
                set {_balance} to last executed command
                set {_balance} to {_balance} as number
                set {_balanceIncrease} to {_balance} * 0.03
                execute console command "essentials:give %{_player}% %{_balanceIncrease}%"
 
Last edited:
I dont think so, you can just use every 15 minutes and you should be good.
 
I dont think so, you can just use every 15 minutes and you should be good.
Hmm, i've removed on load, and I think I fixed the indentation as it was causing errors. Now I'm just stuck with these errors:


Code:
[Skript] Reloading AFK.sk...
Line 4: (AFK.sk)
{_region} can only be set to one object, not more
Line: set {_region} to region at location of {_player}
Line 8: (AFK.sk)
Can't understand this expression: 'last executed command'
Line: set {_balance} to last executed command
Line 9: (AFK.sk)
Can't understand this expression: '{_balance} as number'
Line: set {_balance} to {_balance} as number
[Skript] Encountered 3 errors while reloading AFK.sk! (10ms)
 
You think too much about it, keep it simple, you dont need to make thousand of variables, just do it like this:
Code:
every 15 minutes:
    loop all players:
        if "%region at loop-player%" contains "afktest":
            set {_b} to balance of loop-player
            set {_balance} to {_b} * 0.03
            add {_balance} to balance of loop-player
 
  • Like
Reactions: VisualMCINC
You think too much about it, keep it simple, you dont need to make thousand of variables, just do it like this:
Code:
every 15 minutes:
    loop all players:
        if "%region at loop-player%" contains "afktest":
            set {_b} to balance of loop-player
            set {_balance} to {_b} * 0.03
            add {_balance} to balance of loop-player
You're amazing, thank you so much!