Jump to content

Skript vanish code it doesnt remove 1 from online players (in the scoreboard)


UNICE1

Recommended Posts

command /vanish:
  permission: staff.vanish
  trigger:
    if {vanish::%player%} is true:
      set {vanish::%player%} to false
      reveal player to all players
      set action bar of player to " "
      broadcast "&8[&a+&8]&r %player's prefix%%player%"
      send "&cStaff&a >> &7%player's display name% &aUnvanished" to all players where [input has permission "staff.vanish"]
      make console execute "ev %player%"
      add 1 to {playersonline}
    else:
      set {vanish::%player%} to true
      hide player from all players
      broadcast "&8[&c-&8]&r %player's prefix%%player%"
      send "&cStaff&a >> &7%player's display name% &cVanished" to all players where [input has permission "staff.vanish"]
      make console execute "ev %player%"
      set action bar of player to "&fYOU ARE &cVANISHED"
      subtract 1 from {playersonline}



on quit:
  delete {vanish::%player%}

thats my vanish code and i cant find the problem everything works fine except that
 

every 1 second:
  loop all players:
    set {playersonline} to number of all players
    wipe loop-player's sidebar
    set name of sidebar of loop-player to "&3UniceBox"
    set score "&6--------------------" in sidebar of loop-player to 6
    set score "&3Player: %loop-player%" in sidebar of loop-player to 5
    set score "&3" in sidebar of loop-player to 4
    set score "&3online players: %{playersonline}% " in sidebar of loop-player to 3
    set score "&3unique joins: %{joincounter}%" in sidebar of loop-player to 2
    set score "&6---------------------" in sidebar of loop-player to 1

and thats my scoreboard code
 

Link to comment
Share on other sites

4 hours ago, UNICE1 said:
command /vanish:
  permission: staff.vanish
  trigger:
    if {vanish::%player%} is true:
      set {vanish::%player%} to false
      reveal player to all players
      set action bar of player to " "
      broadcast "&8[&a+&8]&r %player's prefix%%player%"
      send "&cStaff&a >> &7%player's display name% &aUnvanished" to all players where [input has permission "staff.vanish"]
      make console execute "ev %player%"
      add 1 to {playersonline}
    else:
      set {vanish::%player%} to true
      hide player from all players
      broadcast "&8[&c-&8]&r %player's prefix%%player%"
      send "&cStaff&a >> &7%player's display name% &cVanished" to all players where [input has permission "staff.vanish"]
      make console execute "ev %player%"
      set action bar of player to "&fYOU ARE &cVANISHED"
      remove 1 from {playersonline}



on quit:
  delete {vanish::%player%}

thats my vanish code and i cant find the problem everything works fine except the remove 1
 

every 1 second:
  loop all players:
    set {playersonline} to number of all players
    wipe loop-player's sidebar
    set name of sidebar of loop-player to "&3UniceBox"
    set score "&6--------------------" in sidebar of loop-player to 6
    set score "&3Player: %loop-player%" in sidebar of loop-player to 5
    set score "&3" in sidebar of loop-player to 4
    set score "&3online players: %{playersonline}% " in sidebar of loop-player to 3
    set score "&3unique joins: %{joincounter}%" in sidebar of loop-player to 2
    set score "&6---------------------" in sidebar of loop-player to 1

and thats my scoreboard code
 

 

Link to comment
Share on other sites

  • 2 weeks later...

In your code, you set {playersonline} to the size of all players, what you should do instead is get the size of the vanish variable and remove it from {playersonline} afterwards
i.e.
 

set {playersonline} to size of all players
remove (size of {vanish::*}) from {playersonline}

 

 

 

image.png.bc433d6489d70ad831075fe76809b993.png
 

Owner of Lifestealed, Labs, Encore, UNOfficially and Observed
 

OG [VIP] 12/26/20 - 10/27/2021
OG [PRO] 12/27/21 - 11/18/2022
OG [LEGEND] 11/18/2022 - 3/14/2023
[DEFAULT] 3/14/2023 - 5/8/2024

[MOD] 5/8/2024 - Present

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...