diff --git a/0functions.sk b/0functions.sk index ffed04f..75430c2 100644 --- a/0functions.sk +++ b/0functions.sk @@ -1,9 +1,12 @@ -# named with a 0 at the begining to be sure he is load first +# named with a 0 at the begining to be sure he is loaded first +# the goal of this file is to load all the function who are used +# by a lot of my other files on load: ScriptList("add", script) on unload: ScriptList("remove", script) +# avoids having to type the same message several times (e.g. the error message) function option(option: text) :: text: # options if {_option} is "serverName": set {_resultat} to "Serveur d'Anri" @@ -11,18 +14,23 @@ function option(option: text) :: text: # options set {_resultat} to "&4Tu n'as pas la permission d'utiliser cette commande." return {_resultat} -function sendToOperators(player: player, message: text): # envoie message aux opérateurs (exclu le player s'il est OP aussi) +# sends message to operators (excludes the player if he's OP too) +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 +# allows to add or remove a file to the list of scripts files +# all files add their names to the list when they are loaded +# and remove them when they are unloaded function ScriptList(addRemove: text, list: text): if {_addRemove} is "add": add {_list} to {scripts::*} if {_addRemove} is "remove": remove {_list} from {scripts::*} +# returns the name taking into account his possible nickname function userOrNick(player: player) :: text: set {_uuid} to uuid of {_player} if {nick.%{_uuid}%} is set: @@ -31,15 +39,13 @@ function userOrNick(player: player) :: text: set {_res} to "%{_player}%" return {_res} +# returns an "s" if arg "number" is higher than 1 function pluriel(int: number) :: text: set {_pluriel} to "" set {_pluriel} to "s" if {_int} > 1 return {_pluriel} -function annonceParty(message: text): - loop {party.list::*}: - send {_message} to loop-value - +# reset the thimble game function resetThimble(player: player): set {_uuid} to uuid of {_player} delete {thimble.dead.%{_uuid}%} diff --git a/chat.sk b/chat.sk index eac5cce..d6dda6d 100644 --- a/chat.sk +++ b/chat.sk @@ -3,12 +3,14 @@ on load: on unload: ScriptList("remove", script) -on chat: # chat +# custom chat +on chat: cancel event set {_player} to userOrNick(player) broadcast "&8[%gamemode of player%&8]&r %{_player}%&r &8➡&r %colored message%" in all worlds -command nickname [] []: # changement de pseudo +# adding nickname option to all users +command nickname [] []: executable by: players aliases: nick description: Change ton nom ou celui d'un autre joueur. (max 15 charactères) @@ -42,7 +44,8 @@ command nickname [] []: # changement de pseudo set {nick.%{_playerUUID}%} to colored arg-2 send "&6Ton surnom est désormais &r%{nick.%{_playerUUID}%}%&6. (changé par %{_playerNAME}%&6)" to {_player} -command msg : # DM +# adding better DM option +command msg : executable by: players aliases: whisper, w, tell, t description: Envoie un message privé à un joueur. @@ -52,7 +55,9 @@ command msg : # DM set {dmReply.%uuid of player%} to arg-1 set {dmReply.%uuid of arg-1%} to player -command reponse : # réponse à un DM +# add the ability to reply to a message without +# having to specify the receiver +command reponse : executable by: players aliases: rep, r description: Envoie un réponse à un joueur. diff --git a/deacoudre.sk b/deacoudre.sk index 7160a1b..cd51ab2 100644 --- a/deacoudre.sk +++ b/deacoudre.sk @@ -1,7 +1,7 @@ options: X1: 103.5 Z1: -312.5 - Yeau: 57.5 + Yeau: 57.5 # water layer X2: 99.5 Z2: -304.5 @@ -10,7 +10,13 @@ on load: on unload: ScriptList("remove", script) -command deacoudre []: # lancement de la partie +# allows you to send a message to a whole party +function annonceParty(message: text): + loop {party.list::*}: + send {_message} to loop-value + +# starting a thimble game for a party +command deacoudre []: executable by: players description: Lance une partie de dé à coudre. trigger: @@ -47,6 +53,7 @@ command deacoudre []: # lancement de la partie else: send "&4Tu n'es pas dans une partie." +# returns the difference between the xyz-location of a block and a given number function getDifference(arg: text, block: block, comparative: number) :: number: if {_arg} is "x": set {_res} to difference between X-location of {_block} and {_comparative} @@ -56,7 +63,8 @@ function getDifference(arg: text, block: block, comparative: number) :: number: set {_res} to difference between Z-location of {_block} and {_comparative} return {_res} -every 0.5 second in "world": # pose du bloc et téléporatation +# placing block and teleportation +every 0.5 second in "world": if {thimble} is not true: stop loop {party.list::*}: @@ -76,7 +84,7 @@ every 0.5 second in "world": # pose du bloc et téléporatation continue if {_zLocationBlock1} and {_zLocationBlock2} >= abs({@Z1} - {@Z2}): continue - + # vérification si c'est un jump qui est dur à faire (entre 4 blocs pleins) set {_niceJump} to true set {_blockX} to X-location of block at loop-value @@ -100,12 +108,13 @@ every 0.5 second in "world": # pose du bloc et téléporatation annonceParty("&a&l%{_player}%&r&e a réalisé un dé à coudre !") else: delete {thimble.dead.%uuid of loop-value%} - + # téléportation et feed/heal teleport loop-value to {thimble.location} feed loop-value heal loop-value +# triggered if player die during a thimble game on death: if {thimble} is true: if {party.player.%uuid of player%} is set: diff --git a/homes.sk b/homes.sk index 142abaa..9542e39 100644 --- a/homes.sk +++ b/homes.sk @@ -3,7 +3,9 @@ on load: on unload: ScriptList("remove", script) -command sethome []: # défni un home +# set a home +# the default home is "maison" +command sethome []: executable by: players description: Défini un point de téléportation. trigger: @@ -23,7 +25,8 @@ command sethome []: # défni un home 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 []: # supprime un home +# delete a home +command delhome []: executable by: players description: Supprime un point de téléportation. trigger: @@ -39,7 +42,8 @@ command delhome []: # supprime un home send "&4Cette maison n'existe pas." make player execute command "listhome" -command home []: # téléportation vers home +# teleportation to a home +command home []: executable by: players description: Te téléportes vers un point de téléportation. trigger: @@ -54,13 +58,15 @@ command home []: # téléportation vers home send "&4Le home ""&c%{_name}%"" &4n'existe pas." make player execute command "listhome" -on tab complete for "home" and "delhome": # autocompletion des homes +# autocompletion des homes +on tab complete for "home" and "delhome": 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 +# list of homes +command listhome: executable by: players description: Liste des tes points de téléportations. trigger: diff --git a/inventories.sk b/inventories.sk index d477c0c..2ab0b45 100644 --- a/inventories.sk +++ b/inventories.sk @@ -1,5 +1,5 @@ options: - tailleInventaire: 41 # 36 d'inventaire + 4 d'équipement + 1 seconde main + tailleInventaire: 41 # 36 inventory + 4 equipment + 1 second hand messagePreChangement: "&7Changement d'inventaire..." messagePostChargement: "&7&l%{_n1}%&7 objet%{_pluriel1}%&7 unique%{_pluriel1}%&7 sauvegardé%{_pluriel1}%&7 et &l%{_n2}%&7 objet%{_pluriel2}%&7 unique%{_pluriel2}%&7 chargé%{_pluriel2}%&7." @@ -8,6 +8,8 @@ on load: on unload: ScriptList("remove", script) +# allows to save the inventory of a player in a specific gamemode +# in the database and to return the number of saved items function inventaire(mode: text, player: player, gamemode: text) :: number: set {_uuid} to uuid of {_player} set {_count} and {_nombreItems} to 0 @@ -26,6 +28,7 @@ function inventaire(mode: text, player: player, gamemode: text) :: number: add 1 to {_count} return {_nombreItems} +# triggered when switching from/to survival gamemode on gamemode change: if old gamemode of player is survival: set {_n1} to inventaire("sauvegarde", player, "survival") diff --git a/main.sk b/main.sk index cdedb10..6fa10da 100644 --- a/main.sk +++ b/main.sk @@ -3,7 +3,8 @@ on load: on unload: ScriptList("remove", script) -command skr []: # reload skript +# macro for easy reload of scripts +command skr []: executable by: players, console description: Reload de skripts. trigger: @@ -12,16 +13,18 @@ command skr []: # reload skript else if arg-1 isn't set: execute player command "sk reload scripts" -on tab complete for "skr": # autocompletion des homes +# autocompletion for scripts +on tab complete for "skr": set tab completions for position 1 to the first element of {scripts::*} loop {scripts::*}: add loop-value to tab completions -command broadcast []: # annonce +# broadcast limited by a cooldown +command broadcast []: executable by: players, console aliases: bc description: Fais une annonce à tout le monde. (30s de cooldown) - cooldown: 30 seconds + cooldown: 30 seconds cooldown message: &4Tu dois attendre &l%remaining time% &4pour refaire cette commande ! trigger: if player is op: @@ -34,7 +37,8 @@ command broadcast []: # annonce cancel command cooldown send option("errorMessage") -command skull []: # récupère la tête d'un joueur +# retrieves a player's head +command skull []: executable by: players aliases: head, tete description: Te drop une tête d'un joueur. @@ -48,7 +52,8 @@ command skull []: # récupère la tête d'un joueur else: send option("errorMessage") -command clearchat: # supprime l'historique du tchat +# delete chat history +command clearchat: executable by: players, console aliases: cc description: Efface l'historique du chat dans ton monde. (1mn de cooldown) @@ -65,10 +70,12 @@ command clearchat: # supprime l'historique du tchat cancel command cooldown send option("errorMessage") -on weather change to rain or thunder: # soleil pour toujours +# remove the rain in the server +on weather change to rain or thunder: cancel event -command rename : # renomme l'item dans la main du joueur +# renames the item in the player's hand +command rename : executable by: players description: Renomme l'item que tu as dans ta main. trigger: @@ -83,14 +90,16 @@ command rename : # renomme l'item dans la main du joueur else: send option("errorMessage") -command afk: # annonce d'afk +# afk announcement +command afk: executable by: players description: Annonce que tu vas afk. trigger: set {_player} to userOrNick(player) broadcast "&a%{_player}%&c est désormais afk !" in all worlds -command gmc []: # met un joueur en créatif +# puts a player in creative +command gmc []: executable by: players description: Change le mode de jeu d'un joueur en créatif. trigger: @@ -107,7 +116,8 @@ command gmc []: # met un joueur en créatif else: send option("errorMessage") -command gms []: # met un joueur en spectateur +# puts a player as a spectator +command gms []: executable by: players description: Change ton mode de jeu d'un joueur en spectateur trigger: @@ -124,7 +134,8 @@ command gms []: # met un joueur en spectateur else: send option("errorMessage") -command top: # téléporte un joueur tout en haut +# teleports a player to the highest point with a block under his feet +command top: executable by: players description: Te téléporte sur le bloc le plus haut. trigger: @@ -134,7 +145,9 @@ command top: # téléporte un joueur tout en haut else: send option("errorMessage") -command killall: # tue toutes les entités sauf exeptions +# kills all entities except exceptions (player, armor bearer, arrow, +# picture, frame, boat, villager and entity with a name) +command killall: executable by: players description: Tue toutes les entités du monde sauf joueur, porte-armure, flèche, tableau, cadre, bateau, villageois et entité avec un nom. trigger: @@ -166,7 +179,8 @@ command killall: # tue toutes les entités sauf exeptions else: send option("errorMessage") -command feed []: # remplie barre de nourriture d'un joueur +# filled food bar of a player +command feed []: executable by: players description: Remplie la barre de nourriture d'un joueur. trigger: @@ -184,21 +198,25 @@ command feed []: # remplie barre de nourriture d'un joueur else: send option("errorMessage") -on first join: # premiere fois que le joueur rejoint le serveur +# send message when player first join the server +on first join: set join message to "&aC'est la première fois que l'on te vois &r%player%, &abienvenue !" -on join: # joueur rejoint le serveur +# message when joining server and change his motd if he not disabled the functionality +on join: set {_player} to userOrNick(player) set join message to "%{_player}% &aa rejoint le serveur !" if {playerIP.%ip of player%} is not false: set {playerIP.%ip of player%} to player +# message when leaving the serveur and removing his possible correspondent on quit: set {_player} to userOrNick(player) set quit message to "%{_player}% &ca quitté le serveur !" # joueur quitte le serveur delete {dmReply.%uuid of player%} # suppression de la réponse -command ip []: # information sur ip stocké +# information on stored ip and ability to disable the functionality +command ip []: executable by: players description: Information concernant ton IP et ce que collecte le serveur. trigger: @@ -221,7 +239,8 @@ command ip []: # information sur ip stocké set {_inDB} to "non" if {playerIP.%ip of player%} is false send "&3Ton IP : &c%ip of player%&3 | Compte lié à l'IP : &c%{_inDB}%&3." -on server list ping: # motd +# (sometimes custom) motd +on server list ping: if {playerIP.%ip%} is set: if {playerIP.%ip%} is not false: set {_motd} to "&e&k||| &cSalut &a%{playerIP.%ip%}%&c, reconnecte-toi ! &e&k|||" @@ -233,6 +252,8 @@ on server list ping: # motd if max players count > {_playerCount}: set max players count to (number of all players + 1) +# show the nearest front block if functionality is enabled +# custom tab every second: loop all players: # affiche le block proche de toi @@ -240,7 +261,7 @@ every second: loop all blocks in radius 3 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%" - + # tab set {_serverName} to option("serverName") set {_numberOfConnectedPlayers} to number of all players @@ -249,7 +270,8 @@ every second: set {_player} to userOrNick(loop-player) set tab list name of loop-player to {_player} -command quelbloc: # commande pour activer ou désactiver l'affiche du bloc proche de toi +# command to activate or deactivate the display of the block near you +command quelbloc: executable by: players description: T'affiches le bloc en face de toi. (switch off/on) trigger: @@ -260,7 +282,8 @@ command quelbloc: # commande pour activer ou désactiver l'affiche du bloc proch set {blockNear.%uuid of player%} to true send "&aTu verras désormais le nom du bloc proche de toi." -command casque: # met l'objet dans la main du joueur sur sa tête +# places the item in the player's hand on his head +command casque: executable by: players aliases: hat description: Équipe l'objet dans ta main principale sur ta tête. @@ -282,7 +305,8 @@ command casque: # met l'objet dans la main du joueur sur sa tête else: send option("errorMessage") -command clear []: # clear l'inventaire du joueur sauf équipement +# clear the player's inventory except equipment +command clear []: executable by: players description: Clear l'inventaire d'un joueur mais pas l'équipement. trigger: @@ -312,7 +336,8 @@ command clear []: # clear l'inventaire du joueur sauf équipement else: send option("errorMessage") -command clearall []: # clear tout l'inventaire du joueur +# clear all player inventory including equipment +command clearall []: executable by: players aliases: fullclear description: Clear tout l'inventaire d'un joueur. @@ -335,7 +360,8 @@ command clearall []: # clear tout l'inventaire du joueur else: send option("errorMessage") -command couleur: # info sur les codes couleurs dans minecrafrt +# info on color coding in minecraft +command couleur: executable by: players aliases: couleurs, codecouleur, codecouleurs description: Informations sur le code des couleurs. diff --git a/party.sk b/party.sk index f805fe3..ef7ae98 100644 --- a/party.sk +++ b/party.sk @@ -6,12 +6,13 @@ on load: on unload: ScriptList("remove", script) -command party [] []: # commande party +# commande party +command 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 arg-2 is "join": # join the party if {party} is set: if {party.player.%uuid of player%} is set: send "&cTu es déjà dans la partie." @@ -26,7 +27,7 @@ command party [] []: # commande party else: send {@pasDePartie} stop - if arg-2 is "leave": + if arg-2 is "leave": # leave the party if {party} is set: if player is {party.creator}: execute player command "party delete" @@ -43,7 +44,7 @@ command party [] []: # commande party else: send "&4Tu n'es pas dans la partie." stop - if arg-2 is "create": + if arg-2 is "create": # create a new party if player is op: if {party} is set: set {_player} to userOrNick({party.creator}) @@ -57,7 +58,7 @@ command party [] []: # commande party stop else: send option("errorMessage") - if arg-2 is "delete": + if arg-2 is "delete": # delete an owned party if player is {party.creator}: if {party} is set: if {thimble} is true: @@ -74,14 +75,14 @@ command party [] []: # commande party else: send option("errorMessage") stop - if arg-1 is set: + if arg-1 is set: # invite a player to a party if {party} is set: send "&aTu as invité &l%arg-1%&r&a." set {_player} to userOrNick(player) send formatted "&aVeux tu rejoindre la partie aux côtés de &9%{_player}%&a ?" to arg-1 else: send {@pasDePartie} - else: + else: # info about the party if {party} is set: set {_list} to "%{party.list::*}%" replace all "and" with "&7et&3" in {_list} @@ -91,6 +92,7 @@ command party [] []: # commande party else: send {@pasDePartie} +# triggered when leaving the server on quit: if {party.player.%uuid of player%} is set: if player is {party.creator}: