Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # skywars.sk
- # Coded by Santio71
- # Addons required: InstantRespawn
- # Note that this code is licenced with GNU General Public License
- # Original download page: https://raw.githubusercontent.com/SantioMC/Skripts/master/skywars.sk
- # Any updates will be uploaded to the link above
- options:
- version: 2.7.5 #DO NOT CHANGE, IT COULD BREAK THE SKRIPT IN THE FUTURE!
- prefix: &7[&bSkywars&7] &7
- signLine: &9[SKYWARS]
- permission: skywars.admin
- error: &cAn error occurred! Please contact Santio71 to resolve this issue!
- invalidArgument: &cIncorrect argument! Please run &9/skywars help &cfor more help!
- noPermission: &cYou are not permitted to run this command!
- on load:
- clear {chest::*}
- add wooden sword named "&7Wood Sword" to {chest::*} #Feel free to add any more items as you wish!
- add 32 oak planks named "&7Wood" to {chest::*} #Adding it more than once, increases its chance of being recieved
- add golden apple named "&7Golden Apple" to {chest::*}
- add stick named "&7Stick" to {chest::*}
- add 2 oak logs named "&7Log" to {chest::*}
- add diamond named "&7Diamond" to {chest::*}
- on load:
- wait 1 second
- if {lastKnowVersion} is not set:
- set {lastKnowVersion} to "{@version}"
- if {lastKnowVersion} is not "{@version}":
- broadcast "&9Skywars&7 by Santio71 was successfully updated!"
- broadcast "&7If you experience bugs, please inform me on github using the issue tracker!"
- set {lastKnowVersion} to "{@version}"
- command /skywars [<text>] [<text>]:
- description: Main command for skywars
- aliases: sw, skyw, swars
- trigger:
- if arg-1 is not set:
- send "&9Skywars &7- Designed by Santio71" # Do not change, All skripts are licened with GIT licence
- send "&7Want to use this skript? Check it out on my&9 github&7!"
- send "&7&oSkywars Version: {@version}"
- else if arg-1 is "help" or "h" or "?":
- send ""
- send "&a/skywars join &7- Join a skywars game"
- send "&a/skywars leave &7- Leave a skywars game"
- send "&a/skywars list &7- List all skywars games"
- send ""
- if player has permission "{@permission}":
- send "&a/skywars reload &7- Reloads the skript"
- send "&a/skywars create <id> &7- Create a new game"
- send "&a/skywars remove <id> &7- Delete a game"
- send "&a/skywars setspawn <id> &7- Sets a spawnpoint"
- send "&a/skywars start <id> &7- Starts a game"
- send "&a/skywars stop <id> &7- Stops a game"
- send ""
- else if arg-1 is "join" or "j" or "play":
- if arg-2 is not set:
- send "&c/skywars join (game)"
- stop
- if {ingame.%player%} is set:
- send "&cYou are already in a game!"
- stop
- if {games::%arg-2%::running} is not set:
- send "&cThat game is not running!"
- stop
- if {games::%arg-2%::started} is set:
- send "&cThat game already started!"
- stop
- set {_max} to 0
- set {_current} to 0
- loop {games::%arg-2%::spawnpoints::*}:
- add 1 to {_max}
- loop {games::%arg-2%::players::*}:
- add 1 to {_current}
- if {_current} is {_max}:
- send "&cThat game is currently full!"
- stop
- set {ingame.%player%} to arg-2
- send "&aYou joined the queue!"
- else if arg-1 is "leave" or "l":
- if {ingame.%player%} is not set:
- send "&cYou are currently not in a skywars game!"
- stop
- remove player from {games::%{ingame.%player%}%::players::*}
- clear {ingame.%player%}
- send "&cYou left the game!"
- else if arg-1 is "list" or "games" or "allgames" or "showgames" or "runninggames":
- send "&7&m-------------------"
- set {_totalGamesRunning} to 0
- loop {gamesRunning::*}:
- add 1 to {_totalGamesRunning}
- send "&7There are currently &9%{_totalGamesRunning}%&7 running games!"
- send ""
- loop {gamesRunning::*}:
- send "&6≫ &7%loop-value% &a&o(RUNNING)"
- set {_used::%loop-value%} to true
- loop {games::*}:
- if {_used::%loop-value%} is not set:
- send "&6≫ &7%loop-value%"
- send ""
- send "&7&m-------------------"
- else if arg-1 is "reload" or "rl":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- send "&7Reloading %script%.sk"
- execute console command "skript:sk reload %script%"
- send "&aReloaded %script%.sk!"
- else if arg-1 is "create" or "new" or "c":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- if arg-2 is not set:
- send "&c/skywars create (name)"
- stop
- if {games::%arg-2%::exists} is set:
- send "&cThat game already exists!"
- stop
- set {games::%arg-2%::exists} to true
- set {games::%arg-2%::countdown} to 0
- send "&7Created the game: &9%arg-2%&7!"
- else if arg-1 is "remove" or "delete" or "erase" or "r" or "d":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- if arg-2 is not set:
- send "&c/skywars %arg-1% (name)"
- stop
- if {games::%arg-2%::exists} is not set:
- send "&cThat game does not exist!"
- stop
- clear {games::%arg-2%::countdown}
- clear {games::%arg-2%::*}
- remove arg-2 from {gamesRunning::*}
- send "&7Deleted the game: &9%arg-2%&7!"
- else if arg-1 is "setspawn" or "spawnpoint" or "sp" or "ss":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- if arg-2 is not set:
- send "&c/skywars %arg-1% (name)"
- stop
- if {games::%arg-2%::exists} is not set:
- send "&cThat game does not exist!"
- stop
- add player's location to {games::%arg-2%::spawnpoints::*}
- send "&7Added location!"
- send "&9%player's location%"
- set {_a} to 0
- loop {games::%arg-2%::spawnpoints::*}:
- add 1 to {_a}
- send "&7Total spawnpoints:&9 %{_a}%"
- else if arg-1 is "run" or "start" or "begin" or "go":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- if arg-2 is not set:
- send "&c/skywars %arg-1% (name)"
- stop
- if {games::%arg-2%::exists} is not set:
- send "&cThat game does not exist!"
- stop
- if {games::%arg-2%::running} is set:
- send "&cThis game is already running!"
- stop
- set {games::%arg-2%::running} to true
- clear {games::%arg-2%::players::*}
- broadcast "{@prefix}The skywars game, &9%arg-2%&7 is now starting! To join, run &9/skywars join %arg-2%&7!"
- add arg-2 to {gamesRunning::*}
- else if arg-1 is "finish" or "end" or "done" or "stop":
- if player does not have permission "{@permission}":
- send "{@noPermission}"
- stop
- if arg-2 is not set:
- send "&c/skywars %arg-1% (name)"
- stop
- if {games::%arg-2%::exists} is not set:
- send "&cThat game does not exist!"
- stop
- if {games::%arg-2%::running} is not set:
- if {games::%arg-2%::started} is not set:
- send "&cThis game is already stopped!"
- stop
- loop {games::%arg-2%::players::*}:
- clear {ingame.%loop-value%}
- loop {built::%loop-value%::*}:
- set block at location at loop-value-2 to air #rip tall grass lol
- teleport loop-value to {skywars.previousLocation.%loop-value%}
- clear {games::%arg-2%::players::*}
- clear {games::%arg-2%::running}
- clear {games::%arg-2%::countdown}
- remove arg-2 from {gamesRunning::*}
- clear {games::%arg-2%::started}
- loop {restore::*}:
- set block at loop-value to chest
- clear {restore::*}
- broadcast "{@prefix}&9%arg-2%&7 was stopped by &9%player%&7!"
- else:
- send "{@invalidArgument}"
- every 1 second:
- loop {gamesRunning::*}:
- if {games::%loop-value%::countdown} is 1:
- broadcast "{@prefix}&9%loop-value%&7 will start in &930 &7seconds!"
- if {games::%loop-value%::countdown} is 10:
- broadcast "{@prefix}&9%loop-value%&7 will start in &920 &7seconds!"
- if {games::%loop-value%::countdown} is 20:
- broadcast "{@prefix}&9%loop-value%&7 will start in &910 &7seconds!"
- if {games::%loop-value%::countdown} is 25:
- broadcast "{@prefix}&9%loop-value%&7 will start in &95 &7seconds!"
- if {games::%loop-value%::countdown} is 27:
- broadcast "{@prefix}&9%loop-value%&7 will start in &93 &7seconds!"
- if {games::%loop-value%::countdown} is 28:
- broadcast "{@prefix}&9%loop-value%&7 will start in &92 &7seconds!"
- if {games::%loop-value%::countdown} is 29:
- broadcast "{@prefix}&9%loop-value%&7 will start in &91 &7seconds!"
- if {games::%loop-value%::countdown} is 30:
- clear {games::%loop-value%::running}
- clear {games::%loop-value%::countdown}
- set {games::%loop-value%::ready} to true
- set {games::%loop-value%::started} to true
- loop all players:
- if {ingame.%loop-player%} is set:
- add loop-player to {games::%loop-value-1%::players::*}
- loop {games::%loop-value%::players::*}:
- loop {games::%loop-value-1%::spawnpoints::*}:
- if {_done} is not set:
- if {used::%loop-value-3%} is not set:
- set {skywars.previousLocation.%loop-value-2%} to location of loop-value-2
- teleport loop-value-2 to loop-value-3
- set {used::%loop-value-3%} to true
- set {_done} to true
- set {ingame.%loop-value-2%} to loop-value-1
- clear {_done}
- clear {used::*}
- if {games::%loop-value%::running} is set:
- set {_players} to 0
- loop all players:
- if {ingame.%loop-value-2%} is set:
- add 1 to {_players}
- if {_players} >= 2: #Required amount of players (REMINDER)
- if {games::%loop-value%::countdown} is set:
- add 1 to {games::%loop-value%::countdown}
- stop
- else:
- set {games::%loop-value%::countdown} to 1
- else:
- clear {games::%loop-value%::countdown}
- clear {_players}
- else:
- clear {games::%loop-value%::countdown}
- on rightclick:
- event-block is chest
- if {ingame.%player%} is set:
- if {playerModified.%location of event-block%} is not set:
- set {_item} to random object out of {chest::*}
- give {_item} to player
- set event-block to air
- add location of event-block to {restore::*}
- cancel event
- on quit:
- if {ingame.%player%} is set:
- remove player from {games::%{ingame.%player%}%::players::*}
- add player to {lost::*}
- add 1 to {stats::skywars::%player%::loses}
- broadcast "{@prefix}&a%player%&7 was eliminated!"
- clear {ingame.%player%}
- on death:
- victim is a player
- set {_deathPoint} to location of attacker
- if {ingame.%victim%} is set:
- remove victim from {games::%{ingame.%victim%}%::players::*}
- broadcast "&cRemoved!"
- clear {games::%{ingame.%victim%}%::players::%victim%}
- clear {ingame.%victim%}
- add victim to {lost::*}
- add 1 to {stats::skywars::%victim%::loses}
- broadcast "{@prefix}&a%victim%&7 was eliminated by &a%attacker%&7!"
- add 1 to {stats::skywars::%victim%::deaths}
- attacker is a player:
- add 1 to {stats::skywars::%attacker%::kills}
- set victim's gamemode to spectator
- wait 2 seconds # Install InstantRespawn for this btw!
- teleport victim to {_deathPoint}
- every 5 ticks:
- loop {gamesRunning::*}:
- if {games::%loop-value%::ready} is set:
- clear {_p}
- loop all players:
- if {ingame.%loop-player%} contains loop-value-1:
- add 1 to {_p}
- set {_lkp} to loop-player
- if {_p} is 1:
- broadcast "s"
- clear {games::%loop-value%::ready}
- won({_lkp})
- on command:
- player is a player #Check if it is not console
- if {ingame.%player%} is set:
- if command is not "hub" or "l" or "lobby" or "r" or "lobby" or "help" or "sw" or "skywars" or "leave":
- if player does not have permission "{@permission}":
- send "&cYou cannot run %complete command% while playing skywars!"
- stop
- if command is "leave":
- make player execute "skywars leave"
- cancel event
- function won(p: player):
- loop {games::%{ingame.%{_p}%}%::players::*}:
- teleport loop-value to {skywars.previousLocation.%loop-value%}
- loop {lost::*}:
- loop {built::%loop-value%::*}:
- set block at location at loop-value-2 to air
- clear {ingame.%loop-value%}
- loop {built::%{_p}%::*}:
- set block at location at loop-value to air
- loop {restore::*}:
- set block at loop-value to chest
- clear {restore::*}
- clear {lost::*}
- remove {ingame.%{_p}%} from {gamesRunning::*}
- clear {ingame.%{_p}%}
- add 1 to {stats::skywars::%{_p}%::wins}
- broadcast "{@prefix}&a%{_p}% &7has won skywars!"
- on place:
- if {ingame.%player%} is set:
- add location of event-block to {built::%player%::*}
- set {playerModified.%location of event-block%} to true
- on break:
- if {ingame.%player%} is set:
- if {playerModified.%location of event-block%} is not set:
- send "&cYou can only break blocks built by players!"
- cancel event
- on rightclick:
- event-block is sign
- if line 1 contains "[skywars]":
- if line 1 is not "&1[SKYWARS]":
- if player has permission "{@permission}":
- set line 1 to "&1[SKYWARS]"
- if line 2 is "" or " ":
- set line 2 to "&4(join|leave)"
- set line 3 to "&4[name]"
- if line 2 is "leave":
- set line 2 to "&4LEAVE"
- if line 2 is "join":
- set line 2 to "&2JOIN"
- if line 3 is not "" or " ":
- if {games::%line 3%::exists} is set:
- set line 3 to "&2%line 3%"
- while event-block is sign:
- wait 5 ticks #Best not to remove btw lol... ;/
- set {_game} to line 3
- replace all "&a" with "" in {_game} #Cant forget this! I did forget it...
- set {_inGame} to 0
- wait a tick
- loop {games::%{_game}%::players::*}:
- add 1 to {_inGame}
- set {_max} to 0
- loop {games::%{_game}%::spawnpoints::*}:
- add 1 to {_max}
- set line 4 to "&f&o(%{_inGame}%|%{_max}%)"
- else:
- set line 3 to "&cUnknown game!"
- else:
- send "&cYou cannot place skywars signs!"
- else:
- if line 2 contains "&c(join|leave)":
- send "&cThis skywars sign is not setup probally!"
- cancel event
- else if line 2 contains "leave":
- make player execute "skywars leave"
- cancel event
- else if line 2 contains "join":
- if line 3 is not "" or " ":
- set {_g} to line 3
- replace all "&2" with "" in {_g} # Bug-fixes ::DDDD
- make player execute "skywars join %{_g}%"
- cancel event
- else:
- send "&cThis sign did not specify which game to send you in!"
- cancel event
- else:
- send "&cThis skywars sign is not setup probally!"
- cancel event
Advertisement
Add Comment
Please, Sign In to add comment