LUA:Modifying F4

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

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

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