1. Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Save the Local Variable of the function

Discussion in 'Skript' started by couger44, Apr 24, 2019.

Thread Status:
Not open for further replies.
  1. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    714
    Likes Received:
    31
    Is there a way this works?
    Code (Skript):
    1.  
    2. function worldexpNivelDelJugador(p: player, variable: string):
    3.     if {worldexp.nivel.%{_p}%} is between 1 and 4:
    4.         set {_%{_variable}%} to "&8[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    5.     else if {worldexp.nivel.%{_p}%} is between 5 and 9:
    6.         set {_%{_variable}%} to "&7[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    7.     else if {worldexp.nivel.%{_p}%} is between 10 and 14:
    8.         set {_%{_variable}%} to "&f[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    9.     else if {worldexp.nivel.%{_p}%} is between 15 and 19:
    10.         set {_%{_variable}%} to "&2[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    11.     else if {worldexp.nivel.%{_p}%} is between 20 and 24:
    12.         set {_%{_variable}%} to "&3[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    13.     else if {worldexp.nivel.%{_p}%} is between 25 and 29:
    14.         set {_%{_variable}%} to "&5[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    15.     else if {worldexp.nivel.%{_p}%} is between 30 and 34:
    16.         set {_%{_variable}%} to "&1[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    17.     else if {worldexp.nivel.%{_p}%} is between 35 and 39:
    18.         set {_%{_variable}%} to "&e&l[%{worldexp.nivel.%{_p}%}%] %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    19.     else if {worldexp.nivel.%{_p}%} is between 40 and 44:
    20.         set {_%{_variable}%} to "&a&l&ki&2&l%{worldexp.nivel.%{_p}%}%&a&l&ki&f %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    21.     else if {worldexp.nivel.%{_p}%} >= 45:
    22.         set {_%{_variable}%} to "&3&l&ki&b&l&ki&9&l&o%{worldexp.nivel.%{_p}%}%&b&l&ki&3&l&ki&f %coloured {_p}'s prefix%%{nombre.%{_p}%}%%coloured {_p}'s suffix%"
    23.  
    24.  
    Basically what I want to do here is that in the second argument of the function you can "save" the variable placed to be able to use it later.My question is whether that is possible, for example to do something like this: (Taking the function that I wrote earlier)
    Code (Skript):
    1.  
    2. on chat:
    3.     cancel event
    4.     worldexpNivelDelJugador(player, "_n")
    5.     if player has permission "world.chat.suscrito":
    6.         if {suscrito.%player%} is not set:
    7.             broadcast "&7&ki%{suscrito.%player%}%&7&ki&a %{_n}%&f &9»&b» &6&l%message%"
    8. #...
    9.  
    10.  
    --- Double Post Merged, Apr 24, 2019, Original Post Date: Apr 24, 2019 ---
    I just found a way to do it.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...