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

I can't remove a player from a list

Discussion in 'Skript' started by Natalciuu, Feb 7, 2021.

Tags:
Thread Status:
Not open for further replies.
  1. Natalciuu

    Natalciuu Member

    Joined:
    Nov 12, 2020
    Messages:
    20
    Likes Received:
    0
    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 (Text):
    1. command /warn [<player>] [<text>] [<player>]:
    2.   permission: warn.use
    3.   trigger:
    4.     if arg-1 and arg-2 is set:
    5.       if arg-1 is online:
    6.         add arg-2 to {warn::*}
    7.         set {warns.%text-argument%} to player argument 1
    8.         send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
    9.         send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
    10.         loop all players:
    11.           if loop-player has permission "warn.use":
    12.             send "&eWarn: &7from %player%" to loop-player
    13.             send "&eWarned: &7%arg-1%" to loop-player
    14.             send "&eReason: &7%arg-2%" to loop-player
    15.     else if arg-2 is not set:
    16.       send "&8[&aNatalciuu&8] &7Please put in a reason."
    17.     else if arg-1 is not set:
    18.       if arg-2 is "clear":
    19.         if arg-3 is set:
    20.           loop {warn::*}:
    21.             if loop-value is arg-3:
    22.               remove arg-3 from {warn::*}
    23.               send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"
    24.               exit loop
    25.       if arg-2 is "list":
    26.         send "&e&l&nNatalciuu Warns"
    27.         send " "
    28.         loop {warn::*}:
    29.           set {warn} to {numara}
    30.           send "&ePlayer: &7%{warns.%loop-value%}%"
    31.           send "&eReason: &7%loop-value%"
    32.           send " "
     
  2. TehCheetah

    TehCheetah Member

    Joined:
    Feb 7, 2021
    Messages:
    49
    Likes Received:
    1
    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!

    --- Double Post Merged, Feb 7, 2021, Original Post Date: Feb 7, 2021 ---
    EDIT: Make sure you actually indent correctly. The Forums decided to not allow me to indent for you.
     
  3. Natalciuu

    Natalciuu Member

    Joined:
    Nov 12, 2020
    Messages:
    20
    Likes Received:
    0
    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
    --- Double Post Merged, Feb 8, 2021 ---
    I've been trying this out and its to no avail

    Code (Text):
    1. command /warn [<player>] [<text>] [<player>]:
    2.     permission: warn.use
    3.     trigger:
    4.         if arg-1 and arg-2 is set:
    5.             if arg-1 is online:
    6.                 add arg-2 to {warn::*}
    7.                 set {warns.%text-argument%} to player argument 1
    8.                 send "&8[&aNatalciuu&8] &7You have been warned by &e%player% &7for reason &e%arg-2%" to arg-1
    9.                 send "&8[&aNatalciuu&8] &7You warned &e%arg-1% &7for reason &e%arg-2%" to player
    10.                 loop all players:
    11.                     if loop-player has permission "warn.use":
    12.                         send "&eWarn: &7from %player%" to loop-player
    13.                         send "&eWarned: &7%arg-1%" to loop-player
    14.                         send "&eReason: &7%arg-2%" to loop-player
    15.         else if arg-2 is not set:
    16.             send "&8[&aNatalciuu&8] &7Please put in a reason."
    17.         else if arg-1 is not set:
    18.             if arg-2 is "clear":
    19.                 if arg-3 is set:
    20.                     clear {warn::%arg-3%}
    21.                     send "&8[&aNatalciuu&8] &7Cleared player &e%arg-3%&e's &7warns"
    22.  
    23.             if arg-2 is "list":
    24.                 send "&e&l&nNatalciuu Warns"
    25.                 send " "
    26.                 loop {warn::*}:
    27.                     send "&ePlayer: &7%{warns.%loop-value%}%"
    28.                     send "&eReason: &7%loop-value%"
    29.                     send " "
    30.             if arg-2 is "clearall":
    31.                 clear {warn::*}
    32.                 send "&8[&aNatalciuu&8] &7Cleared all warns."
     
  4. TehCheetah

    TehCheetah Member

    Joined:
    Feb 7, 2021
    Messages:
    49
    Likes Received:
    1
    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.

    --- Double Post Merged, Feb 8, 2021, Original Post Date: Feb 8, 2021 ---
    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:
     
Thread Status:
Not open for further replies.

Share This Page

Loading...