Can't loop because its only a single value

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

Zapzival

Member
Aug 28, 2019
1
0
0
24
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)
 
The error is correct, you cannot loop a single value. You are not using list variables correctly.
code_language.skript:
add "" to {logschat::%player's uuid%} # This is not a list variable. It is a single value.

#Correct list variable usage:
add "" to {logschat::%player's uuid%::*}

#Correct list variable looping:
loop {logscommand::%{_arg1uuid}%::*}:
'::*' signifies that its a list variable representing all values inside that list.
 
Status
Not open for further replies.