Hello FP
I’m trying to make a list, and when i click a player on the list, it’ll show their stats. The issue I’m getting is if I click on another player, or myself again, it’ll just keep re-drawing the text over each other. Is there any solution to prevent this?
[LUA]
function scBounties.wantedList()
local Frame = vgui.Create( “DFrame” )
Frame:SetPos( ScrW()/3, 50 )
Frame:SetSize( 400, 350 )
Frame:SetTitle( “Altis Bounties” )
Frame:SetVisible( true )
Frame:SetDraggable( false )
Frame:ShowCloseButton( true )
Frame:MakePopup()
//the bar background
Frame.list = vgui.Create("DListView",Frame)
Frame.list:Dock(FILL)
Frame.list:SetWide(50)
Frame.list:AddColumn("Name")
Frame.list:SetMultiSelect(false)
Frame.list:DockMargin(10,10,Frame:GetWide()/2,10)
for k, v in pairs ( player.GetAll() ) do
local newline = Frame.list:AddLine(v:Nick(),team.GetName( v:Team() ))
newline.v = v
Frame.list.OnRowSelected = function( rowindex, row )
local lineElement = Frame.list:GetLine(Frame.list:GetSelectedLine())
local selectedPlayer = lineElement.v
print("Player Selected : " .. tostring(selectedPlayer) .. tostring(row))
scBounties.showCrimes(Frame, selectedPlayer, row)
end
end
end
function scBounties.showCrimes(Frame, pl, row)
local oldD = nil
local newD = row
if newD == oldD then oldD = row return end
Frame.Info = vgui.Create("DLabel", Frame)
Frame.Info:SetPos(0,50)
Frame.Info:AlignLeft(200)
Frame.Info:SetText("Avalible Bounties: " .. tostring(pl))
Frame.Info:SetTextColor(color_black)
end
[/LUA]
Help will be appreciated a lot, thanks.