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

Can't loop because its only a single value

Discussion in 'Skript' started by Zapzival, Aug 28, 2019.

Thread Status:
Not open for further replies.
  1. Zapzival

    Zapzival Member

    Joined:
    Aug 28, 2019
    Messages:
    1
    Likes Received:
    0
    Ok so I saw this skript that was a command log and I wanted to try to make it so each player had their own logs. For example, you could do /logs Player Commands and all of those players command would be listed.
    Heres the code:


    on command:
    if sender is a player:
    set {_time} to now
    add "&b%player%: &c/%full command% &6(%{_time}%)" to {logscommand::%player's uuid%}
    on chat:
    if sender is a player:
    set {_time} to now
    add "&a%player%: &7%message% &6(%{_time}%)" to {logschat::%player's uuid%}
    command /logs [<text>] [<text>]:
    permission: logs.see
    permission message: &4You don't have permission for this command.
    trigger:
    if arg 1 isn't set:
    send "&4&lSkriptz&8» &cUse: &7/logs <player> <commands|chat>"
    else:
    if arg 2 isn't set:
    send "&4&lSkriptz&8» &cUse: &7/logs <player> <commands|chat>"
    else:
    if arg 2 is "command" or "commands":
    send "&c&l&nCOMMAND LOGS:"
    loop {logscommand::%{_arg1uuid}%}:
    send "%loop-value%"
    if arg 2 is "chat":
    send "&c&l&nCHAT LOGS:"
    loop {logschat::%{_arg1uuid}%}:
    send "%loop-value%"
    command /clearlogs [<text>]:
    permission: logs.clear
    trigger:
    if arg 1 isn't set:
    send "&4&lSkriptz&8» &cUse: &7/Clearlogs <player>"
    else:
    clear {logschat::%{_arg1uuid}%}
    clear {logscommand::%{_arg1uuid}%}
    send "&4&lSkriptz&8» &aYou have successfully cleared the logs of %{_arg1uuid}%!"


    The error that I am recieving from says it cant loop a single value (Line 21 and Like 25)
     
  2. AsuDev

    VIP

    Joined:
    Jan 27, 2017
    Messages:
    196
    Likes Received:
    18
    The error is correct, you cannot loop a single value. You are not using list variables correctly.
    Code (Skript):
    1. add "" to {logschat::%player's uuid%} # This is not a list variable. It is a single value.
    2.  
    3. #Correct list variable usage:
    4. add "" to {logschat::%player's uuid%::*}
    5.  
    6. #Correct list variable looping:
    7. loop {logscommand::%{_arg1uuid}%::*}:
    '::*' signifies that its a list variable representing all values inside that list.
     
Thread Status:
Not open for further replies.
Loading...