Skript: "if {any::list::variable} contains player's display name" is broken

Created on 3 Jul 2018  路  7Comments  路  Source: SkriptLang/Skript

OK, so when I try to use something like "if {list::variable} contains "blah blah"" it won't work and it's bugged. I see people having same issues around there and looks like thoose threads got abandoned, so I would like if devs could fix this nasty bug.

Example:
if {list::blah} contains player's IP:
broadcast "works"
else:
broadcast ":["

In my case, it will ALWAYS broadcast ":["

invalid

Most helpful comment

Loolll xD sorry for bothering you guys, thank you.

All 7 comments

What Skript version are you using? This was #411 which was supposed to have been fixed already.

You have an outdated Skript version

I have version 2.2 dev36 (latest) and my code is:

on chat: 
    if {cw.staff::owners} contains player's name: 
            cancel event 
            broadcast "{@owners-chat-format}" 
            stop 
    else:
           stop

In my case, I'm making FreeOP skript, meaning I can't use permission. Also, I want to have a command that will add staff ingame, using /setrank (for example). This code is supposed to broadcast custom chat format, but it will broadcast default chat format for everyone, even for staff.
My entire command to set ranks:

command /setrank [< player >] [< text >]:
    trigger:
        if {cw.staff::owners} or {cw.staff::co-owners} contains player's name:
            if arg 1 is set:
                if arg 2 is set:
                    if arg 2 is "OP" or "remove":
                        remove argument 2 from {cw.staff::*}
                        broadcast "&e%player% &c- Removing &e%arg 1% &cfrom the staff list."
                        stop
                    if arg 2 is "helper":
                        add argument 1 to {cw.staff::helpers}
                        broadcast "&e%player% &c- Adding &e%arg 1% &cto the helpers list."
                        stop
                    if arg 2 is "moderator" or "mods":
                        add argument 1 to {cw.staff::moderators}
                        broadcast "&e%player% &c- Adding &e%arg 1% &cto the moderators list."
                        stop   
                    if arg 2 is "admin":
                        add argument 1 to {cw.staff::admins}
                        broadcast "&e%player% &c- Adding &e%arg 1% &cto the admins list."
                        stop  
                    if arg 2 is "co-owner" or "coowner":
                        add argument 1 to {cw.staff::co-owners}
                        broadcast "&e%player% &c- Adding &e%arg 1% &cto the Co-Owners list."
                        stop
                    if arg 2 is "owner":
                        add argument 1 to {cw.staff::owners}
                        broadcast "&e%player% &c- Adding &e%arg 1% &cto the &lOWNERS &clist."
                        stop 
                    else:
                        message "&cPlease, specify a rank."
                        stop
            else:
                message "%{cw::lang::specify-player}%" to player
        else:
            message "%{cw::lang::no-perms}% %{cw::lang::only-owners}%" to player
            stop

I have no errors on reload, also I don't see any errors in the console.

Any help or alternative? :/

_For some reasons, it didn't put correct spacing... I don't know... Edit: Why not @TheBentoBox, thx_

Pretty sure you can't use an "or" like that to see if either list contains a value. Skript only supports "or" in specific circumstances (e.g. choosing a random value from multiple literals).

Wait, {cw.staff::owners} and {cw.staff::co-owners} are single values not lists

so your code is wrong too:

add argument 1 to {cw.staff::co-owners}

will not work :)

Oh yeah, that too. 馃槀

So yeah, this is user error. I suggest reading up on how list variables work.

Loolll xD sorry for bothering you guys, thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Anoniempje1234 picture Anoniempje1234  路  3Comments

Romitou picture Romitou  路  3Comments

DeagoTheDoggo picture DeagoTheDoggo  路  3Comments

Anarchick picture Anarchick  路  3Comments

GiraffeCubed picture GiraffeCubed  路  3Comments