DarkRP.F4MenuTabs

From Official DarkRP Wiki
Jump to: navigation, search
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

DescriptionCalled when tab modifications should be made. Any modifications to the F4 menu should be done in this hook.
Syntax
GAMEMODE:F4MenuTabs()
Returnsnil

Examples

Add a tab to the F4 menu

DescriptionAdd 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)
OutputYour tab is added to the F4 menu

Remove a tab from F4

DescriptionRemove the HUD tab
Code
hook.Add("F4MenuTabs", "removeTab", function()
	-- the HUD tab is the fourth one
	-- GAMEMODE:removeTab(TabNumber)
	GAMEMODE:removeTab(4)
end)
OutputHUD tab is gone.