• Question about networking again xd
    1 replies, posted
Code: Server-side: util.AddNetworkString("openuser") util.AddNetworkString("openadmin") util.AddNetworkString("notadmin") util.AddNetworkString("reporthandler") util.AddNetworkString("reports") reports = {} net.Receive("Reporthandler", function(Lenght, ply) Tablee = net.ReadTable() table.insert(reports , ply:Nick().." has sent a reoport. The reason: ".. Tablee .. ) end) hook.Add("PlayerSay", "OFU", function(ply, txt) if txt == "/repor" or txt == "!repor" then -- für config if ply:IsPlayer() then     net.Start("openuser")     net.WriteBool(ply:IsPlayer())     net.Send(ply)     end     return ""     end end) hook.Add("PlayerSay","OFA",function(ply, txt) if txt == "!reports" or txt == "/reports" then -- für config if ply:IsAdmin() then net.Start("openadmin") net.WriteBool(ply:IsAdmin()) net.Send(ply) net.Start("reports") net.WriteTable(reports) net.Send(ply) else net.Start("notadmin") net.Send(ply) end return"" end end) Client-side: net.Receive("openuser",function() local user = net.ReadBool() if (user) then frame1 = vgui.Create("DFrame") frame1:SetSize(500,300) frame1:Center() frame1:SetVisible(true) frame1:MakePopup() frame1:ShowCloseButton(false) frame1:SetTitle("") frame1.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w ,h,Color(25,25,25)) end Panelgrey = vgui.Create("DPanel", frame1) Panelgrey:SetPos(5, 30) Panelgrey:SetSize(490,235) Panelgrey.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(40,40,40)) end selection = vgui.Create("DComboBox", Panelgrey ) selection:SetPos(100 , 7) selection:SetSize( 200, 20 ) selection:SetValue( "Reason" ) selection:AddChoice( "RDM" ) selection:AddChoice( "RDA" ) selection:AddChoice( "Other" ) selection.OnSelect = function(self) reasonreport = self:GetValue() end Paneltop = vgui.Create("DPanel", frame1) Paneltop:SetPos(0,0) Paneltop:SetSize(500,25) Paneltop.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end reason = vgui.Create("DTextEntry",Panelgrey) reason:SetPos(5,70) reason:SetSize(480,125) reason:SetFont("LabelFont1") reason:AllowInput(true) reason:SetMultiline(true) reason:SetEditable ( true ) reason:SetDrawLanguageID(false) reason:SetVerticalScrollbarEnabled( true ) reason.OnSelect = function(self) information = self:GetValue() end Table1 = {} Table1[1] = reasonreport Table1[2] = information buttonsend=vgui.Create("DButton",frame1) buttonsend:SetPos(370,270) buttonsend:SetSize(125,25) buttonsend:SetText("") buttonsend.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end buttonsend.DoClick = function() net.Start("reporthandler") net.WriteTable(Table1) net.SendToServer() end local buttonclose=vgui.Create("DButton",frame1) buttonclose:SetPos(5,270) buttonclose:SetSize(125,25) buttonclose:SetText("") function buttonclose:DoClick() frame1:Close() end buttonclose.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end labelclose=vgui.Create("DLabel",buttonclose) labelclose:SetText("Close") labelclose:SetFont("LabelFont1") labelclose:SizeToContents(5) labelclose:Center() labelclose:SetTextColor(Color(255,255,255)) labeltop=vgui.Create("DLabel",Paneltop) labeltop:SetText("You're reporting a player.") labeltop:SetFont("LabelFont1") labeltop:SizeToContents(5)  labeltop:Center() labeltop:SetTextColor(Color(255,255,255)) label=vgui.Create("DLabel",buttonsend) label:SetText("Submit") label:SetFont("LabelFont1") label:SizeToContents(5)  label:Center() label:SetTextColor(Color(255,255,255)) labelreason = vgui.Create("DLabel", Panelgrey) labelreason:SetPos(5, 5) labelreason:SetText("Reason: ") labelreason:SetFont("LabelFont1") labelreason:SizeToContents(5)  labelreason:SetTextColor(Color(255,255,255)) labelinformation = vgui.Create("DLabel", Panelgrey) labelinformation:SetPos(5, 45) labelinformation:SetText("More Information") labelinformation:SetFont("LabelFont1") labelinformation:SizeToContents(5)  labelinformation:SetTextColor(Color(255,255,255)) end end) Client-side (admin): net.Receive("openadmin", function() local admin = net.ReadBool() if (admin) then frame1 = vgui.Create("DFrame") frame1:SetSize(500,300) frame1:Center() frame1:SetVisible(true) frame1:MakePopup() frame1:ShowCloseButton(false) frame1:SetTitle("") frame1.Paint = function(self,w,h)  draw.RoundedBox(0,0,0,w ,h,Color(25,25,25)) end Panelgrey = vgui.Create("DPanel", frame1) Panelgrey:SetPos(5, 30) Panelgrey:SetSize(490,235) Panelgrey.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(40,40,40)) end local reportlist = vgui.Create("DListView", Panelgrey) reportlist:Dock( FILL ) reportlist:SetMultiSelect( false ) reportlist:AddColumn("Gay") net.Receive("reports", function(length,ply) Table = net.ReadTable() for k,v in pairs(Table) do reportlist:AddLine(v) end end) Paneltop = vgui.Create("DPanel", frame1) Paneltop:SetPos(0,0) Paneltop:SetSize(500,25) Paneltop.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end labelsupport = vgui.Create("DLabel", frame1) labelsupport:SetText("Support") labelsupport:SetFont("LabelFont1") labelsupport:SizeToContents(5) labelsupport:SetPos(0,0) labelsupport:SetTextColor(Color(255,255,255)) local buttonclose=vgui.Create("DButton",frame1) buttonclose:SetPos(5,270) buttonclose:SetSize(125,25) buttonclose:SetText("") function buttonclose:DoClick() frame1:Close() end buttonclose.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end labelclose=vgui.Create("DLabel",buttonclose) labelclose:SetText("close") labelclose:SetFont("LabelFont1") labelclose:SizeToContents(5) labelclose:Center() labelclose:SetTextColor(Color(255,255,255)) end end) Evening, what I'm trying to do is, when the user press the "submit-button" it will send a table with the reason (ComboBox) and the information (TextEntry) to the server. The server will send it to the admin-panel and there will be created a new line with the information wich should look like that: Player1 has sent a reoport. The reason: (reason) (information). I know the text wont look like that because I didn't set that up yet but I hope you know what I mean. My problem is know. I messed up something and I don't know how to fix that . Error msg: https://files.facepunch.com/forum/upload/309258/e3de48a8-9d55-4045-a827-88c302b99da4/Screenshot_71.png Thanks in advance!
net.Receive("Reporthandler", function(Lenght, ply) Tablee = net.ReadTable() table.insert(reports , ply:Nick().." has sent a reoport. The reason: ".. Tablee .. ) Tablee is a table and you're trying to concatenate it, as the error message says. Try Tablee[1] which will be the 'reason' column
Sorry, you need to Log In to post a reply to this thread.