How do i give a custom Cops the command to do /wanted and /warrnat

The job is
TEAM_PoliceOfficer = DarkRP.createJob(“Police Officer”, {
color = Color(0, 0, 0, 255),
model = {“models/player/nypd/male_09.mdl”},
description = [[Protect the city]],
weapons = {“darkrp_handcuffs”, “m9k_remington870”, “stunstick”, “unarrest_stick”, “weaponchecker”, “keys”, “q”, “door_ram”, “m9k_fists”, “m9k_usp”},
command = “PoliceOfficer”,
max = 6,
salary = 100,
admin = 0,
vote = true,
hasLicense = true,
candemote = true,
category = “Government”,
ammo = {
[“item_box_buckshot”] = 120,
[“item_ammo_pistol”] = 120
},
PlayerSpawn = function(ply)
ply:SetMaxHealth(100)
ply:SetHealth(100)
ply:SetArmor(96)
end
})

I renamed Civil protection as Government

GAMEMODE.Government= {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,

}

My problem is every time i try to add a Team to gamemode governements it gives me lua errors, its not allowing me to let them use commands like /wanted or /warrant if any one knows how to fix this that would be the best.

Could you post the error, along with the code that actually gives you the error? Please use


 tags. Also, unless you've modified the gamemode's core files, you can't just rename the CivilProtection table to Government without it working.

[ERROR] A runtime error has occurred in “addons/darkrpmodification/lua/darkrp_customthings/jobs.lua” on line 33.
The best help I can give you is this:

A table is being indexed by something that does not exist (table index is nil).

Hints:
- The thing between square brackets does not exist (is nil).

The responsibility for the error above lies with (the authors of) one (or more) of these files:
1. addons/darkrpmodification/lua/darkrp_customthings/jobs.lua on line 33
2. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
3. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
4. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 137
5. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 148
6. gamemodes/darkrp/gamemode/init.lua on line 111
------- End of Simplerr error -------

  1. error - [C]:-1
  2. doInclude - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
    3. loadCustomDarkRPItems - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:137
    4. Couldn’t Load Init Script: ‘darkrp/gamemode/init.lua’

I am trying to add the custom job to the Government but it gives me this, it doesn’t allow the commands they can use like /wanted or warrant

GAMEMODE.Government= {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,
[TEAM_PoliceOfficer] = false,
}

Are you creating TEAM_PoliceOfficer before GAMEMODE.Government is set?

i.e. Of your two snippets, which one is above the other?

I am trying to add the Police Officer to government so it can get commands as civil protection, The police job shows up in the Government category i just cant get it to use commands like /wanted or /warrnat
Also no i out the gamemode first then i added the jobs.

Looks like this first is:

AMEMODE.Government= {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,

}


TEAM_PoliceOfficer = DarkRP.createJob(“Police Officer”, {
color = Color(0, 0, 0, 255),
model = {“models/player/nypd/male_09.mdl”},
description = [[Protect the city]],
weapons = {“darkrp_handcuffs”, “m9k_remington870”, “stunstick”, “unarrest_stick”, “weaponchecker”, “keys”, “q”, “door_ram”, “m9k_fists”, “m9k_usp”},
command = “PoliceOfficer”,
max = 6,
salary = 100,
admin = 0,
vote = true,
hasLicense = true,
candemote = true,
category = “Government”,
ammo = {
[“item_box_buckshot”] = 120,
[“item_ammo_pistol”] = 120
},
PlayerSpawn = function(ply)
ply:SetMaxHealth(100)
ply:SetHealth(100)
ply:SetArmor(96)
end
})


DarkRP.createCategory{
name = “Government”, – 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.
}

The order should be completely reversed. Also, please use


 tags.

Your saying it should placed as this:
Job first and then the Game mode of

TEAM_PoliceOfficer = DarkRP.createJob(“Police Officer”, {
color = Color(0, 0, 0, 255),
model = {“models/player/nypd/male_09.mdl”},
description = [[Protect the city]],
weapons = {“darkrp_handcuffs”, “m9k_remington870”, “stunstick”, “unarrest_stick”, “weaponchecker”, “keys”, “q”, “door_ram”, “m9k_fists”, “m9k_usp”},
command = “PoliceOfficer”,
max = 6,
salary = 100,
admin = 0,
vote = true,
hasLicense = true,
candemote = true,
category = “Government”,
ammo = {
[“item_box_buckshot”] = 120,
[“item_ammo_pistol”] = 120
},
PlayerSpawn = function(ply)
ply:SetMaxHealth(100)
ply:SetHealth(100)
ply:SetArmor(96)
end
})

GAMEMODE.Government= {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,

}

One more thing i have a category also called government is that affecting this?

Did you modify any core gamemode files? If not, then you will have to leave the table name as CivilProtection. Also, you aren’t adding your job to the table, anyway. And for the last time, PLEASE use


 tags.

it’s either “cp = true,” or “police = true,”

just try both and it should work