Remove player name from TABLIST

  • 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 our Wiki for downloads and any other information about Skript!

Status
Not open for further replies.

LoneElf

Active Member
Apr 30, 2017
165
2
18
24
So, I am making a /spy command for my staff, but I need it to hide them from the players which I have done, but I need it to hide them from the player list because they are still on the server, just invisible. I've searched the documentations, but couldn't find exactly what I wanted. I have found something like, wipe player tablist score or something like that, but didn't work :/ Some help would be great, and please, if needed, tell me what SK ADDONS I need for this! :emoji_slight_smile: Thank you!
 
MundoSK has the following effect:
code_language.skript:
(show|hide) %players% in tablist of %player%
an example:
code_language.skript:
hide all players in tablist of player
You need ProtocolLib properly to make this effect work.
 
This doesn't seem to work :/ I want the player that has spy enabled to be hidden from everyone else's tablist. Any other suggestions?
 
code_language.skript:
hide player in tablist of all players
If that doesn't work
code_language.skript:
loop all players:
    hide player in tablist of loop-player
 
This doesn't seem to work :/ I want the player that has spy enabled to be hidden from everyone else's tablist. Any other suggestions?
If it doesn't work then it's because you didn't do it right. Make sure to download the versions I liked above and if you have done it as Donut showed above.
 
Thanks guys - Its not that it showed an error, its just that it didn't hide the player from the others. I'll see if Donut's code works soon - Thanks guys :emoji_slight_smile:
[doublepost=1498671948,1498663814][/doublepost]Ok - Doesn't work :/ Here is my full code:
code_language.skript:
command /stoggle <player>:
    trigger:
        if {spy.enable.%arg 1%} is false:
            set {spy.enable.%arg 1%} to true
            set {player.group.%uuid of arg 1%} to arg 1's group
            broadcast "&8%arg 1% &fhas &cQuit"
            message "&8[&b×&8] &7Spy Mode has been Enabled!" to arg 1
            message "&8[&b×&8] &7Make sure to disable this before leaving!" to arg 1
            message "&8[&b×&8] &7Use /tp to see if players are hacking!" to arg 1
            set {spy.spot.%arg 1%} to location of arg 1
            make console execute command "/pex user %arg 1% group set Spy-Mode"
            make console execute command "/gamemode spectator %arg 1%"
            loop all players:
                hide arg 1 in tablist of loop-player
[doublepost=1498752132][/doublepost]Bump
[doublepost=1498931518][/doublepost]Bump
 
I kinda expanded your script a bit; you don't have to use it as it is if you don't want to, but it may be a good source for reference.

code_language.skript:
# using a text argument, but making the default argument the player
# this will allow us to use sub-command, while still allowing a player argument
command /stoggle [<text="%player%">]:
    permission: spy.toggle
    trigger:
        # allows us to use "text" argument, while preserving player argument
        set {_player} to arg 1 parsed as player
     
        if {_player} is online:
            # if this is the first time the player has ran the command
            if {spy.enable::%{_player}%} is not set:
                set {spy.enable::%{_player}%} to false

            # if player is not in spy-mode, make it so
            if {spy.enable::%{_player}%} is false:
                # using list for looping
                set {spy.enable::%{_player}%} to true
                broadcast "&8%{_player}% &fhas &cQuit"
                message "&8[&b×&8] &7Spy Mode has been Enabled!" to {_player}
                message "&8[&b×&8] &7Make sure to disable this before leaving!" to {_player}
                message "&8[&b×&8] &7Use /tp to see if players are hacking!" to {_player}
                set {spy.loc::%{_player}%} to location of {_player}
                # console commands do not have leading slash "/"
                execute console command "gamemode spectator %{_player}%"
                loop all players:
                    hide {_player} in tablist of loop-player
            # else, if spy-mode is active
            else:
                set {spy.enable::%{_player}%} to false
                broadcast "&8%{_player}% &fhas &9Join"
                message "&8[&b×&8] &7Spy Mode has been Disabled!" to {_player}
                execute console command "gamemode survival %{_player}%"
                loop all players:
                    # I am unsure why, but we need a delay here
                    wait 5 ticks
                    show {_player} in tablist of loop-player
     
        # list players who are in spy-mode
        if arg 1 is "list":
            loop {spy.enable::*}:
                # If your variables use UUID:
                add (player from "%loop-index%") to {_spies::*}
                # else, use this:
                #add loop-index to {_spies::*}
            message "&8[&b×&8] &7Spies: &c%{_spies::*}%" to player
             
