Solved Skript help - If list variable contains...

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

CustomWorldYT

Member
Jun 17, 2018
15
0
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_language.skript:
on join:
    if {cw_ips::%player%} does not contain player's IP: #Here is it little buggy.
        broadcast "&cWARNING - &e%player% &cis an Imposter! Kicking him..." #Perform an action, when player imposes as staff
    else:
        stop 
       
command /addip [<text>]:
    trigger:
        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)
            if arg 1 is not set:
                add ip of player to {cw_ips::%player%} #fine... ?
                message "&aAdded &e%IP of player% &ato list of your IPs." to player
                stop
            else:
                add argument 1 to {cw_ips::%player%} 
                message "&aAdded &e%argument% &ato list of your IPs." to player
                stop
        else:
            message "%{cw::lang::only-staff}%" to player
            stop
           
command /clearips:
    trigger:
        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)
            delete {cw_ips::%player%} #Clear IPs of player
            message "&cDeleted &lALL &cof your IPs. Assign a new one right now by using &e/addmyip&c." to player
            stop
        else:
            message "Only staff can execute this command." to player
            stop

Errors on Reload:

code_language.skript:
"All scripts loaded without errors."

Console Errors:

code_language.skript:
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.
 
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_language.skript:
on join:
    if {cw_ips::%player%} does not contain player's IP: #Here is it little buggy.
        broadcast "&cWARNING - &e%player% &cis an Imposter! Kicking him..." #Perform an action, when player imposes as staff
    else:
        stop
    
command /addip [<text>]:
    trigger:
        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)
            if arg 1 is not set:
                add ip of player to {cw_ips::%player%} #fine... ?
                message "&aAdded &e%IP of player% &ato list of your IPs." to player
                stop
            else:
                add argument 1 to {cw_ips::%player%}
                message "&aAdded &e%argument% &ato list of your IPs." to player
                stop
        else:
            message "%{cw::lang::only-staff}%" to player
            stop
        
command /clearips:
    trigger:
        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)
            delete {cw_ips::%player%} #Clear IPs of player
            message "&cDeleted &lALL &cof your IPs. Assign a new one right now by using &e/addmyip&c." to player
            stop
        else:
            message "Only staff can execute this command." to player
            stop

Errors on Reload:

code_language.skript:
"All scripts loaded without errors."

Console Errors:

code_language.skript:
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.
Yeah, sometimes this happends to me too, that 'contains' doesn't work, because it should be fixed in dev36. But try using
code_language.skript:
if "%{cw::ips::%player%::*}%" doesn't contain "%player's ip%":
oh wait, try using list variables to store it like this:

code_language.skript:
{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_language.skript:
{cw::ips::%player%} = {cw::ips::Efnilite}, {cw::ips::Notch}, etc.

{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.)
 
Last edited:
Thank you for your code, it worked for me. Thanks alot.

Also, Skript Author is the one who made your skript jar (Bensku, Njol, etc.)

: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
 
Status
Not open for further replies.