séparation des commandes dans plusieurs fichiers

This commit is contained in:
Mylloon 2021-06-28 11:56:53 +02:00
parent 099cf1aa3f
commit a51623a78b
5 changed files with 197 additions and 196 deletions

53
chat.sk Normal file
View file

@ -0,0 +1,53 @@
on chat: # chat
cancel event
if {nick.%uuid of player%} is set:
set {_player} to {nick.%uuid of player%}
else:
set {_player} to player's name
broadcast "<%{_player}%&r> %colored message%" in world of player
command nickname [<player>] <text>: # changement de pseudo
executable by: players
aliases: nick
description: Change ton nom ou celui d'un autre joueur. (max 15 charactères)
trigger:
if player is op:
set {_playerUUID} to uuid of player
set {_player} to player
set {_playerNAME} to player
if player-arg is set:
set {_playerUUID} to uuid of player-arg
set {_player} to player-arg
if player is {_player}:
set {_playerNAME} to "vous"
if text-arg is "off":
delete {nick.%{_playerUUID}%}
send "&6Tu n'as plus de surnom. (changé par %player%&6)" to {_player}
else:
if length of text-arg is greater than 15:
send "&4Ce surnom est trop long."
else:
set {nick.%{_playerUUID}%} to colored text-arg
send "&6Ton surnom est désormais &r%{nick.%{_playerUUID}%}%&6. (changé par %{_playerNAME}%&6)" to {_player}
else:
send option("errorMessage")
command msg <player> <text>: # DM
executable by: players
aliases: whisper, w, tell, t
description: Envoie un message privé à un joueur.
trigger:
send "&8[Moi -> %arg-1%&8]&7 %colored text-arg%" to player
send "&8[%player%&8 -> Moi] &b%colored text-arg%" to arg-1
set {dmReply.%uuid of player%} to arg-1
set {dmReply.%uuid of arg-1%} to player
command reponse <text>: # réponse à un DM
executable by: players
aliases: rep, r
description: Envoie un réponse à un joueur.
trigger:
if {dmReply.%uuid of player%} is set:
execute player command "msg %{dmReply.%uuid of player%}% %arg-1%"
else:
send "&4Tu n'as personne a qui répondre."

46
deacoudre.sk Normal file
View file

@ -0,0 +1,46 @@
command deacoudre: # dé à coudre
executable by: players
description: Lance une partie de dé à coudre.
trigger:
if player is op:
if {thimble} is true:
delete {thimble}
teleport player to location at 101.5, 83, -314 in world "world"
execute player command "fill 103 57 -313 99 57 -305 water"
broadcast "&cPartie de dé à coudre terminée."
set gamemode of all players to creative
else:
set {thimble} to true
broadcast "&aDémarrage de la partie de dé à coudre !"
loop all players:
teleport loop-player to location at 101.5, 83, -314 in world "world"
set gamemode of loop-player to adventure
feed loop-player
heal loop-player
cure loop-player
else:
send option("errorMessage")
every 0.5 second in "world": # dé à coudre
if {thimble} is not true:
stop
loop all players:
set action bar of loop-player to "&dEn partie de &lDé à coudre&r&d."
if block at loop-player is water:
set {_xLocationBlock1} to difference between X-location of block at loop-player and 103.5
set {_xLocationBlock2} to difference between X-location of block at loop-player and 99.5
set {_zLocationBlock1} to difference between Z-location of block at loop-player and -312.5
set {_zLocationBlock2} to difference between Z-location of block at loop-player and -304.5
set {_yLocationBlock} to difference between Y-location of block at loop-player and 57.5
if {_xLocationBlock1} and {_xLocationBlock2} and {_zLocationBlock1} and {_zLocationBlock2} <= 0:
continue
if {_xLocationBlock1} and {_xLocationBlock2} >= 4:
continue
if {_yLocationBlock} != 0:
continue
if {_zLocationBlock1} and {_zLocationBlock2} >= 8:
continue
set block at loop-player to wool
teleport loop-player to location at 101.5, 83, -314 in world "world"
feed loop-player
heal loop-player

12
functions.sk Normal file
View file

