Why does is not work????

  • 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.
Mar 1, 2017
109
1
18
Hello,

why is it not working?

Code:
code_language.skript:
on join:
    set {Alreadyon.%player%} to player's ip
 
on quit:
    delete {Alreadyon.%player%}
 
on connect:
    if {Alreadyon.%player%} is not equal to player's ip:
        kick player due to "&4You are allready Online!"
 
The On Connect event triggers before the On Join event. So just switch the content of On Join and On Connect.

code_language.skript:
on join:
    if {Alreadyon.%player%} is not equal to player's ip:
        kick player due to "&4You are allready Online!"

on quit:
    delete {Alreadyon.%player%}

on connect:
    set {Alreadyon.%player%} to player's ip
 
The On Connect event triggers before the On Join event. So just switch the content of On Join and On Connect.

code_language.skript:
on join:
    if {Alreadyon.%player%} is not equal to player's ip:
        kick player due to "&4You are allready Online!"

on quit:
    delete {Alreadyon.%player%}

on connect:
    set {Alreadyon.%player%} to player's ip
It does not work.
 
It does not work.
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_language.skript:
on quit:
    Clear {AlreadyOn.%Player's ip%}
on connect:
    If {AlreadyOn.%Player's ip%} is set:
        kick player due to "&4You are allready Online!"
        Cancel event
        Stop
    set {AlreadyOn.%Player's ip%} to true
 
Last edited by a moderator:
code_language.skript:
# Using list variables is more powerful than normal variables.

on quit:
    delete {connected::%player's ip%}

on connect:
    {connected::%player's ip%} is set:
        kick player due to "&cA player with the same IP is already online."
        cancel event
        stop
    set {connected::%player's ip%} to true
 
  • Like
Reactions: A248
code_language.skript:
# Using list variables is more powerful than normal variables.

on quit:
    delete {connected::%player's ip%}

on connect:
    {connected::%player's ip%} is set:
        kick player due to "&cA player with the same IP is already online."
        cancel event
        stop
    set {connected::%player's ip%} to true
Could you explain me why ? Just curious :emoji_slight_smile:
 
For example, to delete all connections, you should use:
code_language.skript:
loop all players:
    delete {var.%loop-player%}
But, with list variables, you may only use:
code_language.skript:
delete {var::*}
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_language.skript:
loop {var::*}:
#%loop-index% is the index of the looped variable, it is a number.
    if {var::%loop-index%} = {var::1}:
        broadcast "That was the first variable in the list"
    else:
        broadcast "Variable: %loop-value% = %{var::%loop-index%}%"
#%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.
 
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_language.skript:
loop {var::*}:
#%loop-index% is the index of the looped variable, it is a number.
    if {var::%loop-index%} = {var::1}:
        broadcast "That was the first variable in the list"
    else:
        broadcast "Variable: %loop-value% = %{var::%loop-index%}%"
#%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.
{Var::1} {var::2} happens only if you "add loop-value to {Var::*}

you can do

set {Var::ChisleLP} to 100
 
Will {var::ChisleLP} be stored in the list variable, or will it be a normal variable?
This will be stored as list variables. just test it out:

code_language.skript:
command /test:
    trigger:
        add 10 to {Var::*}
        add "Testing" to {Var::*}
        set {Var::ChisleLP} to 50
        set {Var::LoL} to "Omg Works?"
        loop {Var::*}:
            send "%loop-value% - %loop-index%"
 
Status
Not open for further replies.