- Initiateur de la discussion
thepsyca
Psychopathe
- Messages
- 2 164
- Score réaction
- 648
- Points
- 365
Bonsoir,
Je souhaite AddLine à une DListView seulement celle-ci ne m'affiche pas les "nom" mais les prend bien en compte :
Les codes :
Je souhaite AddLine à une DListView seulement celle-ci ne m'affiche pas les "nom" mais les prend bien en compte :
Les codes :
Code:
local Bcl = vgui.Create("DButton", frame1) Bcl:SetSize(200, 30) Bcl:SetPos(235, 150) Bcl:SetText("Voir les données npc") Bcl:SetFont("fontclose") Bcl:SetTextColor(Color(255, 255, 255, 255)) Bcl.Paint = function(self, w, h) local kcol if self.hover then kcol = Color(255, 150, 150, 255) else kcol = Color(175, 100, 100) end draw.RoundedBoxEx(0, 0, 0, w, h, Color(255, 150, 150, 255), false, false, true, true) draw.RoundedBoxEx(0, 1, 0, w - 2, h - 1, kcol, false, false, true, true) end Bcl.DoClick = function() ShowDataNPC() net.Start("findbotdata") net.SendToServer(ply) end Bcl.OnCursorEntered = function(self) self.hover = true end Bcl.OnCursorExited = function(self) self.hover = false end
Code:
local function ShowDataNPC()
local frame1 = vgui.Create("DFrame") frame1:SetTitle("") frame1:SetSize(400, 300) frame1:SetAlpha(0) frame1:AlphaTo(255, 0.25) frame1:Center() frame1:ShowCloseButton(true) frame1:MakePopup() frame1.Paint = function(self, w, h) draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 255)) draw.RoundedBox(0, 0, 0, w, 30, Color(226, 0, 0, 250)) draw.DrawText("NLF BOT : Données BOT", "nlf_bot_textprincipal", self:GetWide() / 2, 4, color_white, TEXT_ALIGN_CENTER) surface.SetDrawColor(0, 0, 0) surface.DrawOutlinedRect(0, 0, w, h) end local DataBotList = vgui.Create("DListView", frame1) DataBotList:Dock(FILL) DataBotList:DockMargin(5, 5, 5, 5) DataBotList:SetWidth(565) DataBotList:SetMultiSelect(false) DataBotList:AddColumn("Nom du bot") DataBotList.OnRowRightClick = function(DataBotList, line) local DropDown = DermaMenu() DropDown:AddOption(nlf.bot.config.llanguage[loc].nlfbotl62, function() BotDelete = tostring(DataBotList:GetLine(line):GetValue(1)) net.Start("deleteonedataclient") net.WriteString(BotDelete) net.SendToServer(ply) DataBotList:Clear() end) DropDown:AddSpacer() DropDown:Open() end net.Receive("sendbotdata", function() local Namebot = net.ReadString() DataBotList:Clear() timer.Simple( 1, function() DataBotList:AddLine(NameBot) end) end)
end
Code:
net.Receive("findbotdata", function(len, pl) for k, v in pairs(file.Find("nlf/" .. string.lower(game.GetMap()) .. "/*.txt", "DATA")) do local string_sub1 = string.gsub(tostring(v), "nlf/" .. string.lower(game.GetMap()) .. "/npc_", "" )
local string_sub2 = string.gsub(string_sub1, ".txt", "" ) print(string_sub2) net.Start( "sendbotdata" ) net.WriteString(string_sub2) net.Send(pl) end
end)
Dernière édition: