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 our 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 Skript help - If list variable contains...

Discussion in 'Skript' started by CustomWorldYT, Jul 9, 2018.

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

    CustomWorldYT Member

    Joined:
    Jun 17, 2018
    Messages:
    15
    Likes Received:
    0
    Skript Version: 2.2 dev36 (currently latest, downloaded from: https://github.com/SkriptLang/Skript/releases)
    Skript Author: CustomWorldYT (Me)
    Minecraft Version: 1.12.2 Spigot


    I'm trying to do an IP check system for my staff, my server is FreeOP and so it's running offline mode. The problem is, my code is not working for some reason, it will always let players join even if they have other IP and they logged in using staff account. I don't know much about list variables, I tired to browse many videos, and docs, forums, etc. but I'm confused when I use "contains". I already asked on GitHub, but they said that "contains" has been already fixed. Help me, I'm confused. Don't blame me if those aren't even list variables, they are complicated, and any help would make me happy.
    ---
    Full Code:

    Code (Skript):
    1.  
    2. on join:
    3.     if {cw_ips::%player%} does not contain player's IP: #Here is it little buggy.
    4.         broadcast "&cWARNING - &e%player% &cis an Imposter! Kicking him..." #Perform an action, when player imposes as staff
    5.     else:
    6.         stop
    7.        
    8. command /addip [<text>]:
    9.     trigger:
    10.         if player's name is {@admins} or {@co-owners} or {@owners} or {@moderators} or {@helpers}: #If player is staff... (I'm running freeop server, meaning I can't use permissions)
    11.             if arg 1 is not set:
    12.                 add ip of player to {cw_ips::%player%} #fine... ?
    13.                 message "&aAdded &e%IP of player% &ato list of your IPs." to player
    14.                 stop
    15.             else:
    16.                 add argument 1 to {cw_ips::%player%}
    17.                 message "&aAdded &e%argument% &ato list of your IPs." to player
    18.                 stop
    19.         else:
    20.             message "%{cw::lang::only-staff}%" to player
    21.             stop
    22.            
    23. command /clearips:
    24.     trigger:
    25.         if player's name is {@admins} or {@co-owners} or {@owners} or {@moderators} or {@helpers}: #If player is staff... (I'm running freeop server, meaning I can't use permissions)
    26.             delete {cw_ips::%player%} #Clear IPs of player
    27.             message "&cDeleted &lALL &cof your IPs. Assign a new one right now by using &e/addmyip&c." to player
    28.             stop
    29.         else:
    30.             message "Only staff can execute this command." to player
    31.             stop
    32.  
    Errors on Reload:

    Code (Skript):
    1. "All scripts loaded without errors."
    Console Errors:

    Code (Skript):
    1. None
    Other Useful Info:

    Addons using (including versions):
    none

    Troubleshooting:

    Have you tried searching the docs? Yes
    Have you tried searching the forums? Yes
    What other methods have you tried to fix it? I'm confused. I just can't get it work.

    Thank you.
     
  2. Efnilite

    Supporter

    Joined:
    May 12, 2018
    Messages:
    218
    Likes Received:
    14
    Medals:
    Yeah, sometimes this happends to me too, that 'contains' doesn't work, because it should be fixed in dev36. But try using
    Code (Skript):
    1. if "%{cw::ips::%player%::*}%" doesn't contain "%player's ip%":
    oh wait, try using list variables to store it like this:

    Code (Skript):
    1. {cw::ips::%player%::*}
    because that stores more than 1 ip per player, and if you just use '{cw::ips::%player%}' it will only save the list of players, and not the ip per player, so it saves like this:
    Code (Skript):
    1. {cw::ips::%player%} = {cw::ips::Efnilite}, {cw::ips::Notch}, etc.
    2.  
    3. {cw::ips::%player%::*} = {cw::ips::Efnilite::1.1.1.1}, {cw::ips::Notch::6.6.6}, etc
    Also, Skript Author is the one who made your skript jar (Bensku, Njol, etc.)
     
    #2 Efnilite, Jul 9, 2018
    Last edited: Jul 9, 2018
    • Winner Winner x 1
  3. CustomWorldYT

    CustomWorldYT Member

    Joined:
    Jun 17, 2018
    Messages:
    15
    Likes Received:
    0
    Thank you for your code, it worked for me. Thanks alot.

    :emoji_slight_smile: I thought it was person who made the script, but it was strange to me... However, noone noticed that I kept saying that I made the Skript, until now. xD
     
Thread Status:
Not open for further replies.
Loading...