skriptMC/party.sk

95 lines
3.8 KiB
Text
Raw Normal View History

2021-06-28 13:55:10 +02:00
options:
pasDePartie: "&4Aucune partie est en cours."
2021-06-28 21:50:46 +02:00
on load:
ScriptList("add", script)
on unload:
ScriptList("remove", script)
2021-06-28 13:37:39 +02:00
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:
2021-06-28 13:55:10 +02:00
if {party.player.%uuid of player%} is set:
send "&cTu es déjà dans la partie."
stop
2021-06-28 13:37:39 +02:00
set {party.player.%uuid of player%} to true
loop {party.list::*}:
send "%player%&a a rejoint la partie." to loop-value
add player to {party.list::*}
send "&aTu as rejoint la partie."
2021-06-28 13:55:10 +02:00
stop
2021-06-28 13:37:39 +02:00
else:
2021-06-28 13:55:10 +02:00
send {@pasDePartie}
stop
2021-06-28 13:37:39 +02:00
if arg-2 is "leave":
if {party} is set:
if player is {party.creator}:
execute player command "party delete"
2021-06-28 13:55:10 +02:00
stop
2021-06-28 13:37:39 +02:00
else:
delete {party.player.%uuid of 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
2021-06-28 13:37:39 +02:00
else:
send "&4Tu n'es pas dans la partie."
2021-06-28 13:55:10 +02:00
stop
2021-06-28 13:37:39 +02:00
if arg-2 is "create":
if player is op:
if {party} is set:
2021-06-28 13:55:10 +02:00
send "&4La party est déjà créer par %{party.creator}%&4."
stop
2021-06-28 13:37:39 +02:00
else:
set {party.creator} to player
2021-06-28 13:55:10 +02:00
set {party} to true
2021-06-28 13:37:39 +02:00
send "&aTu as créer la partie."
execute player command "party join"
2021-06-28 13:55:10 +02:00
stop
2021-06-28 13:37:39 +02:00
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"
2021-06-28 13:37:39 +02:00
loop {party.list::*}:
delete {party.player.%uuid of loop-value%}
send "&cPartie supprimée." to loop-value
delete {party.list::*}
2021-06-28 13:55:10 +02:00
delete {party}
stop
2021-06-28 13:37:39 +02:00
else:
2021-06-28 13:55:10 +02:00
send {@pasDePartie}
stop
2021-06-28 13:37:39 +02:00
else:
send option("errorMessage")
2021-06-28 13:55:10 +02:00
stop
2021-06-28 13:37:39 +02:00
if arg-1 is set:
2021-06-28 13:55:10 +02:00
if {party} is set:
2021-06-28 16:12:39 +02:00
send "&aTu as invité &l%arg-1%&r&a."
2021-06-28 13:55:10 +02:00
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}
2021-06-28 13:37:39 +02:00
else:
2021-06-28 13:55:10 +02:00
if {party} is set:
set {_list} to "%{party.list::*}%"
replace all "and" with "&7et&3" in {_list}
replace all "," with "&7,&3" in {_list}
2021-06-28 14:42:26 +02:00
replace all "%{party.creator}%" with "&l%{party.creator}%&r&3" in {_list}
send "Dans la partie : &3%{_list}%&7."
2021-06-28 13:55:10 +02:00
else:
send {@pasDePartie}
2021-06-28 13:37:39 +02:00
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"