Solved on command ..

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

IxtraDeath

Member
Feb 23, 2017
16
0
0
25
Hi

so I am making a blacklist skript wich make it so no one can't ban blacklisted players
but it says I can't use arguments on "on command" .. how to do it?

Errors <-- errors when loading

Code (not full) :

code_language.skript:
on command "/unban <player>":
    if arg-1 is in {blacklist::*}:
        cancel event
        message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
        make console execute command "warn %player% Tried to unban a blacklisted player"
        stop
on command "/unbanip <player>":
    if argument 1 is in {blacklist::*}:
        cancel event
        message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
        make console execute command "warn %player% Tried to unban a blacklisted player"
        stop
on command "/eunban <player>":
    if argument 1 is in {blacklist::*}:
        cancel event
        message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
        make console execute command "warn %player% Tried to unban a blacklisted player"
        stop
 
FFS

Well, first of all, you're literally detecting if the player wrote "/unban <player>", Skript will not magically replace the <player> with the player, hence, this wouldn't work. Please read this tutorial carefully.
 
Please tell me that you aren't creating commands with the command event.
What I'm trying to do is if the player in blacklist will not be unbanned, (so if the blacklisted player is argument 2 skript will not allow it) I'm using Maxbans for /unban command, sorry i'm a begginer in skript
 
What I'm trying to do is if the player in blacklist will not be unbanned, (so if the blacklisted player is argument 2 skript will not allow it) I'm using Maxbans for /unban command, sorry i'm a begginer in skript
No not sorry they can't read he is not doing that.

this should fix it:

I didn't test it.

code_language.skript:
on command "/unban":
   set {_list::*} to arguments
   if {blacklist::*} contains {_list::1}:
       cancel event
       message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
       make console execute command "warn %player% Tried to unban a blacklisted player"
       stop
     
on command "/unbanip":
   set {_list::*} to arguments
   if {blacklist::*} contains {_list::1}:
       cancel event
       message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
       make console execute command "warn %player% Tried to unban a blacklisted player"
       stop
     
on command "/eunban":
   set {_list::*} to arguments
   if {blacklist::*} contains {_list::1}:
       cancel event
       message "&8[&eProtect&8]&7 This ban is locked. you CANNOT unban this player"
       make console execute command "warn %player% Tried to unban a blacklisted player"
       stop
 
Last edited by a moderator:
What I'm trying to do is if the player in blacklist will not be unbanned, (so if the blacklisted player is argument 2 skript will not allow it) I'm using Maxbans for /unban command, sorry i'm a begginer in skript
My apologies, I thought you were trying to create a command with the command event, what you're doing right now is completely correct excepting some things that I'll point out.

So, as I said in my previous post, you're trying to detect if the player wrote "/unban <player>" but Skript will think that you literally want to detect when a player wrote "/unban <player>" and not "/unban somePlayer", hence, this wouldn't work. What you have to do is remove the argument and only check if the command was "/unban", then use the arguments expression (you can't use the arg-x in the command event) and split the arguments by a space; here is what I mean:
code_language.skript:
#The following function isn't really needed, you could implement it in your code without the function but it's better to have it in a function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false

on command "/unban":
    set {_args::*} to arguments split by " "
    if contains({blacklist::*}, {_args::1}) is true:
        #do stuff

EDIT:
@Lego_freak1999 that will not fix anything such as "is in" isn't a thing, also, spoon feeding the OP will not let him learn anything.
 
My apologies, I thought you were trying to create a command with the command event, what you're doing right now is completely correct excepting some things that I'll point out.

So, as I said in my previous post, you're trying to detect if the player wrote "/unban <player>" but Skript will think that you literally want to detect when a player wrote "/unban <player>" and not "/unban somePlayer", hence, this wouldn't work. What you have to do is remove the argument and only check if the command was "/unban", then use the arguments expression (you can't use the arg-x in the command event) and split the arguments by a space; here is what I mean:
code_language.skript:
#The following function isn't really needed, you could implement it in your code without the function but it's better to have it in a function contains(list: objects, check: object) :: boolean:
    loop {_list::*}:
        if loop-value is {_check}:
            return true
    return false

on command "/unban":
    set {_args::*} to arguments split by " "
    if contains({blacklist::*}, {_args::1}) is true:
        #do stuff

EDIT:
@Lego_freak1999 that will not fix anything such as "is in" isn't a thing, also, spoon feeding the OP will not let him learn anything.


One line isn't working: Error
 
Could you tell me your version of Skript? Do "/about Skript" for see it.

Skript Version: 2.0.2
Author: Njol
Other addons: WildSkript, skRayFall, SkQuery, skUtilities
[doublepost=1490134346,1490133755][/doublepost]
Could you tell me your version of Skript? Do "/about Skript" for see it.

Nvm it worked .. I did it like this:

code_language.skript:
    if {blacklist::*} contains {_list::*}:
 
Status
Not open for further replies.