My panel doesn't open why ?
client side
--==============CONFIG==============--
local PANEL_TITLE = "Menu de gambling"
local UNBOX_TEXT = "Ouvrir le unbox menu"
local CREATECOIN_TEXT = "Créer un coin flip"
local COINMENU_TEXT = "Ouvri le coinflip menu"
local BUTTON_NAME = "Ouvrir"
local BUTTONCLOSE_NAME = "Terminé"
--==================================--
surface.CreateFont( "titlefont", {
font = "Impact",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
surface.CreateFont( "buttontext", {
font = "Impact",
size = 30,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
net.Receive("OpenGamblingMenu", function()
local frame = vgui.Create("DFrame")
frame:SetTitle ("")
frame:SetSize(400, 500)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(true)
frame.Paint = function(s, w, h)
-- C'est le contour de la boite qui est noir
draw.RoundedBox(5,0,0,w , h,Color(0,0,0))
-- C'est le fond de la boite qui est gris
draw.RoundedBox(5,2,2,w-4 , h-4,Color(50,50,50))
local title = vgui.Create("DLabel" , frame)
title:SetPos(130, 2)
title:SetSize(300, 25)
title:SetTextColor( Color( 255, 0, 0, 255 ) )
title:SetText( PANEL_TITLE )
title:SetFont( "titlefont" )
local unbox = vgui.Create("DLabel" , frame)
unbox:SetPos(30, 95)
unbox:SetSize(300, 25)
unbox:SetTextColor( Color( 0, 0, 0, 255 ) )
unbox:SetText( UNBOX_TEXT )
unbox:SetFont( "titlefont" )
local createcoin = vgui.Create("DLabel" , frame)
createcoin:SetPos(30, 205)
createcoin:SetSize(300, 25)
createcoin:SetTextColor( Color( 0, 0, 0, 255 ) )
createcoin:SetText( CREATECOIN_TEXT )
createcoin:SetFont( "titlefont" )
local coinmenu = vgui.Create("DLabel" , frame)
coinmenu:SetPos(30, 315)
coinmenu:SetSize(300, 25)
coinmenu:SetTextColor( Color( 0, 0, 0, 255 ) )
coinmenu:SetText( COINMENU_TEXT )
coinmenu:SetFont( "titlefont" )
end
function buttonclosepressed()
frame:close()
end
local button1 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button1:SetPos(230,90)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button1:SetSize(120, 42)
button1:SetText(BUTTON_NAME)
button1:SetTextColor( Color( 0, 0, 0, 255 ) )
button1:SetFont("buttontext")
button1.DoClick = function()
RunConsoleCommand( "say", "/unbox" )
end
local button2 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button2:SetPos(230,200)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button2:SetSize(120, 42)
button2:SetText(BUTTON_NAME)
button2:SetTextColor( Color( 0, 0, 0, 255 ) )
button2:SetFont("buttontext")
button2.DoClick = function()
RunConsoleCommand( "say", "/createflip" )
end
local button3 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button3:SetPos(230,310)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button3:SetSize(120, 42)
button3:SetText(BUTTON_NAME)
button3:SetTextColor( Color( 0, 0, 0, 255 ) )
button3:SetFont("buttontext")
button3.DoClick = function()
RunConsoleCommand( "say", "/flips" )
end
Server Side
local PANEL_COMMAND = "/jeux"
util.AddNetworkString("OpenGamblingMenu")
hook.Add("PlayerSay", "OpenTheGamblingMenuPLS", function(ply, text, public)
if string.lower( text ) == PANEL_COMMAND then
net.Start("OpenGamblingMenu")
net.Send(ply)
return ""
end
end)
This isn't the most efficient way to open a panel... but
Did you wrap the function?
net.Receive("OpenGamblingMenu", function()
end) //<---
No when i put a end) at the end of the script i have an error
eof expected near end
Then you're not ending your functions correctly.
From the code you posted looks like the paint function on the DFrame
When i put end) i got this error:
eof expected near (end)
Put "end)" at the end of the code, just after:
button3.DoClick = function()
RunConsoleCommand( "say", "/flips" )
end
You haven't ended the Paint function, which means it thinks its ending the Paint function rather than the full thing. End the paint function THEN do the end).
I tested it and it works fine, this is the entire code:
Server side
local PANEL_COMMAND = "/jeux"
util.AddNetworkString("OpenGamblingMenu")
hook.Add("PlayerSay", "OpenTheGamblingMenuPLS", function(ply, text, public)
if string.lower( text ) == PANEL_COMMAND then
net.Start("OpenGamblingMenu")
net.Send(ply)
return""
end
end)
Client side
--==============CONFIG==============--
local PANEL_TITLE = "Menu de gambling"
local UNBOX_TEXT = "Ouvrir le unbox menu"
local CREATECOIN_TEXT = "Créer un coin flip"
local COINMENU_TEXT = "Ouvri le coinflip menu"
local BUTTON_NAME = "Ouvrir"
local BUTTONCLOSE_NAME = "Terminé"
--==================================--
surface.CreateFont( "titlefont", {
font = "Impact",
size = 25,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
surface.CreateFont( "buttontext", {
font = "Impact",
size = 30,
weight = 500,
blursize = 0,
scanlines = 0,
antialias = true
} )
net.Receive("OpenGamblingMenu", function()
local frame = vgui.Create("DFrame")
frame:SetTitle ("")
frame:SetSize(400, 500)
frame:Center()
frame:SetVisible(true)
frame:MakePopup()
frame:ShowCloseButton(true)
frame.Paint = function(s, w, h)
-- C'est le contour de la boite qui est noir
draw.RoundedBox(5,0,0,w , h,Color(0,0,0))
-- C'est le fond de la boite qui est gris
draw.RoundedBox(5,2,2,w-4 , h-4,Color(50,50,50))
local title = vgui.Create("DLabel" , frame)
title:SetPos(130, 2)
title:SetSize(300, 25)
title:SetTextColor( Color( 255, 0, 0, 255 ) )
title:SetText( PANEL_TITLE )
title:SetFont( "titlefont" )
local unbox = vgui.Create("DLabel" , frame)
unbox:SetPos(30, 95)
unbox:SetSize(300, 25)
unbox:SetTextColor( Color( 0, 0, 0, 255 ) )
unbox:SetText( UNBOX_TEXT )
unbox:SetFont( "titlefont" )
local createcoin = vgui.Create("DLabel" , frame)
createcoin:SetPos(30, 205)
createcoin:SetSize(300, 25)
createcoin:SetTextColor( Color( 0, 0, 0, 255 ) )
createcoin:SetText( CREATECOIN_TEXT )
createcoin:SetFont( "titlefont" )
local coinmenu = vgui.Create("DLabel" , frame)
coinmenu:SetPos(30, 315)
coinmenu:SetSize(300, 25)
coinmenu:SetTextColor( Color( 0, 0, 0, 255 ) )
coinmenu:SetText( COINMENU_TEXT )
coinmenu:SetFont( "titlefont" )
end
function buttonclosepressed()
frame:close()
end
local button1 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button1:SetPos(230,90)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button1:SetSize(120, 42)
button1:SetText(BUTTON_NAME)
button1:SetTextColor( Color( 0, 0, 0, 255 ) )
button1:SetFont("buttontext")
button1.DoClick = function()
RunConsoleCommand( "say", "/unbox" )
end
local button2 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button2:SetPos(230,200)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button2:SetSize(120, 42)
button2:SetText(BUTTON_NAME)
button2:SetTextColor( Color( 0, 0, 0, 255 ) )
button2:SetFont("buttontext")
button2.DoClick = function()
RunConsoleCommand( "say", "/createflip" )
end
local button3 = vgui.Create("DButton" , frame)
-- Le 50 est sa place a l'horizontal et 40 est sa place a la verticale
button3:SetPos(230,310)
-- Le 150 c'est sa grosseur a l'horizontal et 70 sa grosseur a la verticale
button3:SetSize(120, 42)
button3:SetText(BUTTON_NAME)
button3:SetTextColor( Color( 0, 0, 0, 255 ) )
button3:SetFont("buttontext")
button3.DoClick = function()
RunConsoleCommand( "say", "/flips" )
end
end)
Oh thks dude
When i put it on my server the panel doesn't open when I do the command
Did u try the code I wrote you?
Sorry, you need to Log In to post a reply to this thread.