In the DarkRP F4 Menu, I have managed to add a new tab, and get it working 100%, with no problems.
My question:
How do I make it open up to a specific tab in the F4 menu?
I want to set it to where players can type a chat/console command to access it.
I've tried it multiple ways with no success.
Any suggestions?
When you make the tab, save its panel by doing like:
[lua]local Derptab = PropertySheet:AddSheet(blabla)[/lua]
Then later when you want to make that tab active, do:
[lua]PropertySheet:SetActiveTab(DerpTab)[/lua]
[QUOTE=Donkie;33013844]When you make the tab, save its panel by doing like:
[lua]local Derptab = PropertySheet:AddSheet(blabla)[/lua]
Then later when you want to make that tab active, do:
[lua]PropertySheet:SetActiveTab(DerpTab)[/lua][/QUOTE]
Nope, AddSheet returns a table with, you need the member Tab from it.
eg.
local tab = bla:AddSheet(...)
bla:SetActiveTab(tab.Tab)
Thanks for the quick replies, but I have hit another snag.
I declared the variable with:
[lua]
local testtab = F4MenuTabs:AddSheet("Test Tab", F4Tabs[5], "gui/silkicons/user", false, false)
[/lua]
Also, I have set up a console command to open my test tab, with:
[lua]
function OpenTestTab()
F4Menu:SetVisible(true)
F4Menu:SetActiveTab(testtab.Tab)
end
concommand.Add("Open_Test_Tab", OpenTestTab)
[/lua]
Now, F4Menu:SetVisible(true) opens it just fine, but not to the right tab.
The Error:
[DarkRP\gamemode\cl_vgui.lua:296] attempt to call method 'SetActiveTab' (a nil value)
I know I'm doing something simple wrong, but I am not sure.
It has eluded me.
[QUOTE=Kanlaki101;33016098]Thanks for the quick replies, but I have hit another snag.
I declared the variable with:
[lua]
local testtab = F4MenuTabs:AddSheet("Test Tab", F4Tabs[5], "gui/silkicons/user", false, false)
[/lua]
Also, I have set up a console command to open my test tab, with:
[lua]
function OpenTestTab()
F4Menu:SetVisible(true)
F4Menu:SetActiveTab(testtab.Tab)
end
concommand.Add("Open_Test_Tab", OpenTestTab)
[/lua]
Now, F4Menu:SetVisible(true) opens it just fine, but not to the right tab.
The Error:
[DarkRP\gamemode\cl_vgui.lua:296] attempt to call method 'SetActiveTab' (a nil value)
I know I'm doing something simple wrong, but I am not sure.
It has eluded me.[/QUOTE]
Full code please.
[QUOTE=Wizard of Ass;33015130]Nope, AddSheet returns a table with, you need the member Tab from it.
eg.
local tab = bla:AddSheet(...)
bla:SetActiveTab(tab.Tab)[/QUOTE]Then the wiki gives false information, or I didn't read it correctly.
Edit:
Ok I read it wrong.
Never mind.
Sorry, you need to Log In to post a reply to this thread.