Hey! I'm working on an auto afk skript (after x amount of seconds without moving, player gets teleported to a warp), and I can't get it to work.
Any help would be appriciated. (PS: I dont own this code)
Code:
on load:
wait 3 seconds
broadcast "&a&lCreeperNet &6Skript&r has been loaded &asuccessfully!"
if %player% is afk:
message "[&a&lCreeperNet AFK Detection] &bYou were afk. You were sent to the &elimbo&b."
make player execute command "warp limbo"
options:
afktime: 10 # how many seconds a player has to be afk before the skript runs.
command /afk:
trigger:
if {afk::%player%} is not set:
set {afk::%player%} to true
make player execute command "warp limbo"
wait 1 second
broadcast "&4&lServername>> &c%player% Is Now &4&lAFK"
send title "&4&LYou are AFK!" with subtitle "&cMove in any direction." to player for {@afktime} seconds
play sound "block.note_block.pling" to player
set {_loc} to location of player
while {afk::%player%} is set:
wait 1 second
if location of player != {_loc}:
delete {afk::%player%}
broadcast "&4&lServername>> &c%player% Is No Longer &4&lAFK"
send title "&4&LYou are no longer AFK!" to player for 2 seconds
play sound "block.note_block.pling" to player
on chat:
if {afk::%player%} is not set:
stop
else if {afk::%player%} is set:
delete {afk::%player%}
broadcast "&4&lServerName>> &c%player% Is No Longer &4&lAFK"
send title "&4&LYou are no longer AFK!" to player for 2 seconds
play sound "block.note_block.pling" to player
on any move:
if {afk::%player%} is set:
delete {afk::%player%}
send title "&4&LYou are no longer AFK!" to player for 2 seconds
play sound "block.note_block.pling" to player
every second:
set {_loc} to location of player
if location of player != {_loc}:
set {afktime::%player%} to 0
delete {afk::%player%}
broadcast "&4&lServername>> &c%player% Is No Longer &4&lAFK"
send title "&4&LYou are no longer AFK!" to player for 2 seconds
play sound "block.note_block.pling" to player
if location of player = {_loc}:
add 1 to {afktime::%player%}
if {afktime::%player%} = 10:
set {afk::%player%} to true
make player execute command "warp limbo"
wait 1 second
broadcast "&4&lServername>> &c%player% Is Now &4&lAFK"
send title "&4&LYou are AFK!" with subtitle "&cMove in any direction." to player for {@afktime} seconds
play sound "block.note_block.pling" to player
delete {afktime::%player%}
Any help would be appriciated. (PS: I dont own this code)