• My frame doesn't open
    5 replies, posted
Hello, I just came back to "coding" and have problem I cant't solve. Code (clientside): AddCSLuaFile("sptuser.lua") surface.CreateFont( "LabelFont1", { font = "Arial", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 25, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "TextFont", { font = "Tahoma", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name extended = false, size = 15, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) -- GUI 1 (support send (user)) local frame=vgui.Create("DFrame") local buttonsend=vgui.Create("DButton",frame) --button send buttonsend:SetPos(5,275) buttonsend:SetSize(300,20) buttonsend:SetText("") buttonsend.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(176,23,31)) end local label=vgui.Create("DLabel",frame) label:SetText("support") label:SetFont("LabelFont1") label:SizeToContents() label:SetPos(5,-2) label:SetTextColor(Color(255,255,255)) local button=vgui.Create("DButton",frame) --button close button:SetPos(310,275) button:SetSize(185,20) button:SetText("") function button:DoClick() frame:Close() end button.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(176,23,31)) end local label=vgui.Create("DLabel",buttonsend) --label send label:SetText("send ticket") label:SetFont("LabelFont1") label:SizeToContents(5)  label:Center() label:SetTextColor(Color(255,255,255)) local TextEntry = vgui.Create( "DTextEntry", frame ) -- create the form as a child of frame TextEntry:SetPos( 4, 90  ) TextEntry:SetSize( 490, 180 ) TextEntry:SetText( "description" ) TextEntry:SetFont("TextFont") TextEntry:AllowInput(true) TextEntry:SetMultiline(true) TextEntry:SetEditable ( true ) TextEntry:SetDrawLanguageID(false) TextEntry:SetVerticalScrollbarEnabled( true ) local label=vgui.Create("DLabel",button) --label close label:SetText("close") label:SetFont("LabelFont1") label:SizeToContents(5) label:Center() label:SetTextColor(Color(255,255,255)) local DComboBox = vgui.Create( "DComboBox", frame ) DComboBox:SetPos( 5, 30 ) DComboBox:SetSize( 490, 20 ) DComboBox:SetValue( "options" ) DComboBox:AddChoice( "RDM" ) DComboBox:AddChoice( "RDA" ) DComboBox:AddChoice( "AFK" ) DComboBox:AddChoice( "other" ) DComboBox:AddChoice( "stuck" ) DComboBox:SetFont("TextFont") DComboBox.OnSelect = function( panel, index, value ) end frame:SetSize(500,300) frame:Center() frame:SetVisible(true) frame:MakePopup() frame:ShowCloseButton(false) frame:SetTitle("") frame.Paint = function(self,w,h) draw.RoundedBox(0,0,0,w ,h,Color(40,40,40)) --INNEN draw.RoundedBox(0,0,0,w,25,Color(176,23,31)) end -- GUI 2 (support selcetion) local frame1=vgui.Create("DFrame") local button1=vgui.Create("DButton", frame1) --button close button1:SetPos(395,275) button1:SetSize(100,20) button1:SetText("") button1.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(176,23,31)) end function button1:DoClick() frame1:Close() end richtext =vgui.Create("RichText",frame1) richtext:SetSize(295,240) richtext:SetPos(200,30) richtext:SetVerticalScrollbarEnabled(false) richtext:SetText("messages") richtext.Paint=function(self,w,h) draw.RoundedBox(0,0,0,295,240,Color(25,25,25)) end local label=vgui.Create("DLabel",button1) --label close label:SetText("close") label:SetFont("LabelFont1") label:SizeToContents() label:Center() label:SetTextColor(Color(255,255,255)) local buttonaccept=vgui.Create("DButton",frame1) --button accept buttonaccept:SetPos(290,275) buttonaccept:SetSize(100,20) buttonaccept:SetText("") buttonaccept.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(176,23,31)) end local LabelAccept=vgui.Create("DLabel",buttonaccept) --label accept LabelAccept:SetText("accept") LabelAccept:SetFont("LabelFont1") LabelAccept:SizeToContents()  LabelAccept:Center() LabelAccept:SetTextColor(Color(255,255,255)) local label=vgui.Create("DLabel",frame1) label:SetText("support") label:SetFont("LabelFont1") label:SizeToContents() label:SetPos(5,-2) label:SetTextColor(Color(255,255,255)) 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(40,40,40)) --INNEN draw.RoundedBox(0,0,0,w,25,Color(176,23,31)) end code (serverside): hook.Add("PlayerSay","Rtd", function (ply,message,public) if !IsValid(ply) then return end mes = string.lower( message ) if mes == "/help"or mes == "!help"then ply:ConCommand( "guihelp" ) end hook.Add("PlayerSay","Rtd1", function (ply,message,public) if !IsValid(ply) then return end mes = string.lower( message ) if mes == "/helpa"or mes == "!helpa"then ply:ConCommand( "guihelpp" ) end My problem is now there is no error but when I put my command (/help) in chat it just don't open the frame I just want to come back to coding but just forgot very much about it. It would be very nice if you could help me out with that. Kind regards, Lvxye
You haven't put the "GUI 1" or "GUI 2" in any function. Therefor you can't call the function. You are just running a console command which probably doesn't even exist because I don't see it defined anywhere. You should also network it instead of using a concommand. Example: if CLIENT then net.Receive( "networkstringnamething", function( len, pl ) openmydermamenu() -- call the function and create the derma end) function openmydermamenu() local Frame = vgui.Create( "DFrame" ) Frame:Center() Frame:SetSize( 300, 100 ) Frame:SetTitle( "Example Derma" ) Frame:SetVisible( true ) Frame:SetDraggable( false ) Frame:ShowCloseButton( true ) Frame:MakePopup() end else -- network it here with the command end You can read more stuff here: Derma Basic Guide Net Library Usage
ply:ConCommand( "guihelpp" ) Did you even define that Console command for the client? I only see the word guihelp in the serverside code. But not as creation for the client. Also, why do you put the word coding in qoutes? This is coding. There is no need to make it look like its something else .
I need your help once more xd code: server: util.AddNetworkString("openuser") util.AddNetworkString("openadmin") util.AddNetworkString("notadmin") hook.Add("PlayerSay", "OFU", function(ply, txt) if txt == "/test" or txt == "!test" then if ply:IsPlayer() then     net.Start("openuser")     net.WriteBool(ply:IsPlayer())     net.Send(ply)     else     net.Start("openadmin")     net.WriteBool(ply:IsAdmin())     net.Send(ply)     end     return ""     end end) hook.Add("PlayerSay","OFA",function(ply, txt) if txt == "!testa" or txt == "/testa" then if ply:IsAdmin() then net.Start("openadmin") net.WriteBool(ply:IsAdmin()) net.Send(ply) else net.Start("notadmin") net.Send(ply) end return "" end end) client (userframe): net.Receive("openuser",function() local client = net.ReadBool() if (client) 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(40,40,40))  draw.RoundedBox(0,0,0,w,25,Color(141,27,27)) end buttonsend=vgui.Create("DButton",frame1) buttonsend:SetPos(370,275) buttonsend:SetSize(125,20) buttonsend:SetText("") buttonsend.Paint=function(self,w,h) draw.RoundedBox(0,0,0,w,h,Color(141,27,27)) end label=vgui.Create("DLabel",buttonsend) label:SetText("send ticket") label:SetFont("LabelFont1") label:SizeToContents(5)  label:Center() label:SetTextColor(Color(255,255,255)) local buttonclose=vgui.Create("DButton",frame1) buttonclose:SetPos(5,275) buttonclose:SetSize(125,20) 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) client (adminframe): 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(40,40,40))  draw.RoundedBox(0,0,0,w,25,Color(141,27,27)) end local buttonclose=vgui.Create("DButton",frame1) buttonclose:SetPos(5,275) buttonclose:SetSize(125,20) 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) client (notadmin): net.Receive("notadmin",function() chat.AddText( Color(30,144,255),"You don't have permission for that!") end) What it should be doing is that it opens the userframe when you write "!test" or "/test" and the adminframe by "!testa" or "/testa". It will also say "You don't have permssion for that!" when your not an admin and write the command for the adminframe. That works just perfect but now I tried to add something. When youre an admin and try to open the userframe then it will automaticly opens the adminframe. So youre not allowed to open the userframe as an admin. The problemo is when I write as an admin /test it will wtill open the userframe. I tried to figure it out but I didn't found any solution . Thanks in advance!
Looks like you're in the wrong thread but if you followed what I told you in your thread then you'd be fine. Question about opening a derma panel with networking Question about opening a derma panel with networking I don't understand why you just don't use my example for the chat commands. You'd be able to use a table for them quite easily if you used my method with patterns instead of using string.sub and command arguments would be a lot easier to implement.
hook.Add("PlayerSay", "OFU", function(ply, txt) if txt == "/test" or txt == "!test" then if !ply:IsAdmin() then net.Start("openuser") net.WriteBool(ply:IsPlayer()) net.Send(ply) else net.Start("openadmin") net.WriteBool(ply:IsAdmin()) net.Send(ply) end return "" end end) hook.Add("PlayerSay","OFA",function(ply, txt) if txt == "!testa" or txt == "/testa" then if ply:IsAdmin() then net.Start("openadmin") net.WriteBool(ply:IsAdmin()) net.Send(ply) else net.Start("notadmin") net.Send(ply) end return "" end end) I got really confused by what you're trying to say but I think this should work.
Sorry, you need to Log In to post a reply to this thread.