How do you make is so that the player info updates when the ui is shown, for instance when the ui is shown the ping doesn't update and when i die the kills/deaths don't update, it only updates when the ui is hidden and re-shown.
Code is use:
local Scoreboard = nil
local PlayerList = nil
function GM:ScoreboardShow()
if !IsValid(Scoreboard) then
Scoreboard = vgui.Create("DFrame")
Scoreboard:SetSize( 750, 500 )
Scoreboard:SetPos(ScrW() / 2 - 325,ScrH() / 2 - 250)
Scoreboard:SetTitle("Scoreboard")
Scoreboard:SetDraggable(false)
Scoreboard:ShowCloseButton(false)
Scoreboard:SetVisible( true )
Scoreboard.Paint = function()
-- Paint
end
local PlayerScrollPanel = vgui.Create("DScrollPanel", Scoreboard)
PlayerScrollPanel:SetSize(Scoreboard:GetWide(), Scoreboard:GetTall() -20)
PlayerScrollPanel:SetPos(0,20)
PlayerList = vgui.Create("DListLayout", PlayerScrollPanel)
PlayerList:SetSize(PlayerScrollPanel:GetWide(), PlayerScrollPanel:GetTall() )
PlayerList:SetPos(0,0)
end
if IsValid(Scoreboard) then
PlayerList:Clear()
for k,v in pairs(player:GetAll()) do
local PlayerPanel = vgui.Create("DPanel", PlayerList)
PlayerPanel:SetSize(PlayerList:GetWide(), 50)
PlayerPanel:SetPos(0,0)
PlayerPanel.Paint = function()
-- Paint
end
end
end
Scoreboard:Show()
Scoreboard:MakePopup()
Scoreboard:SetKeyboardInputEnabled(false)
end
function GM:ScoreboardHide()
if IsValid( Scoreboard ) then
Scoreboard:Hide()
end
end
You can use
this
inside
PlayerPanel.Paint = function()
end
Thats what im using
https://gist.github.com/f1ndme/5651385#file-sh_simplescoreboard-lua-L97-L139
That should help you to fix the update thing. I'm assuming what you want is the scoreboard to constantly update every few seconds whilst it is active?
Sorry, you need to Log In to post a reply to this thread.