ULX

Author Topic: Making name not appear in Scoreboard spectators list  (Read 1469 times)

0 Members and 3 Guests are viewing this topic.

Offline sirrfuchs

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Making name not appear in Scoreboard spectators list
« on: January 28, 2017, 02:00:19 PM »
I own a TDM Server, and well whenever I get on someone says anything, so I can't really keep an eye on things if everyone knows I'm on and starts behaving you know?

I'm basing this off several minecraft videos that I've watched and servers that have SV --- Super Vanish... The only thing that I want is my name to not appear in the menus / Scoreboard.



I can snippet part of my Current Scoreboard, at least the part that my dev friend says I need to edit.


Code: [Select]
local pos = Vector( red:GetPos() )
spec = vgui.Create( "DPanel" )
spec:SetPos( pos.x, pos.y + ScrH() - ( ScrH() / 8 ) + 3 )
spec:SetSize( 1170, 30 )
spec.Paint = function()
surface.SetDrawColor( 255, 255, 255, 222 )
surface.DrawRect( 0, 0, spec:GetSize() )
surface.SetTextColor( black )
surface.SetTextPos( 5, 5 )
surface.SetFont( "Exo 2 Content" )

local asd = {}
for k, v in next, team.GetPlayers( 0 ) do
table.insert( asd, v:Nick() )

end

surface.DrawText( "Spectators: " .. table.concat( asd, ", " ) )
end

end

function GM:ScoreboardShow()
CreateScoreboard()
end

function GM:ScoreboardHide()
if not ( red and blue ) then
return
end
red:SetVisible( false )
blue:SetVisible( false )
if spec then
spec:SetVisible( false )
end
end

My Dev is taking a break, so I'm taking back over the coding portions, I haven't touched it in a while and I would love some help!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Making name not appear in Scoreboard spectators list
« Reply #1 on: January 28, 2017, 05:14:10 PM »
Code: [Select]
for k, v in next, team.GetPlayers( 0 ) do
table.insert( asd, v:Nick() )

end
That loop in the spec.Paint function is where you'll need to check and make sure you're not inserted.
"v" is a player object, you could use something like an "if v:SteamID() ~= "your:_steamID:here" then table.insert( asd, v:Nick() )"

That would only not show you as a spectator though, from what I can tell from the code.
Be warned though, this will only hide you from TTT spectator menu. There are many other console and even Steam commands, and server info apps that will list who is on a server.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming