DarkRP.F4MenuTabs
This page refers to DarkRP 2.4.3. This information may be incorrect as of later versions. Check here for a up-to-date list of hooks. |
---|
Syntax[edit]
Description | Called when tab modifications should be made. Any modifications to the F4 menu should be done in this hook. |
---|---|
Syntax |
GAMEMODE:F4MenuTabs()
|
Returns | nil |
Examples[edit]
[edit]
Description | Add your own tab to the F4 menu |
---|---|
Code | function createMyTab()
local tab = vgui.Create("whatever...")
-- Create the your tab here or something
return tab
end
hook.Add("F4MenuTabs", "addTab", function()
-- Add the tab to F4 (will be added as fifth tab)
-- GAMEMODE:addF4MenuTab("NAME OF TAB HERE", vguiControlOfTab, "Icon here!") returns the tab number of the added tab
local tabNr = GAMEMODE:addF4MenuTab("My Custom tab", createMyTab(), "icon16/money.png")
-- I want it to be before the HUD tab (which is the fourth tab)
-- GAMEMODE:switchTabOrder(TabNumberOfFirstTab, TabNumberOfSecondTab)
GAMEMODE:switchTabOrder(tabNr, 4)
end)
|
Output | Your tab is added to the F4 menu |
Remove a tab from F4[edit]
Description | Remove the HUD tab |
---|---|
Code | hook.Add("F4MenuTabs", "removeTab", function()
-- the HUD tab is the fourth one
-- GAMEMODE:removeTab(TabNumber)
GAMEMODE:removeTab(4)
end)
|
Output | HUD tab is gone. |