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.

Why does is not work????

Discussion in 'Skript' started by Auswahluhr6004, Jul 18, 2017.

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

    Joined:
    Mar 1, 2017
    Messages:
    109
    Likes Received:
    1
    Hello,

    why is it not working?

    Code:
    Code (Skript):
    1. on join:
    2.     set {Alreadyon.%player%} to player's ip
    3.  
    4. on quit:
    5.     delete {Alreadyon.%player%}
    6.  
    7. on connect:
    8.     if {Alreadyon.%player%} is not equal to player's ip:
    9.         kick player due to "&4You are allready Online!"
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    The On Connect event triggers before the On Join event. So just switch the content of On Join and On Connect.

    Code (Skript):
    1.  
    2. on join:
    3.     if {Alreadyon.%player%} is not equal to player's ip:
    4.         kick player due to "&4You are allready Online!"
    5.  
    6. on quit:
    7.     delete {Alreadyon.%player%}
    8.  
    9. on connect:
    10.     set {Alreadyon.%player%} to player's ip
    11.  
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    It does not work.
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Could you please go a little bit more in depth about what your trying to achieve?

    If you're trying to block players who have the same ip you should do something like:
    Code (Skript):
    1. on quit:
    2.     Clear {AlreadyOn.%Player's ip%}
    3. on connect:
    4.     If {AlreadyOn.%Player's ip%} is set:
    5.         kick player due to "&4You are allready Online!"
    6.         Cancel event
    7.         Stop
    8.     set {AlreadyOn.%Player's ip%} to true
     
    #4 ShaneBee, Jul 19, 2017
    Last edited by a moderator: Jul 19, 2017
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Code (Skript):
    1. # Using list variables is more powerful than normal variables.
    2.  
    3. on quit:
    4.     delete {connected::%player's ip%}
    5.  
    6. on connect:
    7.     {connected::%player's ip%} is set:
    8.         kick player due to "&cA player with the same IP is already online."
    9.         cancel event
    10.         stop
    11.     set {connected::%player's ip%} to true
     
    • Like Like x 1
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Could you explain me why ? Just curious :emoji_slight_smile:
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    For example, to delete all connections, you should use:
    Code (Skript):
    1. loop all players:
    2.     delete {var.%loop-player%}
    But, with list variables, you may only use:
    Code (Skript):
    1. delete {var::*}
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Well, actually....

    {var::*} is simply:
    - {var::1}
    - {var::2}
    - {var::3}
    etc.

    {var::*} is not {var::%value%}

    {var::1} is one variable, {var::2} is another variable, etc. Each of them is stored in the list, with an index.
    Example:
    Code (Skript):
    1. loop {var::*}:
    2. #%loop-index% is the index of the looped variable, it is a number.
    3.     if {var::%loop-index%} = {var::1}:
    4.         broadcast "That was the first variable in the list"
    5.     else:
    6.         broadcast "Variable: %loop-value% = %{var::%loop-index%}%"
    7. #%loop-value% holds the value of the variable that is being looped.
    I figured this out the hard way when I was wondering why my script wasn't working.
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    {Var::1} {var::2} happens only if you "add loop-value to {Var::*}

    you can do

    set {Var::ChisleLP} to 100
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    Will {var::ChisleLP} be stored in the list variable, or will it be a normal variable?
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    227
    This will be stored as list variables. just test it out:

    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         add 10 to {Var::*}
    4.         add "Testing" to {Var::*}
    5.         set {Var::ChisleLP} to 50
    6.         set {Var::LoL} to "Omg Works?"
    7.         loop {Var::*}:
    8.             send "%loop-value% - %loop-index%"
     
    • Informative Informative x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...