Difference between revisions of "DarkRP:Categories"

From Official DarkRP Wiki
Jump to navigation Jump to search
(Created page with "{{TOC right}} DarkRP 2.6.1 comes with quite a big change in the default F4 menu: categories. This page explains how to create categories, how to use them and how to change the...")
 
Line 1: Line 1:
 
{{TOC right}}
 
{{TOC right}}
 
DarkRP 2.6.1 comes with quite a big change in the default F4 menu: categories. This page explains how to create categories, how to use them and how to change the categories of default items.
 
DarkRP 2.6.1 comes with quite a big change in the default F4 menu: categories. This page explains how to create categories, how to use them and how to change the categories of default items.
Note: Categories do '''NOT''' work for custom F4 menus '''unless''' the authors of these F4 menus explicitly add support for them. Until then the categories will **NOT** break those F4 menus.
+
Note: Categories do '''NOT''' work for custom F4 menus '''unless''' the authors of these F4 menus explicitly add support for them. Until then the categories will ''NOT'' break those F4 menus.
  
 
= Creating categories =
 
= Creating categories =
 +
There's a file in the DarkRPmod: 'lua/darkrp_customthings/categories.lua'. It might be that you don't have this file in your own DarkRPMod. In that case you can download it here:
 +
 +
https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_customthings/categories.lua
 +
 +
Categories look like this:
 +
{{Code|1=
 +
DarkRP.createCategory{
 +
name = "Citizens", -- The name of the category.
 +
categorises = "jobs", -- What it categorises. MUST be one of "jobs", "entities", "shipments", "weapons", "vehicles", "ammo".
 +
startExpanded = true, -- Whether the category is expanded when you open the F4 menu.
 +
color = Color(0, 107, 0, 255), -- The color of the category header.
 +
canSee = function(ply) return true end, -- OPTIONAL: whether the player can see this category AND EVERYTHING IN IT.
 +
sortOrder = 100, -- OPTIONAL: With this you can decide where your category is. Low numbers to put it on top, high numbers to put it on the bottom. It's 100 by default.
 +
}
 +
}}
 +
 +
Feel free to copy the above category, or the one below (which is without the explanation) into your categories.lua. Make sure to put it under the line at the bottom of the file.
 +
{{Code|1=
 +
DarkRP.createCategory{
 +
name = "Citizens",
 +
categorises = "jobs",
 +
startExpanded = true,
 +
color = Color(0, 107, 0, 255),
 +
canSee = function(ply) return true end,
 +
sortOrder = 100,
 +
}
 +
}}
 +
 +
= How to use categories =
 +
 +
= Changing categories of default items =

Revision as of 20:30, 21 March 2015


DarkRP 2.6.1 comes with quite a big change in the default F4 menu: categories. This page explains how to create categories, how to use them and how to change the categories of default items. Note: Categories do NOT work for custom F4 menus unless the authors of these F4 menus explicitly add support for them. Until then the categories will NOT break those F4 menus.

Creating categories

There's a file in the DarkRPmod: 'lua/darkrp_customthings/categories.lua'. It might be that you don't have this file in your own DarkRPMod. In that case you can download it here:

https://github.com/FPtje/darkrpmodification/blob/master/lua/darkrp_customthings/categories.lua

Categories look like this:

DarkRP.createCategory{
	name = "Citizens", -- The name of the category.
	categorises = "jobs", -- What it categorises. MUST be one of "jobs", "entities", "shipments", "weapons", "vehicles", "ammo".
	startExpanded = true, -- Whether the category is expanded when you open the F4 menu.
	color = Color(0, 107, 0, 255), -- The color of the category header.
	canSee = function(ply) return true end, -- OPTIONAL: whether the player can see this category AND EVERYTHING IN IT.
	sortOrder = 100, -- OPTIONAL: With this you can decide where your category is. Low numbers to put it on top, high numbers to put it on the bottom. It's 100 by default.
}

Feel free to copy the above category, or the one below (which is without the explanation) into your categories.lua. Make sure to put it under the line at the bottom of the file.

DarkRP.createCategory{
	name = "Citizens",
	categorises = "jobs",
	startExpanded = true,
	color = Color(0, 107, 0, 255),
	canSee = function(ply) return true end,
	sortOrder = 100,
}

How to use categories

Changing categories of default items