I can't remove a player from a list

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

Natalciuu

Member
Nov 12, 2020
20
0
1
21
Hi, Im working on making a warn command for my server, it works great except for being able to clear a specific player's warns. It won't work properly and I'm having trouble figuring it out.



Code:
command /warn [<player>] [<text>] [<player>]:
  permission: warn.use
  trigger:
    if arg-1 and arg-2 is set:
      if arg-1 is online:
        add arg-2 to {warn::*}
        set {warns.%text-argument%} to player argument 1
        send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
        send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
        loop all players:
          if loop-player has permission "warn.use":
            send "&eWarn: &7from %player%" to loop-player
            send "&eWarned: &7%arg-1%" to loop-player
            send "&eReason: &7%arg-2%" to loop-player
    else if arg-2 is not set:
      send "&8[&aNatalciuu&8] &7Please put in a reason."
    else if arg-1 is not set:
      if arg-2 is "clear":
        if arg-3 is set:
          loop {warn::*}:
            if loop-value is arg-3:
              remove arg-3 from {warn::*}
              send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"
              exit loop
      if arg-2 is "list":
        send "&e&l&nNatalciuu Warns"
        send " "
        loop {warn::*}:
          set {warn} to {numara}
          send "&ePlayer: &7%{warns.%loop-value%}%"
          send "&eReason: &7%loop-value%"
          send " "
 
Usually, with a warn command, you'll want to use Variables. (Especially if you want to clear the amount of warns a player has)

I haven't skripted in ages, but I am pretty sure this is right.

Example:

command /warn [<player>] [<text>]:
permission: warn.use
trigger:
if arg-1 isn't set:
send "&7Please specify a player and a reason to warn!" to player
else:
broadcast "%player% has warned %arg-1% for %arg-2%"
if {_warns::%arg-1%} is not set:
set {_warns::%arg-1%} to 0
add 1 to {_warns::%arg-1%}

command /clearwarns [<player>]:
permission: clearwarns.use
trigger:
if arg-1 is not set:
send "&7Please specify a player to clear their warns!" to player
else:
set {_warns::%arg-1%} to 0
stop


Explanation:
You need a variable to be able to clear it. Without it, there would be nothing to clear!
Feel free to just copy what I wrote, but try and put your own spin on it.
If for some reason I typed something wrong in the Skript, I apologize!
Have a fantastic day!

[doublepost=1612735848,1612735736][/doublepost]
Usually, with a warn command, you'll want to use Variables. (Especially if you want to clear the amount of warns a player has)

I haven't skripted in ages, but I am pretty sure this is right.

Example:

command /warn [<player>] [<text>]:
permission: warn.use
trigger:
if arg-1 isn't set:
send "&7Please specify a player and a reason to warn!" to player
else:
broadcast "%player% has warned %arg-1% for %arg-2%"
if {_warns::%arg-1%} is not set:
set {_warns::%arg-1%} to 0
add 1 to {_warns::%arg-1%}

command /clearwarns [<player>]:
permission: clearwarns.use
trigger:
if arg-1 is not set:
send "&7Please specify a player to clear their warns!" to player
else:
set {_warns::%arg-1%} to 0
stop


Explanation:
You need a variable to be able to clear it. Without it, there would be nothing to clear!
Feel free to just copy what I wrote, but try and put your own spin on it.
If for some reason I typed something wrong in the Skript, I apologize!
Have a fantastic day!

EDIT: Make sure you actually indent correctly. The Forums decided to not allow me to indent for you.
 
Usually, with a warn command, you'll want to use Variables. (Especially if you want to clear the amount of warns a player has)

I haven't skripted in ages, but I am pretty sure this is right.

Example:

Code:
command /warn [<player>] [<text>]:
    permission: warn.use
    trigger:
        if arg-1 isn't set:
            send "&7Please specify a player and a reason to warn!" to player
        else:
            broadcast "%player% has warned %arg-1% for %arg-2%"
            if {_warns::%arg-1%} is not set:
                set {_warns::%arg-1%} to 0
             add 1 to {_warns::%arg-1%}

command /clearwarns [<player>]:
    permission: clearwarns.use
    trigger:
        if arg-1 is not set:
            send "&7Please specify a player to clear their warns!" to player
        else:
            set {_warns::%arg-1%} to 0
            stop


Explanation:
You need a variable to be able to clear it. Without it, there would be nothing to clear!
Feel free to just copy what I wrote, but try and put your own spin on it.
If for some reason I typed something wrong in the Skript, I apologize!
Have a fantastic day!

[doublepost=1612735848,1612735736][/doublepost]

