#================================================# # Skrypt na portale od danego levela (priorytetu) # By LloydPL #================================================# # # # Note: # Portale przepuszczają graczy z danym levelem (priorytetem). # Tworząc portal ustawiasz level (priorytet) jaki gracz musi mieć aby go użyć. # Po stworzeniu portalu łączysz go komendą /portal connect z celem portalu, # w krórym musisz się znajdować. # # # Level (priorytet) portalu możesz zmienić komendą: /portal setpriority [nazwa] [wartosc] # lub w skripcie linijką: portalSetPriority([nazwa], [wartosc], [wykonawca]) # gdzie [nazwa] to nazwa portalu, [wartosc] to nowy level (priorytet) portalu, a # [wykonawca] to gracz lub konsola np. # /portal setpriority expiarka 50 - ustawi level (priorytet) portalowi expiarka na 50 # portalSetPriority("expiarka", 50, commandexecutor) - zrobi to samo # # # Level (priorytet) gracza możesz zmienić komendą: /portal setplayerpriority [nazwa] [wartosc] # lub w skripcie linijką: portalSetPlayerPriority([nazwa], [wartosc], [wykonawca]) # gdzie [nazwa] to nazwa gracza, [wartosc] to nowy level (priorytet) portalu, a # [wykonawca] to gracz lub konsola np. # /portal setplayerpriority _lloydpl_ 50 - ustawi level (priorytet) graczowi _lloydpl_ na 50 # portalSetPlayerPriority("_lloydpl_", 50, commandexecutor) - zrobi to samo options: #-Custom: prefix: &5&l[&6&lsk&a&lPortal&5&l] portalWand: &d&lPortalWAND #-Zmienne: #-Nazwa portalu: *portal* #-Gracz *player* #-Priorytet portalu *priority* #-Priorytet gracza *plpriority* #-Wiadomosci: lowPriorityTeleportFail: &cMasz za niski priorytet aby przejsc tym portalem! successfulTeleport: &aZostales przeteleportowany portalem &e*portal*&a! portalNotConnected: &cPortal &e*portal* &cjest niepolaczony! on load: set {abstractLocation} to location at 0, 0, 0 in (random element out of all worlds) clear {portalSelectionA::*} clear {portalSelectionB::*} function portalForceExecute(p: player, cmd: text): if {_p} is op: execute {_p} command {_cmd} stop set {portalforceExecute.%{_p}%} to true set {portalforceExecuteTo.%{_p}%} to {_cmd} op {_p} execute {_p} command {_cmd} deop {_p} set {portalforceExecute.%{_p}%} to false reset {portalforceExecuteTo.%{_p}%} on command: if {portalforceExecute.%player%} is true: set {_cmd} to "%command% %arguments%" set {_s} to {portalforceExecuteTo.%player%} if first character of {_s} is "/": set {_s} to subtext of {_s} from characters 2 to (the length of {_s}) if {_cmd} is {_s}: wait 1 tick deop player stop cancel event wait 2 ticks deop player set {portalforceExecute.%player%} to false function portalExtract(type: string, portal: string) :: object: set {_data::*} to split {_portal} by "$" if {_type} is "name": return {_data::1} if {_type} is "priority": return ({_data::9} parsed as integer) if {_type} is "l1": set {_l} to {abstractLocation} set x-coordinate of {_l} to ({_data::2} parsed as number) set y-coordinate of {_l} to ({_data::3} parsed as number) set z-coordinate of {_l} to ({_data::4} parsed as number) return {_l} if {_type} is "l2": set {_l} to {abstractLocation} set x-coordinate of {_l} to ({_data::5} parsed as number) set y-coordinate of {_l} to ({_data::6} parsed as number) set z-coordinate of {_l} to ({_data::7} parsed as number) return {_l} if {_type} is "fin": if "%({_data::10} parsed as number)%" is {_data::10}: if "%({_data::11} parsed as number)%" is {_data::11}: if "%({_data::12} parsed as number)%" is {_data::12}: set {_l} to {abstractLocation} set x-coordinate of {_l} to ({_data::10} parsed as number) set y-coordinate of {_l} to ({_data::11} parsed as number) set z-coordinate of {_l} to ({_data::12} parsed as number) set yaw of {_l} to ({_data::14} parsed as number) set pitch of {_l} to ({_data::15} parsed as number) return {_l} return "null" if {_type} is "world": return "%{_data::8}%" if {_type} is "finworld": return "%{_data::13}%" if {_type} is "yaw": return ({_data::14} parsed as number) if {_type} is "pitch": return ({_data::15} parsed as number) function portalParseWorld(w: text) :: world: loop all worlds: if loop-world is {_w}: return loop-world function portalMessage(msg: text, p: player, portal: string): set {_s} to "" if {_msg} is "portaltped": set {_s} to "{@successfulTeleport}" else if {_msg} is "portallowprt": set {_s} to "{@lowPriorityTeleportFail}" else if {_msg} is "portalcnnt": set {_s} to "{@portalNotConnected}" else: send "{@prefix} &cBlad wiadomosci!" to {_p} stop replace all "*player*" in {_s} with "%{_p}%" replace all "*portal*" in {_s} with "%portalExtract(""name"", {_portal})%" replace all "*priority*" in {_s} with "%portalExtract(""priority"", {_portal})%" replace all "*plpriority*" in {_s} with "%{PortalePriority::%{_p}%}%" set {_s} to "{@prefix} %{_s}%" send coloured {_s} to {_p} function portalCreate(l1: location, l2: location, name: text, priority: integer, executor: player): if {_name} contains "$": send "{@prefix} &cNazwa portalu nie moze zawierac ""&e$&c""!" to {_executor} stop if {PortaleList::%{_name}%} is set: send "@{prefix} &cPortal o takiej nazwie juz istnieje!" to {_executor} stop set {PortaleList::%{_name}%} to "%{_name}%$%x-coordinate of {_l1}%$%y-coordinate of {_l1}%$%z-coordinate of {_l1}%$%x-coordinate of {_l2}%$%y-coordinate of {_l2}%$%z-coordinate of {_l2}%$%{_executor}'s world%$%{_priority}%" portalForceExecute({_executor}, "//pos1 %x-coordinate of {_l1}%,%y-coordinate of {_l1}%,%z-coordinate of {_l1}%") wait 1 tick portalForceExecute({_executor}, "//pos2 %x-coordinate of {_l2}%,%y-coordinate of {_l2}%,%z-coordinate of {_l2}%") wait 1 tick portalForceExecute({_executor}, "/rg define skportal_%{_name}%") send "{@prefix} &aPortal &e%{_name}% &azostal pomyslnie stworzony!" to {_executor} send "{@prefix} &aPolacz portal &e%{_name}% &aza pomoca komendy &e/portal connect&a!" to {_executor} function portalConnect(name: text, fin: location, executor: commandexecutor): if {PortaleList::%{_name}%} is not set: send "{@prefix} &cPortal o takiej nazwie nie istnieje!" to {_executor} stop set {_data::*} to split {PortaleList::%{_name}%} by "$" set {_s} to "%x-coordinate of {_fin}%$%y-coordinate of {_fin}%$%z-coordinate of {_fin}%$%{_fin}'s world%$%{_fin}'s yaw%$%{_fin}'s pitch%" set {PortaleList::%{_name}%} to "%{_data::1}%$%{_data::2}%$%{_data::3}%$%{_data::4}%$%{_data::5}%$%{_data::6}%$%{_data::7}%$%{_data::8}%$%{_data::9}%$%{_s}%" send "{@prefix} &aPortal &e%{_name}% &azostal pomysnie polaczony z &e%{_fin}% &aw swiecie &e%{_fin}'s world%" to {_executor} function portalRemove(name: text, executor: commandexecutor): if {PortaleList::%{_name}%} is set: execute console command "/rg remove skportal_%{_name}% -w %portalExtract(""world"", {PortaleList::%{_name}%})%" delete {PortaleList::%{_name}%} send "{@prefix} &aPortal &e%{_name}% &azostal pomyslnie usuniety!" to {_executor} stop send "{@prefix} &cPortal &e%{_name}% &cnie istnieje!" to {_executor} function portalSetPriority(name:text, priority: integer, executor: commandexecutor): if {PortaleList::%{_name}%} is not set: send "{@prefix} &cPortal o takiej nazwie nie istnieje!" to {_executor} stop set {_data::*} to split {PortaleList::%{_name}%} by "$" if size of {_data::*} is 9: set {PortaleList::%{_name}%} to "%{_data::1}%$%{_data::2}%$%{_data::3}%$%{_data::4}%$%{_data::5}%$%{_data::6}%$%{_data::7}%$%{_data::8}%$%{_priority}%" else: set {PortaleList::%{_name}%} to "%{_data::1}%$%{_data::2}%$%{_data::3}%$%{_data::4}%$%{_data::5}%$%{_data::6}%$%{_data::7}%$%{_data::8}%$%{_priority}%$%{_data::10}%$%{_data::11}%$%{_data::12}%$%{_data::13}%" send "{@prefix} &aUstawiono priorytet portalu &e%{_name}% &ana &e%{_priority}%&a!" to {_executor} function portalSetPlayerPriority(p: player, priority: integer, executor: commandexecutor): set {PortalePriority::%{_p}%} to {_priority} send "{@prefix} &aPomyslnie ustawiono priorytet gracza &e%{_p}% &ana &e%{_priority}%&a!" to {_executor} function portalTryTeleport(portal: text, p: player) :: boolean: set {_priority} to portalExtract("priority", {_portal}) if {PortalePriority::%{_p}%} is not set: set {PortalePriority::%{_p}%} to 0 if {PortalePriority::%{_p}%} >= {_priority}: return true return false on region enter: set {_rg} to first element out of (split "%region%" by " ") if "%{_rg}%" contains "skportal_": loop {PortaleList::*}: set {_pr} to portalExtract("name", loop-value) if "skportal_%{_pr}%" is {_rg}: set {_fin} to portalExtract("fin", loop-value) if {_fin} is "null": portalMessage("portalcnnt", player, loop-value) stop set {_world} to portalExtract("finworld", loop-value) set {_l} to location at (x-coordinate of {_fin}), (y-coordinate of {_fin}), (z-coordinate of {_fin}) in portalParseWorld({_world}) set yaw of {_l} to ({_fin}'s yaw) set pitch of {_l} to ({_fin}'s pitch) if (portalTryTeleport(loop-value, player)) is true: teleport player to {_l} portalMessage("portaltped", player, loop-value) stop portalMessage("portallowprt", player, loop-value) stop command /portal [] [] []: permission: "skportal.*" trigger: if arg 1 is "create": if arg 3 is "%(arg-3 parsed as integer)%": if {portalSelectionA::%player%} is set: if {portalSelectionB::%player%} is set: portalCreate({portalSelectionA::%player%}, {portalSelectionB::%player%}, arg-2, (arg-3 parsed as integer), player) else: send "{@prefix} &cNie zaznaczyles &e2 &cpunktu portalu!" else: send "{@prefix} &cNie zaznaczyles &e1 &cpunktu portalu!" else: send "{@prefix} &cNie podales nazwy portalu lub priorytet nie jest liczba calkowita!" stop if arg 1 is "connect": if arg 2 is set: portalConnect(arg-2, player's location, player) else: send "{@prefix} &cNie podales nazwy portalu!" stop if arg 1 is "setpriority": if arg 3 is "%(arg-3 parsed as integer)%": portalSetPriority(arg-2, (arg-3 parsed as integer), player) else: send "{@prefix} &cNie podales nazwy portalu lub priorytet nie jest liczba calkowita!" stop if arg 1 is "setplayerpriority": if arg 3 is "%(arg-3 parsed as integer)%": portalSetPlayerPriority((arg-2 parsed as offlineplayer), (arg-3 parsed as integer), player) else: send "{@prefix} &cPriorytet nie jest liczba calkowita!" stop if arg 1 is "wand": give player golden axe named "{@portalWand}" send "{@prefix} &aOtrzymales {@portalWand}&a!" stop if arg 1 is "delete": if arg 2 is set: portalRemove(arg-2, player) else: send "{@prefix} &cNie podales nazwy portalu!" stop if arg 1 is "list": send "{@prefix} &aLista portali:" loop {PortaleList::*}: add 1 to {_i} send "&7%{_i}%. &6%portalExtract(""name"", loop-value)%" stop if arg 1 is "info": if arg 2 is set: if {PortaleList::%arg-2%} is set: send "&7Nazwa: &6%arg-2%" send "&7Priorytet: &6%portalExtract(""priority"", {PortaleList::%arg-2%})%" send "&7Punkt 1: &6%portalExtract(""l1"", {PortaleList::%arg-2%})% &7(&6%portalExtract(""world"", {PortaleList::%arg-2%})%&7)" send "&7Punkt 2: &6%portalExtract(""l2"", {PortaleList::%arg-2%})% &7(&6%portalExtract(""world"", {PortaleList::%arg-2%})%&7)" if portalExtract("fin", {PortaleList::%arg-2%}) is "null": send "&7Cel: &cCel portalu jest nieustawiony!" else: send "&7Cel: &6%portalExtract(""fin"", {PortaleList::%arg-2%})% &7(&6%portalExtract(""finworld"", {PortaleList::%arg-2%})%&7, &6yaw&7: &6%portalExtract(""yaw"", {PortaleList::%arg-2%})%&7, &6pitch&7: &6%portalExtract(""pitch"", {PortaleList::%arg-2%})%&7)" else: send "{@prefix} &cPortal &e%arg-2% &cnie istnieje!" else: send "{@prefix} &cNie podales nazwy portalu!" stop if arg 1 is "debug": if arg 2 is set: if {PortaleList::%arg-2%} is set: send "{@prefix} &aDebug portal: &e%arg-2%&a:" send "&6%{PortaleList::%arg-2%}%" else: send "{@prefix} &cPortal &e%arg-2% &cnie istnieje!" else: send "{@prefix} &cNie podales nazwy portalu!" stop if arg 1 is "help": send "{@prefix} &aPomoc:" send "&7/portal create [nazwa] [priorytet] &5- &6Tworzy nowy portal" send "&7/portal connect [nazwa] &5- &6Laczy portal z Twoja lokalizacja" send "&7/portal setpriority [nazwa] [priorytet] &5- &6Ustawia priorytet portalu" send "&7/portal setplayerpriority [gracz] [priorytet] &5- &6Ustawia priorytet gracza" send "&7/portal wand &5- &6Daje rozdzke do zaznaczania nowego portalu" send "&7/portal delete [nazwa] &5- &6Usuwa portal" send "&7/portal debug [nazwa] &5- Wyswietla dane portalu" send "&7/portal list &5- Wyswietla liste wszystkich portali" send "&7/portal info [nazwa] &5- Wyswietla informacje dot. portalu" send "&7/portal help &5- Wyswietla pomoc dot. komend" stop send "{@prefix} &cWpisz &e/portal help &caby uzyskac pomoc!" on leftclick: if player's tool is golden axe: if player's tool's name is "{@portalWand}": cancel event if event-block isn't air: set {portalSelectionA::%player%} to location of event-block set x-coordinate of {portalSelectionA::%player%} to rounded (x-coordinate of {portalSelectionA::%player%} - 0.5) set y-coordinate of {portalSelectionA::%player%} to rounded (y-coordinate of {portalSelectionA::%player%} - 0.5) set z-coordinate of {portalSelectionA::%player%} to rounded (z-coordinate of {portalSelectionA::%player%} - 0.5) send "{@prefix} &aUstawiles punkt &e1 &aportalu! (&e%{portalSelectionA::%player%}%&a)" on rightclick: if player's tool is golden axe: if player's tool's name is "{@portalWand}": cancel event if event-block isn't air: set {portalSelectionB::%player%} to location of event-block set x-coordinate of {portalSelectionB::%player%} to rounded (x-coordinate of {portalSelectionB::%player%} - 0.5) set y-coordinate of {portalSelectionB::%player%} to rounded (y-coordinate of {portalSelectionB::%player%} - 0.5) set z-coordinate of {portalSelectionB::%player%} to rounded (z-coordinate of {portalSelectionB::%player%} - 0.5) send "{@prefix} &aUstawiles punkt &e2 &aportalu! (&e%{portalSelectionB::%player%}%&a)"