Witam.
Na wstępie dodam, że to mój obecnie pierwszy skrypt w tym języku i mógłbym go uprościć wykorzystując m.in funkcje, ale ze względu na to, że chcę uczyć programowania moje dzieciaki (8 i 5lat), to w takiej formie to zostawię...
Działanie:
- gamemode creative, gamemode c, gamemode 1
- gamemode creative player
- gm c, gm 1 #dopisze kod
- gma, gmc, gmsp, gms #dopisze kod
Pytanie moje co uprościć i jak dodać losowe komunikaty -patrz koniec skryptu.
options:
#lista parametrów dla polecenia gamemode
surv: "survival","s" or "0"
creat: "creative", "c" or "1"
adve: "adventure","a" or "2"
spct: "spectator","sp" or "3"
command /gm [<text>] [<player>]:
aliases: gamemode
trigger:
if "%player's world%" is not "island_ocean": #osland_ocean, nazwa świata wygenerowana przez plugin MultiverceCore
if arg 1 is not set:
send "Użyj: gamemode <tryb gry> <nazwa gracza>" to player
stop
if arg 1 is {@surv}:
if arg 2 isn't set:
set player's gamemode to survival
send "&cGracz: &6%player% aktywował tryb: &bPrzetrwania" to player
else:
#Zmiana trybu przez gracza bo dzieciakom wiecznie coś nie pasuje...
execute console command "/gamemode survival %player%"
send "&cGracz: &6%arg 2%! Zmieniono Twój tryb na: &bPrzetrwanie"
if arg 1 is {@creat}:
if arg 2 isn't set:
set player's gamemode to creative
send "&cGracz: &6%player% aktywował tryb: &bKreatywny" to player
else:
execute console command "/gamemode creative %player%"
send "&cGracz: &6%arg 2%! Zmieniono Twój tryb na: &bKreatywny"
if arg 1 is {@adve}:
if arg 2 isn't set:
set player's gamemode to adventure
send "&cGracz: &6%player% aktywował tryb: &bPrzygoda" to player
else:
execute console command "/gamemode adve %player%"
send "&cGracz: &6%arg 2%! Zmieniono Twój tryb na: &bPrzygoda"
if arg 1 is {@spct}:
if arg 2 isn't set:
set player's gamemode to spectator
send "&cGracz: &6%player% aktywował tryb: &bWidza" to player
else:
execute console command "/gamemode spectator %player%"
send "&cGracz: &6%arg 2%! Zmieniono Twój tryb na: &bWidz"
else:
#Ze względu na to, że plugin: Multiverse-Core sam zmieni tryb gry, ponizszy kod można usunąc!!!
if arg 1 is not set:
send "Użyj: gamemode <tryb gry> <nazwa gracza>" to player
stop
if arg 1 is {@surv}:
if arg 2 isn't set:
set player's gamemode to survival
send "&cGracz: &6%player% aktywował tryb: &bPrzetrwania" to player
else:
execute console command "/gamemode survival %player%"
send "&cGracz: &6%arg 2%! Zmieniono Twój tryb na: &bPrzetrwanie
#Kod odpowiedzialny za komunikaty: śmieszne, podpowiedzi jak grac itd.
if arg 1 is not {@surv}:
send "&6%player% nie oszukuj! Chwyć się łopaty i buduj schron. ZOMbie idą!!!"
stop