Solved Reset a variable of all offline players

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

Sqadow

New Member
May 29, 2021
7
0
1
24
I need to reset {player.Balance::%player%} of every offline player how can I do that pls help me!
 
Code:
loop all offline players:
    if all players does not contain loop-offline player:
        clear {player.Balance::%loop-offline player%}

remember, loop offline players loops ALL players that ever joined, including online players.
so that is why you check if they are online before clearing the variable.

edit:
"all players" are however only those that are online, that is why this should work

(yes, it would make more sense the other way around, with all players and online players. but that would make much more people make errors as they would be trying to do something for all players, forgetting to put online)
 
It only resets online players their bal, but i solved it


command /clearmoney <offlineplayer>:
permission: group.owner
trigger:
clear {player.Balance::%arg-1%}

I typed /clearmoney * in chat
 
Last edited:
I know this has been solved, but this would be an alternative solution without a command
Code:
loop {player.Balance::*}:
    if loop-value is not online:
        delete {player.Balance::%loop-value%}
 
Status
Not open for further replies.