Okey im trying to make a system so when you join this TaconBanna Quiz pops up. (my own ofc)
So can anyone help me with this code:
This part:
( // your code here
#########################################HERE!
CHECKS SO ALL QUES IS "Yes" If it's yes then CLOSE DERMA PANEL
IF Not THEN KICK.)
[QUOTE]
local Welcome_to_XH_RP_Server#1___QUIZ = vgui.Create("DFrame")
Welcome_to_XH_RP_Server#1___QUIZ:SetSize(745,5,489,5)
Welcome_to_XH_RP_Server#1___QUIZ:Center()
Welcome_to_XH_RP_Server#1___QUIZ:SetTitle("Welcome to XH RP Server#1 - QUIZ")
Welcome_to_XH_RP_Server#1___QUIZ:MakePopup()
local Continue1 = vgui.Create("DButton", Welcome_to_XH_RP_Server#1___QUIZ)
Continue1:SetSize(289,5, 42)
Continue1:SetPos(441, 437,5)
Continue1:SetText("Continue")
Continue1.DoClick = function( Continue1 )
// your code here
#########################################HERE!
CHECKS SO ALL QUES IS "Yes" If it's yes then CLOSE DERMA PANEL
IF Not THEN KICK.
end
local Help2 = vgui.Create("DButton", Welcome_to_XH_RP_Server#1___QUIZ)
Help2:SetSize(100, 42)
Help2:SetPos(12, 440,5)
Help2:SetText("Help")
Help2.DoClick = function( Help2 )
// your code here
end
local QUES13 = vgui.Create("DTextEntry", Welcome_to_XH_RP_Server#1___QUIZ)
QUES13:SetSize(50, 30)
QUES13:SetPos(382,5, 47)
QUES13:SetText("Can it be fun to RP with no toolgun?")
local QUES13Options = DermaMenu() -- Creates the menu
QUES13Options:AddOption("Yes") -- Add options to the menu
QUES13Options:AddOption("No" end )
QUES13Options:Open() -- Open the menu AFTER adding your options
end
local QUES24 = vgui.Create("DTextEntry", Welcome_to_XH_RP_Server#1___QUIZ)
QUES24:SetSize(50, 30)
QUES24:SetPos(382,5, 98,5)
QUES24:SetText("Can it be fun to RP without gun fighting?")
local QUES24Options = DermaMenu() -- Creates the menu
QUES24Options:AddOption("Yes", function() Msg("Hello") end ) -- Add options to the menu
QUES24Options:AddOption("No", function() Msg("How") end )
QUES24Options:Open() -- Open the menu AFTER adding your options
end
[/QUOTE]
[QUOTE=You]CHECKS SO ALL [b]QUES[/b] IS "Yes" If it's yes then CLOSE DERMA PANEL
IF Not THEN KICK.)[/QUOTE]
So, you´want them to answer a question, by click yes or No. If they click Yes, then it just closes, if No, it kicks them?
What the heck is Ques?
[editline]01:09PM[/editline]
You want only one question, or you want another one to open up after?
[QUOTE=Busymonkey;21751897]So, you´want them to answer a question, by click yes or No. If they click Yes, then it just closes, if No, it kicks them?
What the heck is Ques?
[editline]01:09PM[/editline]
You want only one question, or you want another one to open up after?[/QUOTE]
If you look in the Lua code you will see two "yes/no" questions, so its 2. and Button1 (Continue) = Check so both questions are answered with "yes" if both are yes then exit derma/window, or if the user didn't answer the questions and just leave it blank or wrong then kick.
QUES = the Questions codes.
Making one now.
[editline]03:03PM[/editline]
[code]
function Quiz1()
Quiz1:SetVisible(true)
end
concommand.Add("quiz_1", Quiz1)
function Quiz2()
Quiz2:SetVisible(true)
end
concommand.Add("quiz_2", Quiz2)
Quiz1 = vgui.Create( "DFrame" )
Quiz1:SetPos( 300, 300 )
Quiz1:SetSize( 285, 150 )
Quiz1:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz1:SetVisible( false )
Quiz1:SetDraggable( false )
Quiz1:ShowCloseButton( false )
Quiz1:MakePopup()
DermaList = vgui.Create( "DPanelList", Quiz1 )
DermaList:SetPos( 15, 35 )
DermaList:SetSize( 255, 60 )
Greet = vgui.Create( "DLabel", Quiz1 )
Greet:SetPos( 20, 40)
Greet:SetText("Is it fun to RP with no toolgun?")
Greet:SizeToContents()
YesToolgun = vgui.Create ( "DButton", Quiz1 )
YesToolgun:SetPos( 25, 110 )
YesToolgun:SetSize( 70, 22 )
YesToolgun:SetText("Yes!")
YesToolgun.DoClick = function()
Quiz1:SetVisible(false)
Quiz2:SetVisible(true)
end
NoToolgun = vgui.Create ( "DButton", Quiz1 )
NoToolgun:SetPos( 120, 110 )
NoToolgun:SetSize( 140, 22 )
NoToolgun:SetText("No!")
NoToolgun.DoClick = function ()
RunConsoleCommand("disconnect")
end
Quiz2 = vgui.Create( "DFrame" )
Quiz2:SetPos( 300, 250 )
Quiz2:SetSize( 150, 150 )
Quiz2:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz2:SetVisible( false )
Quiz2:SetDraggable( false )
Quiz2:ShowCloseButton( false )
Quiz2:MakePopup()
QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
QuizTextArea:SetPos( 15, 30 )
QuizTextArea:SetSize( 50, 100 )
Continue = vgui.Create( "DLabel", Quiz2 )
Continue:SetPos( 20, 30)
Continue:SetText("Is it fun to RP without gun fighting?")
Continue:SizeToContents()
YesGun = vgui.Create ( "DButton", Quiz2 )
YesGun:SetPos( 15, 100 )
YesGun:SetSize( 35, 40 )
YesGun:SetText("Yes!")
YesGun.DoClick = function ()
Quiz2:SetVisible(false)
end
NoGun = vgui.Create ( "DButton", Quiz2 )
NoGun:SetPos( 25, 100 )
NoGun:SetSize( 35, 40 )
NoGun:SetText("No!")
NoGun.DoClick = function ()
RunConsoleCommand("disconnect")
end
[/code]
Should go into lua/autorun/client.
If you dont like it; make your own.
If the buttons arent positioned right; I did it in Notepad, didnt have a visual aspect.
Thanks alot, but the
function Quiz1()
""Quiz1:SetVisible(true)""
end
dons't work :S
autorun/client/keypad_cracker.lua:2: attempt to index global 'Quiz1' (a nil value)
Try this, I just re arranged busymonkey's script.
[lua]
Quiz1 = vgui.Create( "DFrame" )
Quiz1:SetPos( 300, 300 )
Quiz1:SetSize( 285, 150 )
Quiz1:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz1:SetVisible( false )
Quiz1:SetDraggable( false )
Quiz1:ShowCloseButton( false )
Quiz1:MakePopup()
DermaList = vgui.Create( "DPanelList", Quiz1 )
DermaList:SetPos( 15, 35 )
DermaList:SetSize( 255, 60 )
Greet = vgui.Create( "DLabel", Quiz1 )
Greet:SetPos( 20, 40)
Greet:SetText("Is it fun to RP with no toolgun?")
Greet:SizeToContents()
YesToolgun = vgui.Create ( "DButton", Quiz1 )
YesToolgun:SetPos( 25, 110 )
YesToolgun:SetSize( 70, 22 )
YesToolgun:SetText("Yes!")
YesToolgun.DoClick = function()
Quiz1:SetVisible(false)
Quiz2:SetVisible(true)
end
NoToolgun = vgui.Create ( "DButton", Quiz1 )
NoToolgun:SetPos( 120, 110 )
NoToolgun:SetSize( 140, 22 )
NoToolgun:SetText("No!")
NoToolgun.DoClick = function ()
RunConsoleCommand("disconnect")
end
Quiz2 = vgui.Create( "DFrame" )
Quiz2:SetPos( 300, 250 )
Quiz2:SetSize( 150, 150 )
Quiz2:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz2:SetVisible( false )
Quiz2:SetDraggable( false )
Quiz2:ShowCloseButton( false )
Quiz2:MakePopup()
QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
QuizTextArea:SetPos( 15, 30 )
QuizTextArea:SetSize( 50, 100 )
Continue = vgui.Create( "DLabel", Quiz2 )
Continue:SetPos( 20, 30)
Continue:SetText("Is it fun to RP without gun fighting?")
Continue:SizeToContents()
YesGun = vgui.Create ( "DButton", Quiz2 )
YesGun:SetPos( 15, 100 )
YesGun:SetSize( 35, 40 )
YesGun:SetText("Yes!")
YesGun.DoClick = function ()
Quiz2:SetVisible(false)
end
NoGun = vgui.Create ( "DButton", Quiz2 )
NoGun:SetPos( 25, 100 )
NoGun:SetSize( 35, 40 )
NoGun:SetText("No!")
NoGun.DoClick = function ()
RunConsoleCommand("disconnect")
end
function Quiz1()
Quiz1:SetVisible(true)
end
concommand.Add("quiz_1", Quiz1)
function Quiz2()
Quiz2:SetVisible(true)
end
concommand.Add("quiz_2", Quiz2)
[/lua]
Your panel objects and functions have the same name.
[QUOTE=sintwins;21753934]Try this, I just re arranged busymonkey's script.
Quiz1 = vgui.Create( "DFrame" )
Quiz1:SetPos( 300, 300 )
Quiz1:SetSize( 285, 150 )
Quiz1:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz1:SetVisible( false )
Quiz1:SetDraggable( false )
Quiz1:ShowCloseButton( false )
Quiz1:MakePopup()
DermaList = vgui.Create( "DPanelList", Quiz1 )
DermaList:SetPos( 15, 35 )
DermaList:SetSize( 255, 60 )
Greet = vgui.Create( "DLabel", Quiz1 )
Greet:SetPos( 20, 40)
Greet:SetText("Is it fun to RP with no toolgun?")
Greet:SizeToContents()
YesToolgun = vgui.Create ( "DButton", Quiz1 )
YesToolgun:SetPos( 25, 110 )
YesToolgun:SetSize( 70, 22 )
YesToolgun:SetText("Yes!")
YesToolgun.DoClick = function()
Quiz1:SetVisible(false)
Quiz2:SetVisible(true)
end
NoToolgun = vgui.Create ( "DButton", Quiz1 )
NoToolgun:SetPos( 120, 110 )
NoToolgun:SetSize( 140, 22 )
NoToolgun:SetText("No!")
NoToolgun.DoClick = function ()
RunConsoleCommand("disconnect")
end
Quiz2 = vgui.Create( "DFrame" )
Quiz2:SetPos( 300, 250 )
Quiz2:SetSize( 150, 150 )
Quiz2:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz2:SetVisible( false )
Quiz2:SetDraggable( false )
Quiz2:ShowCloseButton( false )
Quiz2:MakePopup()
QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
QuizTextArea:SetPos( 15, 30 )
QuizTextArea:SetSize( 50, 100 )
Continue = vgui.Create( "DLabel", Quiz2 )
Continue:SetPos( 20, 30)
Continue:SetText("Is it fun to RP without gun fighting?")
Continue:SizeToContents()
YesGun = vgui.Create ( "DButton", Quiz2 )
YesGun:SetPos( 15, 100 )
YesGun:SetSize( 35, 40 )
YesGun:SetText("Yes!")
YesGun.DoClick = function ()
Quiz2:SetVisible(false)
end
NoGun = vgui.Create ( "DButton", Quiz2 )
NoGun:SetPos( 25, 100 )
NoGun:SetSize( 35, 40 )
NoGun:SetText("No!")
NoGun.DoClick = function ()
RunConsoleCommand("disconnect")
end
function Quiz1()
Quiz1:SetVisible(true)
end
concommand.Add("quiz_1", Quiz1)
function Quiz2()
Quiz2:SetVisible(true)
end
concommand.Add("quiz_2", Quiz2)
[/QUOTE]
Still Error ^^
[QUOTE=Tokiz;21769525]Still Error ^^[/QUOTE]
[QUOTE=Nevec;21754023]Your panel objects and functions have the same name.[/QUOTE]
[code]QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
DermaList = vgui.Create( "DPanelList", Quiz1 )[/code]
Not the same ^
Neither is v
[code]function Quiz1()
Quiz1:SetVisible(true)
end
function Quiz2()
Quiz2:SetVisible(true)
end
[/code]
[QUOTE=sintwins;21753934]Try this, I just re arranged busymonkey's script.
[lua]
Quiz1 = vgui.Create( "DFrame" )
Quiz1:SetPos( 300, 300 )
Quiz1:SetSize( 285, 150 )
Quiz1:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz1:SetVisible( false )
Quiz1:SetDraggable( false )
Quiz1:ShowCloseButton( false )
Quiz1:MakePopup()
DermaList = vgui.Create( "DPanelList", Quiz1 )
DermaList:SetPos( 15, 35 )
DermaList:SetSize( 255, 60 )
Greet = vgui.Create( "DLabel", Quiz1 )
Greet:SetPos( 20, 40)
Greet:SetText("Is it fun to RP with no toolgun?")
Greet:SizeToContents()
YesToolgun = vgui.Create ( "DButton", Quiz1 )
YesToolgun:SetPos( 25, 110 )
YesToolgun:SetSize( 70, 22 )
YesToolgun:SetText("Yes!")
YesToolgun.DoClick = function()
Quiz1:SetVisible(false)
Quiz2:SetVisible(true)
end
NoToolgun = vgui.Create ( "DButton", Quiz1 )
NoToolgun:SetPos( 120, 110 )
NoToolgun:SetSize( 140, 22 )
NoToolgun:SetText("No!")
NoToolgun.DoClick = function ()
RunConsoleCommand("disconnect")
end
Quiz2 = vgui.Create( "DFrame" )
Quiz2:SetPos( 300, 250 )
Quiz2:SetSize( 150, 150 )
Quiz2:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz2:SetVisible( false )
Quiz2:SetDraggable( false )
Quiz2:ShowCloseButton( false )
Quiz2:MakePopup()
QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
QuizTextArea:SetPos( 15, 30 )
QuizTextArea:SetSize( 50, 100 )
Continue = vgui.Create( "DLabel", Quiz2 )
Continue:SetPos( 20, 30)
Continue:SetText("Is it fun to RP without gun fighting?")
Continue:SizeToContents()
YesGun = vgui.Create ( "DButton", Quiz2 )
YesGun:SetPos( 15, 100 )
YesGun:SetSize( 35, 40 )
YesGun:SetText("Yes!")
YesGun.DoClick = function ()
Quiz2:SetVisible(false)
end
NoGun = vgui.Create ( "DButton", Quiz2 )
NoGun:SetPos( 25, 100 )
NoGun:SetSize( 35, 40 )
NoGun:SetText("No!")
NoGun.DoClick = function ()
RunConsoleCommand("disconnect")
end
function Quiz1()
Quiz1:SetVisible(true)
end
concommand.Add("quiz_1", Quiz1)
function Quiz2()
Quiz2:SetVisible(true)
end
concommand.Add("quiz_2", Quiz2)
[/lua][/QUOTE]
If I remember correctly disconnect should be block unless, I'm thinking about exit.
[QUOTE=Aide;21773833]If I remember correctly disconnect should be block unless, I'm thinking about exit.[/QUOTE]
I don't think disconnect is, since its not harmful in anyway. But exit is however
[QUOTE=Busymonkey;21771352]Not the same ^
Neither is v[/QUOTE]
You misunderstood me.
[lua] Quiz1 = vgui.Create( "DFrame" ) [/lua]
[lua] Quiz2 = vgui.Create( "DFrame" )[/lua]
[lua]function Quiz1()[/lua]
[lua]function Quiz2()[/lua]
What Nevec means is that Quiz1 ends up pointing to a function and all references to your panel object are lost. Same for Quiz2.
The solution is simply to change the name of the functions.
[QUOTE=Crazy Quebec;21774652]What Nevec means is that Quiz1 ends up pointing to a function and all references to your panel object are lost. Same for Quiz2.
The solution is simply to change the name of the functions.[/QUOTE]
Which is something he should figure out by himself.
Oh, right :doh:
[code]
Quiz1 = vgui.Create( "DFrame" )
Quiz1:SetPos( 300, 300 )
Quiz1:SetSize( 285, 150 )
Quiz1:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz1:SetVisible( false )
Quiz1:SetDraggable( false )
Quiz1:ShowCloseButton( false )
Quiz1:MakePopup()
DermaList = vgui.Create( "DPanelList", Quiz1 )
DermaList:SetPos( 15, 35 )
DermaList:SetSize( 255, 60 )
Greet = vgui.Create( "DLabel", Quiz1 )
Greet:SetPos( 20, 40)
Greet:SetText("Is it fun to RP with no toolgun?")
Greet:SizeToContents()
YesToolgun = vgui.Create ( "DButton", Quiz1 )
YesToolgun:SetPos( 25, 110 )
YesToolgun:SetSize( 70, 22 )
YesToolgun:SetText("Yes!")
YesToolgun.DoClick = function()
Quiz1:SetVisible(false)
Quiz2:SetVisible(true)
end
NoToolgun = vgui.Create ( "DButton", Quiz1 )
NoToolgun:SetPos( 120, 110 )
NoToolgun:SetSize( 140, 22 )
NoToolgun:SetText("No!")
NoToolgun.DoClick = function ()
RunConsoleCommand("disconnect")
end
Quiz2 = vgui.Create( "DFrame" )
Quiz2:SetPos( 300, 250 )
Quiz2:SetSize( 150, 150 )
Quiz2:SetTitle( "Welcome to XH RP Server#1 - QUIZ" )
Quiz2:SetVisible( false )
Quiz2:SetDraggable( false )
Quiz2:ShowCloseButton( false )
Quiz2:MakePopup()
QuizTextArea = vgui.Create( "DPanelList", Quiz2 )
QuizTextArea:SetPos( 15, 30 )
QuizTextArea:SetSize( 50, 100 )
Continue = vgui.Create( "DLabel", Quiz2 )
Continue:SetPos( 20, 30)
Continue:SetText("Is it fun to RP without gun fighting?")
Continue:SizeToContents()
YesGun = vgui.Create ( "DButton", Quiz2 )
YesGun:SetPos( 15, 100 )
YesGun:SetSize( 35, 40 )
YesGun:SetText("Yes!")
YesGun.DoClick = function ()
Quiz2:SetVisible(false)
end
NoGun = vgui.Create ( "DButton", Quiz2 )
NoGun:SetPos( 25, 100 )
NoGun:SetSize( 35, 40 )
NoGun:SetText("No!")
NoGun.DoClick = function ()
RunConsoleCommand("disconnect")
end
function QuizOne()
Quiz1:SetVisible(true)
end
concommand.Add("quiz_1", QuizOne)
function QuizTwo()
Quiz2:SetVisible(true)
end
concommand.Add("quiz_2", QuizTwo)
[/code]
Sorry, you need to Log In to post a reply to this thread.