Runtime error on shippments

Im getting an error on my gun shipments that I’ve never seen before so im not sure whats wrong:


[ERROR] A runtime error has occurred in "your custom shipments" on line -1.
The best help I can give you is this:

The category of "M92 Beretta" ("Pistols") does not exist!

Hints:
	- Make sure the category is created with DarkRP.createCategory.
	- The category name is case sensitive!
	- Categories must be created before DarkRP finished loading.

The responsibility for the error above lies with (the authors of) one (or more) of these files:
your custom shipments


And it does this for each shipment. I’ve added the categories for each one, and I already checked to see if it was just a simple spelling error on either the category or shipment but they match. The categories and the guns show up in my F4 menu, so it isnt game breaking. Still would rather not have 14 script errors everytime someone joins though, so any help would be appreciated. Here is the Pistols category for the M92 Beretta example:


DarkRP.createCategory{
    name = "Pistols",
    categorises = "weapons",
    startExpanded = true,
    color = Color(171, 15, 15, 255),
    canSee = function(ply) return table.HasValue({TEAM_GUN, TEAM_HEAVY}, ply:Team()) end,
    sortOrder = 10
}

Can you post an example of one of the shipments that is erroring?


DarkRP.createShipment("M92 Beretta", {
    model = "models/weapons/w_beretta_m92.mdl",
    entity = "m9k_m92beretta",
    amount = 10,
    price = 2000,
    separate = false,
    pricesep = 0,
    noship = false,
    category = "Pistols",
    allowed = {TEAM_GUN},
    customCheck = function(ply) return
        table.HasValue({TEAM_GUN}, ply:Team())
    end,
    CustomCheckFailMsg = "",
}) 

Make sure your createCategory call comes before your createShipment

How do I determine when its created?

[lua]

local a = 1
local b = 2

MsgN(a + b) //Returns 3
MsgN(c - a) //Trhows an error because c is not defined (yet)

local c = 3

[/lua]

Is this how im supposed to fix my issue?

Run your createCategory before createShipment.

Ok, and how do I do that? Never experienced this issue so I have no clue what im doing, sorry lol.


DarkRP.createCategory({
   -- stuff
})

DarkRP.createShipment("name", {
   -- stuff
})

Ok, but they are in two seperate files in the modification master, so do I just need to put the categories at the top of the file?

Oh, I’m sorry, that’s not the cause of the error. The problem is you declared the category for “weapons” yet you are trying to use it with a shipment. Read this page: http://wiki.darkrp.com/index.php/DarkRP:Categories

Thank you that solved it.