using function for name in chat
This commit is contained in:
parent
96db6484bd
commit
f6deddbb34
3 changed files with 37 additions and 26 deletions
|
@ -22,3 +22,11 @@ function ScriptList(addRemove: text, list: text):
|
|||
add {_list} to {scripts::*}
|
||||
if {_addRemove} is "remove":
|
||||
remove {_list} from {scripts::*}
|
||||
|
||||
function userOrNick(player: player) :: text:
|
||||
set {_uuid} to uuid of {_player}
|
||||
if {nick.%{_uuid}%} is set:
|
||||
set {_res} to {nick.%{_uuid}%}
|
||||
else:
|
||||
set {_res} to name of {_player}
|
||||
return {_res}
|
||||
|
|
19
chat.sk
19
chat.sk
|
@ -5,24 +5,29 @@ on unload:
|
|||
|
||||
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
|
||||
set {_player} to userOrNick(player)
|
||||
broadcast "<%{_player}%&r> %colored message%" in world of player
|
||||
|
||||
command nickname [<player>] <text>: # changement de pseudo
|
||||
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 arg-1 is set:
|
||||
set {_playerUUID} to uuid of arg-1
|
||||
set {_player} to arg-1
|
||||
if arg-2 is not set:
|
||||
if {nick.%{_playerUUID}%} is set:
|
||||
set {_deb} to "Le surnom de %{_playerNAME}%"
|
||||
if player is {_player}:
|
||||
set {_deb} to "Votre surnom"
|
||||
send "%{_deb}% est : %{nick.%{_playerUUID}%}%"
|
||||
else:
|
||||
send "Tu n'as pas de surnom. Nom d'affichage : %{_playerNAME}%"
|
||||
stop
|
||||
if player is {_player}:
|
||||
set {_playerNAME} to "vous"
|
||||
else:
|
||||
|
@ -36,8 +41,6 @@ command nickname [<player>] <text>: # changement de pseudo
|
|||
else:
|
||||
set {nick.%{_playerUUID}%} to colored arg-2
|
||||
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
|
||||
|
|
2
main.sk
2
main.sk
|
@ -78,7 +78,7 @@ command rename <text>: # renomme l'item dans la main du joueur
|
|||
set {_name} to colored arg-1
|
||||
replace all "&" with "§" in {_name}
|
||||
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 name of the player's tool to "§r%{_name}%"
|
||||
else:
|
||||
send option("errorMessage")
|
||||
|
||||
|
|
Loading…
Reference in a new issue