Title may be a little vague, but im not sure how to word it, im working on creating a menu for my script, and i want to know how i can set it so if the player clicks the button, then either A. the menu disappears, not to show until say, the next round, or B. it just makes them unclickable, and the player then closes the menu
Any help would be nice, thank you :b
[lua]function buttonname:DoClick()
-- your code here
end
[/lua]
and if you don't want players closing the panel
[lua]
panelname:ShowCloseButtons(false) -- i would not set this until you know the buttons work[/lua]
[QUOTE=LUModder;49912059][lua]function buttonname:DoClick()
-- your code here
end
[/lua]
and if you don't want players closing the panel
[lua]
panelname:ShowCloseButtons(false) -- i would not set this until you know the buttons work[/lua][/QUOTE]
Well, following what you said, i did this with the button [lua]local lps2 = vgui.Create( "lpsButton" )
lps:SetParent( lpsPanel ) -- Set parent to our "lpsPanel"
lps:SetText( "Low Gravity!" )
lps:SetPos( 50, 100 )
lps:SetSize( 150, 50 )
function lps.DoClick = function (ply)
ply:SetGravity(.5) -- What happens when you press the button
end
[/lua]
correct, or?
[QUOTE=DillyTheDill;49912084]Well, following what you said, i did this with the button [lua]local lps2 = vgui.Create( "lpsButton" )
lps:SetParent( lpsPanel ) -- Set parent to our "lpsPanel"
lps:SetText( "Low Gravity!" )
lps:SetPos( 50, 100 )
lps:SetSize( 150, 50 )
function lps.DoClick = function (ply)
ply:SetGravity(.5) -- What happens when you press the button
end
[/lua]
correct, or?[/QUOTE]
[lua]
--Clientside panel code
function lps.DoClick()
net.Start("lps_GravBtn")
net.SendToServer()
end
--Serverside code
util.AddNetworkString("lps_GravBtn")
net.Receive("lps_GravBtn",function(len,ply)
ply:SetGravity(0.5)
end)
[/lua]
Simple networking code
[QUOTE=LUModder;49912112][lua]
--Clientside panel code
function lps.DoClick()
net.Start("lps_GravBtn")
net.SendToServer()
end
--Serverside code
util.AddNetworkString("lps_GravBtn")
net.Receive("lps_GravBtn",function(len,ply)
ply:SetGravity(0.5)
end)
[/lua]
Simple networking code[/QUOTE]
Thank you, im a beginner if it wasnt obvious, just want to see if I can make this work =)
I appreciate the help!
Sorry, you need to Log In to post a reply to this thread.