skriptMC/party.sk
2021-06-29 22:09:24 +02:00

98 lines
4.1 KiB
Text

options:
pasDePartie: "&4Aucune partie est en cours."
on load:
ScriptList("add", script)
on unload:
ScriptList("remove", script)
command party [<player>] [<text>]: # commande party
executable by: players
description: Regarde le nombre de joueur dans une partie ou invite un joueur dans ta partie.
trigger:
if arg-2 is set:
if arg-2 is "join": # rejoindre la partie
if {party} is set:
if {party.player.%uuid of player%} is set:
send "&cTu es déjà dans la partie."
stop
set {party.player.%uuid of player%} to true
set {_player} to userOrNick(player)
loop {party.list::*}:
send "%{_player}%&a a rejoint la partie." to loop-value
add player to {party.list::*}
send "&aTu as rejoint la partie."
stop
else:
send {@pasDePartie}
stop
if arg-2 is "leave":
if {party} is set:
if player is {party.creator}:
execute player command "party delete"
stop
else:
delete {party.player.%uuid of player%}
set {_player} to userOrNick(player)
loop {party.list::*}:
send "%{_player}%&c a quitté la partie." to loop-value
remove player from {party.list::*}
send "&cTu as quitté la partie."
stop
else:
send "&4Tu n'es pas dans la partie."
stop
if arg-2 is "create":
if player is op:
if {party} is set:
set {_player} to userOrNick({party.creator})
send "&4La party est déjà créer par %{_player}%&4."
stop
else:
set {party.creator} to player
set {party} to true
send "&aTu as créer la partie."
execute player command "party join"
stop
else:
send option("errorMessage")
if arg-2 is "delete":
if player is {party.creator}:
if {party} is set:
if {thimble} is true:
execute player command "deacoudre"
loop {party.list::*}:
delete {party.player.%uuid of loop-value%}
send "&cPartie supprimée." to loop-value
delete {party.list::*}
delete {party}
stop
else:
send {@pasDePartie}
stop
else:
send option("errorMessage")
stop
if arg-1 is set:
if {party} is set:
send "&aTu as invité &l%arg-1%&r&a."
set {_player} to userOrNick(player)
send formatted "<tooltip:&3Clique sur le message pour rejondre la partie.><cmd:/party join>&aVeux tu rejoindre la partie aux côtés de &9%{_player}%&a ?" to arg-1
else:
send {@pasDePartie}
else:
if {party} is set:
set {_list} to "%{party.list::*}%"
replace all "and" with "&7et&3" in {_list}
replace all "," with "&7,&3" in {_list}
replace all "%{party.creator}%" with "&l%{party.creator}%&r&3" in {_list}
send "Dans la partie : &3%{_list}%&7."
else:
send {@pasDePartie}
on quit:
if {party.player.%uuid of player%} is set:
if player is {party.creator}:
execute player command "party delete"
else:
execute player command "party leave"