Hi, so I made a skript that allow you to see how many hours, minutes and seconds of total playtime you have. So I want to add command that will allow you to check how many hours etc other player have.
Code (Text): variables: {s.%player%} = 0 {m.%player%} = 0 {h.%player%} = 0 every second: loop all players: add 1 to {s.%loop-player%} if {s.%loop-player%} is 60: subtract 60 from {s.%loop-player%} add 1 to {m.%loop-player%} if {m.%loop-player%} is 60: subtract 60 from {m.%loop-player%} add 1 to {h.%loop-player%} command /czasgry: executable by: players trigger: send "&7Grasz &c&l%{h.%player%}% &r&7godzin &c&l%{m.%player%}% &r&7minut &c&l%{s.%player%}% &r&7sekund." to player Here's code. What do I have to add?
okay that's a lot of wrong here... I have rewrited it with better practices: Code (Text): on join: while player is online: wait a second add 1 to {_s} if {_s} is 60: set {_s} to 0 add 1 to {m::%uuid of player%} if {m::%uuid of player%} is 60: set {m::%uuid of player%} to 0 add 1 to {h::%uuid of player%} command /playtime <offline player>: trigger: if "%arg 1%" parsed as a player is offline: set {_uuid} to uuid of "%arg 1%" parsed as offline player else: set {_uuid} to uuid of "%arg 1%" parsed as a player send "Hours: %{h::%{_uuid}%} ? 0% Minutes: %{m::%{_uuid}%} ? 0%" I wasn't sure how you want UUIDS to be handled, so I made it this way, not sure if the best, I'd make UUID to NAME resolver variables usually what I changed: - Changed player names into UUIDS - Removed variables: part, it is useless, you can use "%{_var} ? 0%" to default it to 0 in messages - Replaced loop into while player is online, that is better in my opinion - started using list variables instead of dot variables, because they are better