#Skrypt na SkriptJam (2 miejsce) options: protection_time: 30 seconds #tutaj wpisz czas ochrony on first join: startProtection(player) function bTranslateTime(time: text) :: text: set {_english::*} to ("years" and "year", "months", "month", "days", "day", "hours", "hour", "minutes", "minute", "seconds", "second", "and") set {_polish::*} to ("lata" and "rok", "miesiace", "miesiac", "dni", "dzien", "godzin", "godzina", "minut", "minuta", "sekund", "sekunda", "i") loop {_english::*}: replace all loop-value with {_polish::%loop-index%} in {_time} return {_time} function startProtection(p: player): set {bProtection::%{_p}%} to now send subtitle "&fOtrzymałeś &eochronę startową &fna: &e%bTranslateTime(""{@protection_time}"")%&f." to {_p} for 5 seconds while isProtected({_p}) is true: set {_expireTime} to {@protection_time} remove (difference between {bProtection::%{_p}%} and now) from {_expireTime} set {_expireTime} to bTranslateTime("%{_expireTime}%") send action bar "&eOchrona startowa &fwygaśnie za: &e%{_expireTime}%" to {_p} wait 1 second function isProtected(p: player) :: boolean: if {bProtection::%{_p}%} is not set: return false else if difference between {bProtection::%{_p}%} and now >= {@protection_time}: send subtitle "Nastał koniec &eochrony&f!" to {_p} for 5 seconds send "&8[&6!&8] &fGraczowi &e%{_p}% &fskończyła się &eochrona startowa&f!" to all players delete {bProtection::%{_p}%} return false else: return true on damage of player: if {bProtection::%victim%} is not set: stop if attacker is not player: stop cancel event send subtitle "%victim% posiada &eochronę startową&f!" to attacker for 1 second function takeProtection(o: player, p: offlineplayer): close {_o}'s inventory delete {bProtection::%{_p}%} send "&8[&6!&8] &fGraczowi &e%{_p}% &fskończyła się &eochrona startowa&f!" to all players if {_p} is online: send subtitle "Administrator zabrał Ci &eochronę startową&f." to {_p} for 5 seconds stop command /ochronalist []: permission: ochronalist.cmd permission: &4&l> &cNie posiadasz odpowiedniej permisji. trigger: open virtual chest with 6 rows named "Lista graczy z ochroną." to player set {_slot} to 0 loop {bProtection::*}: add 1 to {_slot} set {_expireTime} to {@protection_time} remove (difference between {bProtection::%loop-index%} and now) from {_expireTime} set {_expireTime} to bTranslateTime("%{_expireTime}%") format gui slot ({_slot} -1) of player with ("%loop-index%" parsed as offlineplayer)'s skull named "&e%loop-index%" with lore "&fWygasa za: &e%{_expireTime}%" and "&eKliknij, aby zabrac ochrone!" to run function takeProtection(player, (loop-index parsed as offlineplayer)) on chat: if {bProtection::%player%} is set: set chat format to "&8[&6Ochrona&8] &7%player%&8: &e%message%" stop set chat format to "&7%player%&8: &e%message%"