fancy-afk.sk

Created by vLorenzo

Other available versions. Ordered by newest to oldest versions:

Just so you know, we don't know the file format for every file. If it's just a bunch of random characters, it's probably a .zip or .jar.

#      ___       __                                __   _____                      _ __           ___    ________ __
#     /   | ____/ /   ______ _____  ________  ____/ /  / ___/___  _______  _______(_) /___  __   /   |  / ____/ //_/
#    / /| |/ __  / | / / __ `/ __ \/ ___/ _ \/ __  /   \__ \/ _ \/ ___/ / / / ___/ / __/ / / /  / /| | / /_  / ,<   
#   / ___ / /_/ /| |/ / /_/ / / / / /__/  __/ /_/ /   ___/ /  __/ /__/ /_/ / /  / / /_/ /_/ /  / ___ |/ __/ / /| |  
#  /_/  |_\__,_/ |___/\__,_/_/ /_/\___/\___/\__,_/   /____/\___/\___/\__,_/_/  /_/\__/\__, /  /_/  |_/_/   /_/ |_|  
#                                                                                  /____/                         
# Developed by: Lorenzo1755
# Version: 1.0
# Translations may not be 100% accurate
#------------------------------------------------------------------------------------------------------------------------
options:
	permission: §cCommand only for trusted member

variables:
	{afkserversoundjoin::*} = entity_evoker_cast_spell
	{afkserversoundexit::*} = entity_illusioner_mirror_move

on damage:
	if damage cause is entity:
		set {attacked.%victim's uuid%} to 10
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		subtract 1 from {attacked.%victim's uuid%}
		wait a second
		delete {attacked.%victim's uuid%}
	

#------------------------------------------------------------------------------------------------------------------------
		
command /spawnafk:
	trigger:
		teleport player to {spawnafk}


command /afk [<text>] [<text>] [<text>] [<text>]:
	trigger:
		if arg-1 is "admin":
			if arg-2 is "help":
				if player has permission "afk.admin":
					message ""
					message "&7&m-----------------&3&lAFK&7&7&m---------------"
					message ""
					message "&7afk: /setspawn"
					message "&6INFO: &bSet the spawn location of the afk position"
					message ""
					message "&7/afk admin reset"
					message "&6INFO: &bIf you encounter any errors or bugs try to do this command"
					message ""
					message "&7/afk soundjoin sound"
					message "&6INFO: &bSet the sound when a player goes afk"
					message ""
					message "&7/afk soundexit sound"
					message "&6INFO: &bSet the sound when a player exit from afk"
					message ""
					message "&7Example sounds entity.evoker.cast_spell"
					message "&7see more sounds on internet"
					message ""
					message "&7&m--------&3&lAdvanced Security AFK&7&m-----------"
					stop
		if arg-1 is "admin":
			if arg-2 is "reset":
				if player has permission "afk.admin":
					loop all players:
						set {afk.%player's uuid%} to 0
						send title "&7&lAFK" with subtitle "&7Rebooting: Player AFK..."
						wait a second
						delete {location.%loop-player's uuid%}
						send title "&7&lAFK" with subtitle "&7Rebooting: Player world location..."
						wait a second
						delete {afkplayers::*}
						send title "&7&lAFK" with subtitle "&7Rebooting: AFK ON/OFF Players list..."
						wait a second
						set {afkquit.%loop-player's uuid%} to 0
						send title "&7&lAFK" with subtitle "&7Rebooting: AFK quit process..."
						wait a second
						delete {afkprotected::*}
						send title "&7&lAFK" with subtitle "&7Rebooting: Protected players..."
						wait a second
						send title "&7&lAFK" with subtitle "&7Rebooting: Removing AFK group..."
						wait a second
						set {afkserversoundjoin::*} to entity_evoker_cast_spell
						send title "&7&lAFK" with subtitle "&7Rebooting: Resetting Join sound..."
						wait a second
						set {afkserversoundexit::*} to entity_illusioner_mirror_move
						send title "&7&lAFK" with subtitle "&7Rebooting: Resetting Exit sound..."
						wait a second
						send title "&6&lAFK" with subtitle "&7The afk process was restarted" to all players for 2 seconds
						execute console command "lp user %player% group remove afk"
			else:
				if arg-2 is "joinsound":
					if arg-3 is set:
						if player has permission "afk.admin":
							set {afkserversoundjoin::*} to arg-3
							send title "&6&lAFK" with subtitle "&7Join sound:  %arg-3%"
							message ""
							message "&3&lAFK &7The sound %arg-3% has been addet to afk join event"
							message ""
						else:
							message "{@permission}"
				else:
					if arg-2 is "exitsound":
						if player has permission "afk.admin":
							set {afkserversoundexit::*} to arg-3
							send title "&6&lAFK" with subtitle "&7Exit sound:  %arg-3%"
							message ""
							message "&3&lAFK &7The sound %arg-3% has been addet to afk exit event"
							message ""
						else:
							message "{@permission}"
					else:
						if arg-2 is "setspawn":
							if player has permission "afk.admin":
								set {spawnafk} to location of block at location of player
								send "&bSpawn created in %{spawnafk}%" to player
							else:
								message "{@permission}"
		else:
			if arg-1 is "info":
				message ""
				message "&3&lAFK &7players list: %{afkplayers::*}%" to player 
				message "&7Protected AFK players: %{afkprotected::*}%"
				message ""
			else:
				if arg-1 is set:
					if {afk.%player's uuid%} = 1:
						send title "" with subtitle "&3You are afk the process is automatic"
						teleport player to {location.%player%}
						set {afk.%player's uuid%} to 0
						set gamemode of player to Survival
						execute console command "lp user %player% group remove afk"
					else:
						if {attacked.%player's uuid%} is not set:
							if {location.%player's uuid%} is not set:
								set {location.%player%} to player's location
								broadcast "&3&lAFK &b%player% &6player went afk for &7%arg-1%"
								teleport player to {spawnafk}
								wait a second 
								send title "&e&lAFK" with subtitle "&aEnabled" for 2 seconds
								wait a second
								set {afklocation.%player's uuid%} to player's location
								set gamemode of player to Spectator
								play sound "%{afkserversoundjoin::*}%" with volume 100 and pitch 1 at player for player
								execute console command "lp user %player% group add afk"
								wait 2 seconds
								set {afk.%player's uuid%} to 1
								add player to {afkplayers::*}
						else:
							send title "" with subtitle "&4&lAFK: &cYou are under attack"
							message "&3&lAFK &cYou are under attack you cannot use this command, wait others &3%{attacked.%player's uuid%}% seconds &cto be able to use it"
							stop
				else:
					send title "" with subtitle "&7/afk text" for 2 seconds

		
on any move:
	if {afklocation.%player's uuid%} is set:
		if player's location is not equal to {afklocation.%player's uuid%}:
			if {afk.%player's uuid%} = 1:				
				set {afk.%player's uuid%} to 0
				teleport player to {location.%player%}
				wait a second
				play sound "%{afkserversoundexit::*}%" with volume 100 and pitch 1 at player for player
				set gamemode of player to survival
				execute console command "lp user %player% group remove afk"
				wait 2 seconds
				DELETE {afklocation.%player's uuid%}
				send title "&e&lAFK" with subtitle "&7Disabled" for 2 seconds
				subtract player from {afkprotected::*}
				wait 2 seconds 
				send title "" with subtitle "&bAutomatically moved to the previous position"
				broadcast "&3&lAFK &b%player% &6is back"
				subtract player from {afkplayers::*}

		
on quit:
	if {afk.%player's uuid%} = 1:
		subtract player from {afkplayers::*}
		delete {afklocation.%player's uuid%}
		add player to {afkprotected::*}
		set {afkquit.%player's uuid%} to 1
		set {afk.%player's uuid%} to 0
		broadcast ""
		broadcast "&3&lAFK &7The player &7&n%player% &7was automatically protected from Afk quit process"
		broadcast ""
		stop
		
on join:
	if {afkquit.%player's uuid%} = 1:
		if {afkquit.%player's uuid%} = 1:
			set {afkquit.%player's uuid%} to 0
			subtract player from {afkprotected::*}
			broadcast "&3&lAFK &b%player% &6player went afk for &7protected afk process"
			teleport player to {spawnafk}
			wait a second 
			send title "&e&lAFK" with subtitle "&aEnabled: quit process" for 2 seconds
			wait a second
			set {afklocation.%player's uuid%} to player's location
			set gamemode of player to Spectator
			play sound "%{afkserversoundjoin::*}%" with volume 100 and pitch 1 at player for player
			execute console command "lp user %player% group add afk"
			wait 2 seconds
			set {afk.%player's uuid%} to 1
			add player to {afkplayers::*}