Jump to content

Football script I made - not tested


nmazey

Recommended Posts

 #By nmazey

# Requires Skript, SkQuery, Skellett, and skript-mirror

# Define the variables
variables:
    {ball} = null
    {score::red} = 0
    {score::blue} = 0
    {goals::red::corner1} = location(10, 4, 10, world("world"))
    {goals::red::corner2} = location(10, 4, 15, world("world"))
    {goals::blue::corner1} = location(10, 4, 1, world("world"))
    {goals::blue::corner2} = location(10, 4, 6, world("world"))

# Function to spawn the ball
command /spawnball:
    trigger:
        if {ball} is not set:
            set {ball} to a new armor stand at location(10, 5, 8, world("world"))
            set name of {ball} to "Football"
            set marker state of {ball} to true
            message "Football has been spawned."

# Function to reset the ball
command /resetball:
    trigger:
        if {ball} is set:
            teleport {ball} to location(10, 5, 8, world("world"))
            message "Football has been reset."

# Event when a player interacts with the ball
on right click on armor stand:
    if event-entity is {ball}:
        set {_direction} to direction of player
        set {_x} to x of {_direction}
        set {_y} to y of {_direction}
        set {_z} to z of {_direction}
        set {_vector} to vector({_x}, {_y}, {_z})
        push {ball} with velocity {_vector} multiplied by 1.5
        wait 1 tick
        execute console command "/checkgoal"

# Command to check if a goal is scored
command /checkgoal:
    trigger:
        if {ball} is within {goals::red::corner1} to {goals::red::corner2}:
            add 1 to {score::blue}
            execute console command "/resetball"
            broadcast "Blue team scored! The score is now: Red %{score::red}% - Blue %{score::blue}%"
        if {ball} is within {goals::blue::corner1} to {goals::blue::corner2}:
            add 1 to {score::red}
            execute console command "/resetball"
            broadcast "Red team scored! The score is now: Red %{score::red}% - Blue %{score::blue}%"

# Function to assign a player to a team
command /join [red|blue]:
    trigger:
        if arg 1 is "red":
            set {team::%player%} to "red"
            set player's helmet to leather helmet dyed red
            message "You have joined the Red team."
        if arg 1 is "blue":
            set {team::%player%} to "blue"
            set player's helmet to leather helmet dyed blue
            message "You have joined the Blue team."
 

Edited by nmazey

Nmazey

Hello I'm nmazey and I joined minehut in 2014 but left because
It was super TRASH! and played other servers...

But in 2015 I joined back and saw the in-game gui and I left because i thought That it was still a towny server.. 2 years later I realised that I saw lots of youtube videos about minehut

so I joined again and found out it's not an towny server anymore saw free minecraft servers! Then I started to make a minehut server called foxboxy, newwolf and more

but today in 2024 I have 62 servers and I have the VIP rank and switched to bedrock

 

 

 

Link to comment
Share on other sites

  • nmazey changed the title to Football script I made - not tested

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...