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 configif ply:IsPlayer() then
net.Start("openuser")
net.WriteBool(ply:IsPlayer())
net.Send(ply)
endreturn""endend)
hook.Add("PlayerSay","OFA",function(ply, txt)if txt == "!reports"or txt == "/reports"then-- für configif 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)
endreturn""endend)
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!
There's no "Tablee1" nowhere in the code you shown us, also next time try to bold the line that's erroring
@G😹nz😻 I tried to create a table with the string from the TextEntry and the value of the ComboBox (RDM, RDA, Other) and send it to the server. I could do "net.WriteString" for TextEntry but this doesn't work for the ComboBox
I'm really confused xd.
@G😹nz😻 Doesn't work. Anyway I just deleted the ComboBox from the code and decided to just keep the TextEntry. So I tried to add something else but there is some issue...
important code:
client (user):
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:SetUpdateOnType(true)
reason:SetVerticalScrollbarEnabled( true )
reason.OnValueChange = function(self)
information = self:GetValue()
end
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.SendToServer()
net.Start("info")
net.WriteString(information)
net.SendToServer()
end
client (admin):
local reportlist = vgui.Create("DListView", Panelgrey)
reportlist:Dock( FILL )
reportlist:SetMultiSelect( false )
reportlist:AddColumn("Test")
net.Receive("reports", function(length,ply)
Table = net.ReadTable()
for k,v in pairs(Table) do
reportlist:AddLine(v)
end
reportlist.OnRowSelected = function()
reportss = vgui.Create("DFrame")
reportss:Center()
reportss:MakePopup()
reportss:SetSize(250,150)
end
local net.Receive("infoo", function(len,ply)
tex = net.ReadString()
infor = vgui.Create("RichText", reportss)
infor:AppendText(tex)
end)
end)
server:
reports = {}
net.Receive("reporthandler", function(Lenght, ply)
table.insert(reports , ply:Nick() .. " has sent a report.")
end)
local net.Receive("info", function(len,ply)
information = net.ReadString()
net.Start("infoo")
net.Send(ply)
end)
screens:
https://files.facepunch.com/forum/upload/309258/ebf96d85-40ec-4e3e-a84c-a988c6ad51e0/Screenshot_72.png
https://files.facepunch.com/forum/upload/309258/d3381144-694f-4772-a569-cd5f9f759d04/Screenshot_73.png
https://files.facepunch.com/forum/upload/309258/5586301f-dd8b-4d3d-afcd-dfaffb8002b3/Screenshot_74.png
The problem is now when I click a row the frame will pop up but not even centerd and the text is missing. I hate it when I'm just asking you or other persons but I really was trying to fix this shit, but I'm to dumb. I really appreciate that your support!
Why are you putting local before net.Receive? Local is to define local variables or functions, and what you're doing is call the function net.Receive, and I believe that is your problem
I don't know why I did that, but it's still not fixed haha
Are you still getting the same error?
Can we see the code you have now?
Sorry, you need to Log In to post a reply to this thread.