@ -0,0 +1,12 @@
function sendToOperators(player: player, message: text):
loop all players:
if loop-player is a op:
if loop-player is not {_player}:
send {_message} to loop-player
function option(option: text) :: text:
if {_option} is "serverName":
set {_resultat} to "Serveur d'Anri"
if {_option} is "errorMessage":
set {_resultat} to "&4Tu n'as pas la permission d'utiliser cette commande."
return {_resultat}

68
homes.sk Normal file
View file

@ -0,0 +1,68 @@
command sethome [<text>]: # défni un home
executable by: players
description: Défini un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
if arg-1 isn't set:
set {_name} to ""
else:
set {_name} to "%{_name}% "
send "&4Cette maison existe déjà, &8/delhome %{_name}%&4pour la supprimer."
else:
remove {_name} from {home.%player's uuid%::*}
add {_name} to {home.%player's uuid%::*}
set {home.%player's uuid%.%{_name}%} to player's location
send "Ta maison ""&a%{_name}%&r"" est maintenant définie aux coordonnées &7%player's location%&r !"
command delhome [<text>]: # supprime un home
executable by: players
description: Supprime un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
remove {_name} from {home.%player's uuid%::*}
clear {home.%player's uuid%.%{_name}%}
send "Maison ""&a%{_name}%&r"" supprimée."
else:
send "&4Cette maison n'existe pas."
make player execute command "listhome"
command home [<text>]: # téléportation vers home
executable by: players
description: Te téléportes vers un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
send "&aTéléportation vers &9%{_name}% &a!"
teleport player to {home.%player's uuid%.%{_name}%}
else:
send "&4Le home ""&c%{_name}%"" &4n'existe pas."
make player execute command "listhome"
on tab complete for "home" and "delhome": # autocompletion des homes
if {home.%player's uuid%::*} is set:
set tab completions for position 1 to the first element of {home.%player's uuid%::*}
loop {home.%player's uuid%::*}:
add loop-value to tab completions
command listhome: # liste tes homes
executable by: players
description: Liste des tes points de téléportations.
trigger:
if {home.%player's uuid%::*} isn't set:
send "&4Vous n'avez pas de maisons."
else:
set {_maisons} to "%{home.%player's uuid%::*}%"
replace all "and" with "&7et&3" in {_maisons}
replace all "," with "&7,&3" in {_maisons}
send "&aListe des tes maisons : &3%{_maisons}%&7."

214
main.sk
View file

@ -1,13 +1,3 @@
options:
serverName: "Serveur d'Anri"
errorMessage: "&4Tu n'as pas la permission d'utiliser cette commande."
function sendToOperators(player: player, message: text):
loop all players:
if loop-player is a op:
if loop-player is not {_player}:
send {_message} to loop-player
command skr [<text>]: # recharge ce skript command skr [<text>]: # recharge ce skript
executable by: players, console executable by: players, console
description: Reload de skripts. description: Reload de skripts.
@ -15,7 +5,8 @@ command skr [<text>]: # recharge ce skript
if arg-1 is set: if arg-1 is set:
execute player command "sk reload %arg-1%" execute player command "sk reload %arg-1%"
else if arg-1 isn't set: else if arg-1 isn't set:
execute player command "sk reload main" # sk reload all pour tout reload execute player command "sk reload functions" # pour être sûr que functions est bien chargé en premier
execute player command "sk reload scripts"
command broadcast [<text>]: # annonce command broadcast [<text>]: # annonce
executable by: players, console executable by: players, console
@ -32,7 +23,7 @@ command broadcast [<text>]: # annonce
send "&4Vous n'avez pas spécifier de texte." send "&4Vous n'avez pas spécifier de texte."
else: else:
cancel command cooldown cancel command cooldown
send {@errorMessage} send option("errorMessage")
command skull [<offline player>]: # récupère la tête d'un joueur command skull [<offline player>]: # récupère la tête d'un joueur
executable by: players executable by: players
@ -46,7 +37,7 @@ command skull [<offline player>]: # récupère la tête d'un joueur
give {_player}'s skull to player give {_player}'s skull to player
send "&7Vous avez reçu la tête de : &6%{_player}%" send "&7Vous avez reçu la tête de : &6%{_player}%"
else: else:
send {@errorMessage} send option("errorMessage")
command clearchat: # supprime l'historique du tchat command clearchat: # supprime l'historique du tchat
executable by: players, console executable by: players, console
@ -62,7 +53,7 @@ command clearchat: # supprime l'historique du tchat
broadcast " " in world of player broadcast " " in world of player
else: else:
cancel command cooldown cancel command cooldown
send {@errorMessage} send option("errorMessage")
command forceexecute <player> <text>: # force un joueur à éxécuter une commande command forceexecute <player> <text>: # force un joueur à éxécuter une commande
executable by: players, console executable by: players, console
@ -72,80 +63,11 @@ command forceexecute <player> <text>: # force un joueur à éxécuter une comman
if player is op: if player is op:
execute arg-1 command arg-2 execute arg-1 command arg-2
else: else:
send {@errorMessage} send option("errorMessage")
on weather change to rain or thunder: # soleil pour toujours on weather change to rain or thunder: # soleil pour toujours
cancel event cancel event
command sethome [<text>]: # défni un home
executable by: players
description: Défini un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
if arg-1 isn't set:
set {_name} to ""
else:
set {_name} to "%{_name}% "
send "&4Cette maison existe déjà, &8/delhome %{_name}%&4pour la supprimer."
else:
remove {_name} from {home.%player's uuid%::*}
add {_name} to {home.%player's uuid%::*}
set {home.%player's uuid%.%{_name}%} to player's location
send "Ta maison ""&a%{_name}%&r"" est maintenant définie aux coordonnées &7%player's location%&r !"
command delhome [<text>]: # supprime un home
executable by: players
description: Supprime un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
remove {_name} from {home.%player's uuid%::*}
clear {home.%player's uuid%.%{_name}%}
send "Maison ""&a%{_name}%&r"" supprimée."
else:
send "&4Cette maison n'existe pas."
make player execute command "listhome"
command home [<text>]: # téléportation vers home
executable by: players
description: Te téléportes vers un point de téléportation.
trigger:
if arg-1 isn't set:
set {_name} to "maison"
else:
set {_name} to arg-1
if {home.%player's uuid%.%{_name}%} is set:
send "&aTéléportation vers &9%{_name}% &a!"
teleport player to {home.%player's uuid%.%{_name}%}
else:
send "&4Le home ""&c%{_name}%"" &4n'existe pas."
make player execute command "listhome"
on tab complete for "home" and "delhome": # autocompletion des homes
if {home.%player's uuid%::*} is set:
set tab completions for position 1 to the first element of {home.%player's uuid%::*}
loop {home.%player's uuid%::*}:
add loop-value to tab completions
command listhome: # liste tes homes
executable by: players
description: Liste des tes points de téléportations.
trigger:
if {home.%player's uuid%::*} isn't set:
send "&4Vous n'avez pas de maisons."
else:
set {_maisons} to "%{home.%player's uuid%::*}%"
replace all "and" with "&7et&3" in {_maisons}
replace all "," with "&7,&3" in {_maisons}
send "&aListe des tes maisons : &3%{_maisons}%&7."
command rename <text>: # renomme un item command rename <text>: # renomme un item
executable by: players executable by: players
description: Renomme l'item que tu as dans ta main. description: Renomme l'item que tu as dans ta main.
@ -159,7 +81,7 @@ command rename <text>: # renomme un item
send "&eL'item &r%player's tool%&e est renommé en ""&r%{_name}%&e""." send "&eL'item &r%player's tool%&e est renommé en ""&r%{_name}%&e""."
set the name of the player's tool to "§r%{_name}%" set the name of the player's tool to "§r%{_name}%"
else: else:
send {@errorMessage} send option("errorMessage")
command afk: # annonce d'afk command afk: # annonce d'afk
executable by: players executable by: players
@ -182,7 +104,7 @@ command gmc [<player>]: # met un joueur en créatif
send "%player% a changé ton mode de jeu en créatif." to {_player} send "%player% a changé ton mode de jeu en créatif." to {_player}
sendToOperators({_player}, "&7&o%player%&7&o a changé le mode de jeu de %{_player}%&7&o en créatif.") sendToOperators({_player}, "&7&o%player%&7&o a changé le mode de jeu de %{_player}%&7&o en créatif.")
else: else:
send {@errorMessage} send option("errorMessage")
command gms [<player>]: # met un joueur en spectateur command gms [<player>]: # met un joueur en spectateur
executable by: players executable by: players
@ -199,7 +121,7 @@ command gms [<player>]: # met un joueur en spectateur
send "%player% a changé ton mode de jeu en spectateur." to {_player} send "%player% a changé ton mode de jeu en spectateur." to {_player}
sendToOperators({_player}, "&7&o%player%&7&o a changé le mode de jeu de %{_player}%&7&o en spectateur.") sendToOperators({_player}, "&7&o%player%&7&o a changé le mode de jeu de %{_player}%&7&o en spectateur.")
else: else:
send {@errorMessage} send option("errorMessage")
command top: # téléporte un joueur tout en haut command top: # téléporte un joueur tout en haut
executable by: players executable by: players
@ -208,7 +130,7 @@ command top: # téléporte un joueur tout en haut
if player is op: if player is op:
teleport player to location of highest block at location teleport player to location of highest block at location
else: else:
send {@errorMessage} send option("errorMessage")
on first join: # premiere fois que le joueur rejoins le serveur on first join: # premiere fois que le joueur rejoins le serveur
set join message to "&aC'est la première fois que l'on te vois &r%player%, &abienvenue !" set join message to "&aC'est la première fois que l'on te vois &r%player%, &abienvenue !"
@ -250,7 +172,7 @@ command killall: # tue toutes les entités
send "Tu as tué %{_count}% entités." send "Tu as tué %{_count}% entités."
sendToOperators(player, "&7%player%&7 as tué %{_count}%&7 entités.") sendToOperators(player, "&7%player%&7 as tué %{_count}%&7 entités.")
else: else:
send {@errorMessage} send option("errorMessage")
command feed [<player>]: # remplie barre de nourriture command feed [<player>]: # remplie barre de nourriture
executable by: players executable by: players
@ -268,67 +190,13 @@ command feed [<player>]: # remplie barre de nourriture
feed {_player} feed {_player}
send "Tu as été nourris. (par %{_playerNAME}%)" to {_player} send "Tu as été nourris. (par %{_playerNAME}%)" to {_player}
else: else:
send {@errorMessage} send option("errorMessage")
on chat: # chat
cancel event
if {nick.%uuid of player%} is set:
set {_player} to {nick.%uuid of player%}
else:
set {_player} to player's name
broadcast "<%{_player}%&r> %colored message%" in world of player
command nickname [<player>] <text>: # changement de pseudo
executable by: players
aliases: nick
description: Change ton nom ou celui d'un autre joueur. (max 15 charactères)
trigger:
if player is op:
set {_playerUUID} to uuid of player
set {_player} to player
set {_playerNAME} to player
if player-arg is set:
set {_playerUUID} to uuid of player-arg
set {_player} to player-arg
if player is {_player}:
set {_playerNAME} to "vous"
if text-arg is "off":
delete {nick.%{_playerUUID}%}
send "&6Tu n'as plus de surnom. (changé par %player%&6)" to {_player}
else:
if length of text-arg is greater than 15:
send "&4Ce surnom est trop long."
else:
set {nick.%{_playerUUID}%} to colored text-arg
send "&6Ton surnom est désormais &r%{nick.%{_playerUUID}%}%&6. (changé par %{_playerNAME}%&6)" to {_player}
else:
send {@errorMessage}
command msg <player> <text>: # DM
executable by: players
aliases: whisper, w, tell, t
description: Envoie un message privé à un joueur.
trigger:
send "&8[Moi -> %arg-1%&8]&7 %colored text-arg%" to player
send "&8[%player%&8 -> Moi] &b%colored text-arg%" to arg-1
set {dmReply.%uuid of player%} to arg-1
set {dmReply.%uuid of arg-1%} to player
command reponse <text>: # réponse à un DM
executable by: players
aliases: rep, r
description: Envoie un réponse à un joueur.
trigger:
if {dmReply.%uuid of player%} is set:
execute player command "msg %{dmReply.%uuid of player%}% %arg-1%"
else:
send "&4Tu n'as personne a qui répondre."
on server list ping: # motd on server list ping: # motd
if {playerIP.%ip%} is set: if {playerIP.%ip%} is set:
set motd to "&e&k||| &cSalut &a%{playerIP.%ip%}%&c, reconnecte-toi ! &e&k|||" set motd to "&e&k||| &cSalut &a%{playerIP.%ip%}%&c, reconnecte-toi ! &e&k|||"
else: else:
set {_serverName} to {@serverName} set {_serverName} to option("serverName")
set motd to "&e&k||| &c%{_serverName}% &e&k|||" set motd to "&e&k||| &c%{_serverName}% &e&k|||"
set max players count to (number of all players + 1) set max players count to (number of all players + 1)
if max players count > {_playerCount}: if max players count > {_playerCount}:
@ -340,7 +208,7 @@ every 1 second in "world":
loop all blocks in radius 3 of loop-player: loop all blocks in radius 3 of loop-player:
if loop-block is target block of loop-player: if loop-block is target block of loop-player:
set action bar of loop-player to "&a%target block of loop-player%" set action bar of loop-player to "&a%target block of loop-player%"
set {_serverName} to {@serverName} set {_serverName} to option("serverName")
set tab header to "&a%{_serverName}%" and footer to "&e%number of all players% joueurs connectés\n&9%ping of loop-player% ms de latence" for loop-player set tab header to "&a%{_serverName}%" and footer to "&e%number of all players% joueurs connectés\n&9%ping of loop-player% ms de latence" for loop-player
command quelbloc: # commande pour activer ou désactiver l'affiche du bloc proche de toi command quelbloc: # commande pour activer ou désactiver l'affiche du bloc proche de toi
@ -354,53 +222,6 @@ command quelbloc: # commande pour activer ou désactiver l'affiche du bloc proch
set {blockNear.%uuid of player%} to true set {blockNear.%uuid of player%} to true
send "&aTu verras désormais le nom du bloc proche de toi." send "&aTu verras désormais le nom du bloc proche de toi."
command deacoudre: # dé à coudre
executable by: players
description: Lance une partie de dé à coudre.
trigger:
if player is op:
if {thimble} is true:
delete {thimble}
teleport player to location at 101.5, 83, -314 in world "world"
execute player command "fill 103 57 -313 99 57 -305 water"
broadcast "&cPartie de dé à coudre terminée."
set gamemode of all players to creative
else:
set {thimble} to true
broadcast "&aDémarrage de la partie de dé à coudre !"
loop all players:
teleport loop-player to location at 101.5, 83, -314 in world "world"
set gamemode of loop-player to adventure
feed loop-player
heal loop-player
cure loop-player
else:
send {@errorMessage}
every 0.5 second in "world": # dé à coudre
if {thimble} is not true:
stop
loop all players:
set action bar of loop-player to "&dEn partie de &lDé à coudre&r&d."
if block at loop-player is water:
set {_xLocationBlock1} to difference between X-location of block at loop-player and 103.5
set {_xLocationBlock2} to difference between X-location of block at loop-player and 99.5
set {_zLocationBlock1} to difference between Z-location of block at loop-player and -312.5
set {_zLocationBlock2} to difference between Z-location of block at loop-player and -304.5
set {_yLocationBlock} to difference between Y-location of block at loop-player and 57.5
if {_xLocationBlock1} and {_xLocationBlock2} and {_zLocationBlock1} and {_zLocationBlock2} <= 0:
continue
if {_xLocationBlock1} and {_xLocationBlock2} >= 4:
continue
if {_yLocationBlock} != 0:
continue
if {_zLocationBlock1} and {_zLocationBlock2} >= 8:
continue
set block at loop-player to wool
teleport loop-player to location at 101.5, 83, -314 in world "world"
feed loop-player
heal loop-player
command casque: command casque:
executable by: players executable by: players
aliases: hat aliases: hat
@ -421,7 +242,7 @@ command casque:
if helmet of player is not air: if helmet of player is not air:
send "&aItem équippé !" send "&aItem équippé !"
else: else:
send {@errorMessage} send option("errorMessage")
command clear [<player>]: command clear [<player>]:
executable by: players executable by: players
@ -449,10 +270,11 @@ command clear [<player>]:
else: else:
send "&aTu as clear ton inventaire." send "&aTu as clear ton inventaire."
else: else:
send {@errorMessage} send option("errorMessage")
command clearall [<player>]: command clearall [<player>]:
executable by: players executable by: players
aliases: fullclear
description: Clear tout l'inventaire d'un joueur. description: Clear tout l'inventaire d'un joueur.
trigger: trigger:
if player is op: if player is op:
@ -469,4 +291,4 @@ command clearall [<player>]:
else: else:
send "&aTu as clear ton inventaire." send "&aTu as clear ton inventaire."
else: else:
send {@errorMessage} send option("errorMessage")