LUA:Modifying F4

From DarkRP
Revision as of 10:58, 19 February 2021 by (talk) (→‎Remove a tab from F4)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский | France-flag.png Français

Add a tab to the F4 menu[edit]

DescriptionAdd your own tab to the F4 menu
local function createMyTab()
	local tab = vgui.Create("whatever...")
	-- Create the your tab here or something
	return tab

hook.Add("F4MenuTabs", "addTab", function()
	-- Add the tab to F4 (will be added as the last tab)
	-- DarkRP.addF4MenuTab("NAME OF TAB HERE", vguiControlOfTab) returns the tab number of the added tab
	local tabNr = DarkRP.addF4MenuTab("My Custom Tab", createMyTab())

	-- If you want it to move the tab to be before another, use this
	-- DarkRP.switchTabOrder(TabNumberOfTabYouWantToMove, TabNumberOfDestination)
	DarkRP.switchTabOrder(tabNr, 4)
OutputYour tab is added to the F4 menu

Remove a tab from F4[edit]

DescriptionRemoves tab number 3
hook.Add("F4MenuTabs", "removeTab", function()
	-- the HUD tab is the fourth one
	-- DarkRP.removeF4MenuTab(TabNumber)
OutputTab #3 is gone.