51 lines
1.8 KiB
Text
51 lines
1.8 KiB
Text
# 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"
|
|
if {_option} is "errorMessage":
|
|
set {_resultat} to "&4Tu n'as pas la permission d'utiliser cette commande."
|
|
return {_resultat}
|
|
|
|
# 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:
|
|
set {_res} to "%{nick.%{_uuid}%}%&7 (%{_player}%)"
|
|
else:
|
|
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}
|
|
|
|
# reset the thimble game
|
|
function resetThimble(player: player):
|
|
set {_uuid} to uuid of {_player}
|
|
delete {thimble.dead.%{_uuid}%}
|