#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
#
#    This function has been created by Skilendarz Group.
#             https://skilendarz.com
#
#      GIVE MAP MAKERS THE CREDIT THEY DESERVE!
#             COPYING IS PROHIBITED!
#
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

execute as @e[tag=database] store result entity @s Pos[1] double 0.0001 run scoreboard players get @s pos_y
execute positioned 314 10000 -335 run scoreboard players add @e[tag=database,sort=nearest,limit=1] main 1
execute positioned 314 10000 -335 run scoreboard players add @e[tag=database,sort=nearest,limit=2] main 1
execute positioned 314 10000 -335 run scoreboard players add @e[tag=database,sort=nearest,limit=3] main 1
execute positioned 314 10000 -335 run scoreboard players add @e[tag=database,sort=nearest,limit=4] main 1
execute positioned 314 10000 -335 run scoreboard players add @e[tag=database,sort=nearest,limit=5] main 1