on logout:
    # saving if a player logs out with spy-mode
    if {spy.enable::%player%} is true:
        set {spy.logout::%player%} to true
     
on login:
    # wait a few ticks
    wait 5 ticks
    # if the player logged out with spy-mode active
    if {spy.logout::%player%} is true:
        # change remove them from spectator
        execute console command "gamemode survival %player%"
        # reset variables to false
        set {spy.logout::%player%} to false
        set {spy.enable::%player%} to false
 
    # if a new player logs in while someone is hidden
    loop all players:
        # if it finds someone who is hidden
        if {spy.enable::%loop-player%} is true:
            # hides that player from the newly logged in player
            hide loop-player in tablist of player
I did remove the pex permissions things, as that's probably not a great idea (in my opinion), especially when there are many different ways to check if someone has the spy-mode activated.


I believe the only addons you may require to use this is MondoSK for the tablist stuffs, but I may be wrong.
 
Last edited by a moderator:
Thanks a lot man! One thing that doesn't work - When I do /spy to disable it, it doesn't show the player's name back again. Thanks for your help man! :emoji_slight_smile:
 
No problem :emoji_thumbsup:

Hmm; yeah, I was having that problem was well; however, adding the tick delay before showing the spy to the players seemed to fix it for me. Maybe try adding more of a delay?
 
Hmm, that is odd; but do not fret, as there are multiple ways to do a single thing! Granted, there's limited ways, but multiple nonetheless!

Try this:
code_language.skript:
            # else, if spy-mode is active
            else:
                set {spy.enable::%{_player}%} to false
                broadcast "&8%{_player}% &fhas &9Join"
                message "&8[&b×&8] &7Spy Mode has been Disabled!" to {_player}
                execute console command "gamemode survival %{_player}%"
                add all players to {_test::*}
                loop {_test::*}:
                    wait 5 tick
                    set ("%loop-value%" parsed as player)'s tablist contains players to true
                    loop {spy.enable::*}:
                        {spy.enable::%loop-index-2%} is true
                        hide ("%loop-index-2%" parsed as player) in tablist of ("%loop-value-1%" parsed as player)
 
So, I figured something out that which is why my hiding thing didn't work before, and it is because when you are in vanish mode, your name is like this: LoneElf, which is why it didn't hide it. I changed it and made it make me into gamemode 3, then gamemode 0 after 1 tick, then gamemode 3 again after 1 tick. Just saying that because some people might have the same issue as I did. So, the code you gave me above doesn't show me again in the TABLIST. Thanks! :emoji_slight_smile:
[doublepost=1499041250,1499024626][/doublepost]Would I do the opposite for disabling it? I don't really understand - I have tried switching gamemodes like how I did for enabling it, but doesn't seem to work :/
 
Hmm; honestly, I'm not exactly sure. I was having a similar issue where, when I disabled it, I wouldn't reappear in the tablist; however, for me and my server, just adding the delay seemed to fix it. This was on a test server, with me being on, and a separate account being on to see the tablist from another player's view. The different methods I've been coming up with all do the same thing, but in a different way. If none of them are working, I can only suggest trying to figure out a different solution. Just saying that if anyone else has any ideas.
 
Thanks for your time bro - I really appreciate it - Please, and I say, Please - If you have any ideas, post it here! It doesn't matter if you think its wrong because thats why I'm here! Because I was wrong, so now I need your help. Thanks guys! :emoji_slight_smile:
[doublepost=1499398971,1499049550][/doublepost]I've kind of given up on this and just downloaded SuperVanish which works great! :emoji_slight_smile: Thanks everyone for the help. I really appreciate it! :emoji_grinning: Have a nice summer!
 
Status
Not open for further replies.