1. 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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Salary & AFK system

Discussion in 'Requests' started by L2T, Mar 13, 2023.

  1. L2T

    L2T Member

    Joined:
    Mar 12, 2023
    Messages:
    1
    Likes Received:
    0
    Category: Skript

    Suggested name: AFK - Salary system

    Spigot/Skript Version: Newest 1.19.3

    What I want:
    I'm looking to create a system where every player who is not AFK receives 5$.
    This is what I have come up with so far for the salary system without the AFK feature.

    Code (Text):
    1. on join:
    2.     set join message to "{@JoinMessage}"
    3.     wait 15 minutes
    4.     while player is online:
    5.         add 5 to player's balance
    6.         send "&6&lYou have just received 5 points."
    7.         wait 15 minutes

    And this is something I got from a different forum to mix it in with possibly.
    Code (Text):
    1. options:
    2.     afktime: 600 # how many seconds a player has to be afk before the skript runs.
    3.  
    4. command /afk:
    5.     trigger:
    6.         if {afk::%player%} is not set:
    7.             set {afk::%player%} to true
    8.             broadcast "&4&lServername>> &c%player% Is Now &4&lAFK"
    9.             send title "&4&LYou are AFK!" with subtitle "&cMove in any direction." to player for {@afktime} seconds
    10.             play sound "block.note_block.pling" to player
    11.             set {_loc} to location of player
    12.             while {afk::%player%} is set:
    13.                 wait 1 second
    14.                 if location of player != {_loc}:
    15.                     delete {afk::%player%}
    16.                     broadcast "&4&lServername>> &c%player% Is No Longer &4&lAFK"
    17.                     send title "&4&LYou are no longer AFK!" to player for 2 seconds
    18.                     play sound "block.note_block.pling" to player
    19.  
    20. on chat:
    21.     if {afk::%player%} is not set:
    22.         stop
    23.     else if {afk::%player%} is set:
    24.         delete {afk::%player%}
    25.         broadcast "&4&lServerName>> &c%player% Is No Longer &4&lAFK"
    26.         send title "&4&LYou are no longer AFK!" to player for 2 seconds
    27.         play sound "block.note_block.pling" to player
    28.            
    29. on any move:
    30.     if {afk::%player%} is set:
    31.         delete {afk::%player%}
    32.  
    33.         send title "&4&LYou are no longer AFK!" to player for 2 seconds
    34.         play sound "block.note_block.pling" to player
    35.        
    36. every second:
    37.     set {_loc} to location of player
    38.     if location of player != {_loc}:
    39.         set {afktime::%player%} to 0
    40.         delete {afk::%player%}
    41.         broadcast "&4&lServername>> &c%player% Is No Longer &4&lAFK"
    42.         send title "&4&LYou are no longer AFK!" to player for 2 seconds
    43.         play sound "block.note_block.pling" to player
    44.     if location of player = {_loc}:
    45.         add 1 to {afktime::%player%}
    46.     if {afktime::%player%} = {@afktime}:
    47.         set {afk::%player%} to true
    48.         broadcast "&4&lServername>> &c%player% Is Now &4&lAFK"
    49.         send title "&4&LYou are AFK!" with subtitle "&cMove in any direction." to player for {@afktime} seconds
    50.         play sound "block.note_block.pling" to player
    51.         delete {afktime::%player%}


    Ideas for commands: /afk

    Ideas for permissions: core.afk

    When I'd like it by: A reasonable time
     

Share This Page

Loading...