LUA:Modifying F4

From DarkRP
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
English | Русский | Français

Add a tab to the F4 menu[edit]

DescriptionAdd your own tab to the F4 menu
Code
local 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 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)
end)
OutputYour tab is added to the F4 menu

Remove a tab from F4[edit]

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