AFK Command

Null45

Knowledgeable
#1
I made a fully functional AFK command, by running this command it will message everyone that "P is now afk" and if you change your position, yaw, pitch, or world it will automatically message everyone that "P is no longer afk"

cmd create afk AFK Main Command. | /afk
cmd add afk let %xx% = %x%
cmd add afk let %yy% = %y%
cmd add afk let %zz% = %z%
cmd add afk let %yaww% = %yaw%
cmd add afk let %pitchh% = %pitch%
cmd add afk let %levell% = %level%
cmd add afk message onlineplayers() §d%p% §ais now afk!
cmd add afk if %p% notin onlineplayers() then exit
cmd add afk if %x% != %xx% then goto 17
cmd add afk if %y% != %yy% then goto 17
cmd add afk if %z% != %zz% then goto 17
cmd add afk if %yaw% != %yaww% then goto 17
cmd add afk if %pitch% != %pitchh% then goto 17
cmd add afk if %level% != %level% then goto 17
cmd add afk sleep 0.2
cmd add afk goto 8
cmd add afk message onlineplayers() §d%p% §ais no longer afk!
cmd add afk exit