EDIT: Make sure you actually indent correctly. The Forums decided to not allow me to indent for you.

The problem with this is I do have variables and have my system a bit different from the example. It works fine, I just cant clear a specific players warns
[doublepost=1612748142][/doublepost]I've been trying this out and its to no avail

Code:
command /warn [<player>] [<text>] [<player>]:
    permission: warn.use
    trigger:
        if arg-1 and arg-2 is set:
            if arg-1 is online:
                add arg-2 to {warn::*}
                set {warns.%text-argument%} to player argument 1
                send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
                send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
                loop all players:
                    if loop-player has permission "warn.use":
                        send "&eWarn: &7from %player%" to loop-player
                        send "&eWarned: &7%arg-1%" to loop-player
                        send "&eReason: &7%arg-2%" to loop-player
        else if arg-2 is not set:
            send "&8[&aNatalciuu&8] &7Please put in a reason."
        else if arg-1 is not set:
            if arg-2 is "clear":
                if arg-3 is set:
                    clear {warn::%arg-3%}
                    send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"

            if arg-2 is "list":
                send "&e&l&nNatalciuu Warns"
                send " "
                loop {warn::*}:
                    send "&ePlayer: &7%{warns.%loop-value%}%"
                    send "&eReason: &7%loop-value%"
                    send " "
            if arg-2 is "clearall":
                clear {warn::*}
                send "&8[&aNatalciuu&8] &7Cleared all warns."
 
The problem with this is I do have variables and have my system a bit different from the example. It works fine, I just cant clear a specific players warns
[doublepost=1612748142][/doublepost]I've been trying this out and its to no avail

Code:
command /warn [<player>] [<text>] [<player>]:
    permission: warn.use
    trigger:
        if arg-1 and arg-2 is set:
            if arg-1 is online:
                add arg-2 to {warn::*}
                set {warns.%text-argument%} to player argument 1
                send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
                send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
                loop all players:
                    if loop-player has permission "warn.use":
                        send "&eWarn: &7from %player%" to loop-player
                        send "&eWarned: &7%arg-1%" to loop-player
                        send "&eReason: &7%arg-2%" to loop-player
        else if arg-2 is not set:
            send "&8[&aNatalciuu&8] &7Please put in a reason."
        else if arg-1 is not set:
            if arg-2 is "clear":
                if arg-3 is set:
                    clear {warn::%arg-3%}
                    send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"

            if arg-2 is "list":
                send "&e&l&nNatalciuu Warns"
                send " "
                loop {warn::*}:
                    send "&ePlayer: &7%{warns.%loop-value%}%"
                    send "&eReason: &7%loop-value%"
                    send " "
            if arg-2 is "clearall":
                clear {warn::*}
                send "&8[&aNatalciuu&8] &7Cleared all warns."

Honestly, this should work. (I think anyway, I only took a quick glance at everything)
Though, I have noticed quite a few things that are unnecessary but still work.

[doublepost=1612794347,1612748630][/doublepost]
The problem with this is I do have variables and have my system a bit different from the example. It works fine, I just cant clear a specific players warns
[doublepost=1612748142][/doublepost]I've been trying this out and its to no avail

Code:
command /warn [<player>] [<text>] [<player>]:
    permission: warn.use
    trigger:
        if arg-1 and arg-2 is set:
            if arg-1 is online:
                add arg-2 to {warn::*}
                set {warns.%text-argument%} to player argument 1
                send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
                send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
                loop all players:
                    if loop-player has permission "warn.use":
                        send "&eWarn: &7from %player%" to loop-player
                        send "&eWarned: &7%arg-1%" to loop-player
                        send "&eReason: &7%arg-2%" to loop-player
        else if arg-2 is not set:
            send "&8[&aNatalciuu&8] &7Please put in a reason."
        else if arg-1 is not set:
            if arg-2 is "clear":
                if arg-3 is set:
                    clear {warn::%arg-3%}
                    send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"

            if arg-2 is "list":
                send "&e&l&nNatalciuu Warns"
                send " "
                loop {warn::*}:
                    send "&ePlayer: &7%{warns.%loop-value%}%"
                    send "&eReason: &7%loop-value%"
                    send " "
            if arg-2 is "clearall":
                clear {warn::*}
                send "&8[&aNatalciuu&8] &7Cleared all warns."

Something I would personally do is instead of use "{warns.%text-argument}" is use {warns.%arg-2%}

Just wanted to mention this if I haven't already:
I am not the BEST person with Skript, but I really just wanted to come on and help people with the knowledge I have with it!
If for some reason I make a mistake (which is probably going to happen) Let me know :emoji_grinning:
 
Status
Not open for further replies.