[LUA] Need help with making the code work for my server
3 replies, posted
August 2016
1 Posts
Hello dear facepunch users i would need help with my code,
i dont see errors in the logs /server logs but this is the error:
my code works perfectly on singeplayer the command works & the hud works,on the server the commands works but the hud does not work :/ i guess its because i used usg.Start,usg.End, & usermessage.Hook
do you have ideas how i could fix that?
you can feel free to help me Via teamviewer :)
mfg
Alabama
okay this is the part which is not working:
[code]
concommand.Add("DeathMenu",function()
local rs = GetRoundState()
if rs == ROUND_PREP then
umsg.Start("Name")
umsg.End()
end
end)
local function Menu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 250, 200 )
DermaPanel:SetTitle("")
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( false )
DermaPanel:Center( true )
DermaPanel:MakePopup()
DermaPanel.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 160 ) )
end
local DermaLabel = vgui.Create("DLabel", DermaPanel)
DermaLabel:SetText("?")
DermaLabel:SetContentAlignment(5)
DermaLabel:SetPos(27,20)
DermaLabel:SetFont("Trebuchet18")
DermaLabel:SizeToContents()
DermaLabel:SetColor(Color(25,255,25,255))
local DermaLabel2 = vgui.Create("DLabel", DermaPanel)
DermaLabel2:SetText("V1")
DermaLabel2:SetContentAlignment(7)
DermaLabel2:SetPos(50,5)
DermaLabel2:SetFont("DebugFixed")
DermaLabel2:SizeToContents()
DermaLabel2:SetColor(Color(238,228,51,255))
local DermaLabel3 = vgui.Create("DLabel", DermaPanel)
DermaLabel3:SetText("Made by:")
DermaLabel3:SetContentAlignment(7)
DermaLabel3:SetPos(7,175)
DermaLabel3:SetFont("DebugFixed")
DermaLabel3:SizeToContents()
DermaLabel3:SetColor(Color(238,228,51,255))
local DermaLabel4 = vgui.Create("DLabel", DermaPanel)
DermaLabel4:SetText("europe")
DermaLabel4:SetContentAlignment(7)
DermaLabel4:SetPos(160,175)
DermaLabel4:SetFont("DebugFixed")
DermaLabel4:SizeToContents()
DermaLabel4:SetColor(Color(238,228,51,255))
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton:SetText( "Ja" )
DermaButton:SetPos( 50, 50 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
RunConsoleCommand("Doitnowlol") -- führt den Consolenbefehl aus
end
DermaButton.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
local DermaButton2 = vgui.Create( "DButton" )
DermaButton2:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton2:SetText( "Nein" )
DermaButton2:SetPos( 50, 115 )
DermaButton2:SetSize( 150, 50 )
DermaButton2.DoClick = function ()
DermaPanel:Close()
end
DermaButton2.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
end
usermessage.Hook("Name",Menu)[/code]
as i said works perfectly on singleplayer but not on the server :(
[editline]11th August 2016[/editline]
bump added code
DFrame and such won't work serversided. Place the code in a client/server ONLY file, or use if server, client then.
You don't need to use usermessages at all. Concommands can be completely clientside. Try putting this in a clientside file:
[CODE]
local function Menu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 250, 200 )
DermaPanel:SetTitle("")
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( false )
DermaPanel:Center( true )
DermaPanel:MakePopup()
DermaPanel.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 160 ) )
end
local DermaLabel = vgui.Create("DLabel", DermaPanel)
DermaLabel:SetText("?")
DermaLabel:SetContentAlignment(5)
DermaLabel:SetPos(27,20)
DermaLabel:SetFont("Trebuchet18")
DermaLabel:SizeToContents()
DermaLabel:SetColor(Color(25,255,25,255))
local DermaLabel2 = vgui.Create("DLabel", DermaPanel)
DermaLabel2:SetText("V1")
DermaLabel2:SetContentAlignment(7)
DermaLabel2:SetPos(50,5)
DermaLabel2:SetFont("DebugFixed")
DermaLabel2:SizeToContents()
DermaLabel2:SetColor(Color(238,228,51,255))
local DermaLabel3 = vgui.Create("DLabel", DermaPanel)
DermaLabel3:SetText("Made by:")
DermaLabel3:SetContentAlignment(7)
DermaLabel3:SetPos(7,175)
DermaLabel3:SetFont("DebugFixed")
DermaLabel3:SizeToContents()
DermaLabel3:SetColor(Color(238,228,51,255))
local DermaLabel4 = vgui.Create("DLabel", DermaPanel)
DermaLabel4:SetText("europe")
DermaLabel4:SetContentAlignment(7)
DermaLabel4:SetPos(160,175)
DermaLabel4:SetFont("DebugFixed")
DermaLabel4:SizeToContents()
DermaLabel4:SetColor(Color(238,228,51,255))
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton:SetText( "Ja" )
DermaButton:SetPos( 50, 50 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
RunConsoleCommand("Doitnowlol") -- führt den Consolenbefehl aus
end
DermaButton.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
local DermaButton2 = vgui.Create( "DButton" )
DermaButton2:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton2:SetText( "Nein" )
DermaButton2:SetPos( 50, 115 )
DermaButton2:SetSize( 150, 50 )
DermaButton2.DoClick = function ()
DermaPanel:Close()
end
DermaButton2.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
end
concommand.Add("DeathMenu",function()
if GetRoundState() == ROUND_PREP then Menu() end
end)
[/CODE]
[QUOTE=MPan1;50865784]You don't need to use usermessages at all. Concommands can be completely clientside. Try putting this in a clientside file:
[CODE]
local function Menu()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50, 50 )
DermaPanel:SetSize( 250, 200 )
DermaPanel:SetTitle("")
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( false )
DermaPanel:Center( true )
DermaPanel:MakePopup()
DermaPanel.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 0, 0, 0, 160 ) )
end
local DermaLabel = vgui.Create("DLabel", DermaPanel)
DermaLabel:SetText("?")
DermaLabel:SetContentAlignment(5)
DermaLabel:SetPos(27,20)
DermaLabel:SetFont("Trebuchet18")
DermaLabel:SizeToContents()
DermaLabel:SetColor(Color(25,255,25,255))
local DermaLabel2 = vgui.Create("DLabel", DermaPanel)
DermaLabel2:SetText("V1")
DermaLabel2:SetContentAlignment(7)
DermaLabel2:SetPos(50,5)
DermaLabel2:SetFont("DebugFixed")
DermaLabel2:SizeToContents()
DermaLabel2:SetColor(Color(238,228,51,255))
local DermaLabel3 = vgui.Create("DLabel", DermaPanel)
DermaLabel3:SetText("Made by:")
DermaLabel3:SetContentAlignment(7)
DermaLabel3:SetPos(7,175)
DermaLabel3:SetFont("DebugFixed")
DermaLabel3:SizeToContents()
DermaLabel3:SetColor(Color(238,228,51,255))
local DermaLabel4 = vgui.Create("DLabel", DermaPanel)
DermaLabel4:SetText("europe")
DermaLabel4:SetContentAlignment(7)
DermaLabel4:SetPos(160,175)
DermaLabel4:SetFont("DebugFixed")
DermaLabel4:SizeToContents()
DermaLabel4:SetColor(Color(238,228,51,255))
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton:SetText( "Ja" )
DermaButton:SetPos( 50, 50 )
DermaButton:SetSize( 150, 50 )
DermaButton.DoClick = function ()
DermaPanel:Close()
RunConsoleCommand("Doitnowlol") -- führt den Consolenbefehl aus
end
DermaButton.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
local DermaButton2 = vgui.Create( "DButton" )
DermaButton2:SetParent( DermaPanel ) -- unterkategorie vom "DFRAME"
DermaButton2:SetText( "Nein" )
DermaButton2:SetPos( 50, 115 )
DermaButton2:SetSize( 150, 50 )
DermaButton2.DoClick = function ()
DermaPanel:Close()
end
DermaButton2.Paint = function( self, w, h )
draw.RoundedBox( 0, 0, 0, w, h, Color( 255, 255, 255, 180 ) )
end
end
concommand.Add("DeathMenu",function()
if GetRoundState() == ROUND_PREP then Menu() end
end)
[/CODE][/QUOTE]
thanks for helping u2 fixed it
Sorry, you need to Log In to post a reply to this thread.