Jobs work absolutely fine on server until I add anything having to do with restricting access of a job to a specific group. All Jobs are missing from F4 Menu (obviously due to the script error).
Console Error looks like this:
Timer Failed! [Simple][@gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua (line 565)]
[ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:332: Incorrect chat command! command is invalid!
1. error - [C]:-1
2. declareChatCommand - gamemodes/darkrp/gamemode/modules/chat/sh_chatcommands.lua:23
3. addEntityCommands - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:332
4. unknown - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:565
jobs.lua code
[code]
/*---------------------------------------------------------------------------
DarkRP custom jobs
---------------------------------------------------------------------------
This file contains your custom jobs.
This file should also contain jobs from DarkRP that you edited.
Note: If you want to edit a default DarkRP job, first disable it in darkrp_config/disabled_defaults.lua
Once you've done that, copy and paste the job to this file and edit it.
The default jobs can be found here:
[url]https://github.com/FPtje/DarkRP/blob/master/gamemode/config/jobrelated.lua[/url]
For examples and explanation please visit this wiki page:
[url]http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields[/url]
Add jobs under the following line:
---------------------------------------------------------------------------*/
TEAM_CITIZEN = DarkRP.createJob("Citizen", {
color = Color(20, 150, 20, 255),
model = {
"models/player/Group01/Female_01.mdl",
"models/player/Group01/Female_02.mdl",
"models/player/Group01/Female_03.mdl",
"models/player/Group01/Female_04.mdl",
"models/player/Group01/Female_06.mdl",
"models/player/group01/male_01.mdl",
"models/player/Group01/Male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/Male_04.mdl",
"models/player/Group01/Male_05.mdl",
"models/player/Group01/Male_06.mdl",
"models/player/Group01/Male_07.mdl",
"models/player/Group01/Male_08.mdl",
"models/player/Group01/Male_09.mdl"
},
description = [[The Citizen is the most basic level of society you can hold besides being a hobo. You have no specific role in city life.]],
weapons = {},
command = "citizen",
max = 0,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
candemote = false
})
TEAM_POLICE = DarkRP.createJob("Police", {
color = Color(25, 25, 170, 255),
model = {"models/player/police.mdl", "models/player/police_fem.mdl"},
description = [[The protector of every citizen that lives in the city.
You have the power to arrest criminals and protect innocents.
Hit a player with your arrest baton to put them in jail.
Bash a player with a stunstick and they may learn to obey the law.
The Battering Ram can break down the door of a criminal, with a warrant for their arrest.
The Battering Ram can also unfreeze frozen props (if enabled).
Type /wanted <name> to alert the public to the presence of a criminal.]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_m92beretta", "stunstick", "door_ram", "weaponchecker"},
command = "cp",
max = 6,
salary = 24,
admin = 0,
vote = true,
hasLicense = true,
ammo = {
["pistol"] = 60,
}
})
TEAM_POLICE = DarkRP.createJob("FBI", {
color = Color(25, 25, 170, 255),
model = {"models/player/police.mdl", "models/player/police_fem.mdl"},
description = [[The FBI is called in when the police force cannot take on a challenge.]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_m92beretta", "stunstick", "door_ram", "weaponchecker"},
command = "cp",
max = 6,
salary = 24,
admin = 0,
vote = true,
hasLicense = true,
ammo = {
["pistol"] = 60,
}
})
TEAM_GANG = DarkRP.createJob("Sinaloa Cartel Foot Soldier", {
color = Color(75, 75, 75, 255),
model = {
"models/player/Group03/Male_04.mdl",
},
description = [[The lowest person of crime.
A gangster generally works for the El Chapo who runs the Cartel.
The Mob boss sets your agenda and you follow it or you might be punished.]],
weapons = {},
command = "Sinaloa",
max = 6,
salary = 15,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_MOB = DarkRP.createJob("Hitman", {
color = Color(25, 25, 25, 255),
model = "models/player/agent_47.mdl",
description = [[Hitman can be payed to hunt someone down and murder them in cold blood.]],
weapons = {"lockpick", "m9k_m92beretta"},
command = "Hitman",
max = 2,
salary = 50,
admin = 0,
vote = true,
hasLicense = false
})
TEAM_GUN = DarkRP.createJob("Weapons Trader", {
color = Color(255, 140, 0, 255),
model = "models/player/monk.mdl",
description = [[A Gun Dealer is the only person who can sell guns to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "weapontrader",
max = 2,
salary = 75,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_HEAVY = DarkRP.createJob("Heavy Weapons Trader", {
color = Color(138, 75, 8, 255),
model = "models/player/combine_soldier_prisonguard.mdl",
description = [[A Heavy Gun Dealer is the only person who can sell guns to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "Heavytrader",
max = 2,
salary = 75,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_blackmarket = DarkRP.createJob("Black Market Trader", {
color = Color(113, 14, 14, 255),
model = "models/player/guerilla.mdl",
description = [[A underground dealer is the only person who can sell special goods to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "blackmarket",
max = 2,
salary = 85,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_MEDIC = DarkRP.createJob("Medic", {
color = Color(47, 79, 79, 255),
model = "models/player/kleiner.mdl",
description = [[With your medical knowledge you work to restore players to full health.
Without a medic, people cannot be healed.
Left click with the Medical Kit to heal other players.
Right click with the Medical Kit to heal yourself.]],
weapons = {"med_kit"},
command = "medic",
max = 3,
salary = 125,
admin = 0,
vote = false,
hasLicense = false,
medic = true
})
TEAM_CHIEF = DarkRP.createJob("Police Chief", {
color = Color(20, 20, 255, 255),
model = "models/player/combine_soldier_prisonguard.mdl",
description = [[The Chief is the leader of the Civil Protection unit.
Coordinate the police force to enforce law in the city.
Hit a player with arrest baton to put them in jail.
Bash a player with a stunstick and they may learn to obey the law.
The Battering Ram can break down the door of a criminal, with a warrant for his/her arrest.
Type /wanted <name> to alert the public to the presence of a criminal.
Type /jailpos to set the Jail Position]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_remington870", "stunstick", "door_ram", "weaponchecker"},
command = "chief",
max = 1,
salary = 60,
admin = 0,
vote = false,
hasLicense = true,
chief = true,
NeedToChangeFrom = TEAM_POLICE,
ammo = {
["pistol"] = 60,
}
})
TEAM_MAYOR = DarkRP.createJob("Mayor", {
color = Color(150, 20, 20, 255),
model = "models/player/breen.mdl",
description = [[The Mayor of the city creates laws to govern the city.
If you are the mayor you may create and accept warrants.
Type /wanted <name> to warrant a player.
Type /jailpos to set the Jail Position.
Type /lockdown initiate a lockdown of the city.
Everyone must be inside during a lockdown.
The cops patrol the area.
/unlockdown to end a lockdown]],
weapons = {},
command = "mayor",
max = 1,
salary = 250,
admin = 0,
vote = true,
hasLicense = false,
mayor = true
})
TEAM_HOBO = DarkRP.cre
You have two TEAM_POLICE.
and more than two commands "cp"
Next time go to the DarkRP forum.
The TEAM_POLICE works fine and is meant to be like that, as for the cp command that needs to be fixed. None the less, this does not fix the issue with ranked access. The rest of the code works fine until I add the line
customCheck = function(ply) return table.HasValue({"Owner"}, ply:GetNWString("usergroup")) end,
CustomCheckFailMsg = "This job is accessed by Owners only!"
Do not use table.HasValue; it's wildly expensive.
[QUOTE=ToeJullar;45378707]The TEAM_POLICE works fine and is meant to be like that, as for the cp command that needs to be fixed. None the less, this does not fix the issue with ranked access. The rest of the code works fine until I add the line
customCheck = function(ply) return table.HasValue({"Owner"}, ply:GetNWString("usergroup")) end,
CustomCheckFailMsg = "This job is accessed by Owners only!"[/QUOTE]
Please use the wiki.
Instead of using table.HasValue you could use this
[Code]
TEAM_OWNER = DarkRP.createJob("OWNER", {
color = Color(19, 165, 228, 255),
model = "models/player/brsp.mdl",
description = [[You Know What To Do]],
weapons = {"m9k_winchester73",},
command = "owner",
max = 3,
salary = 85,
admin = 1,
vote = false,
hasLicense = false,
customCheck = function(ply) return CLIENT or ownerJobRanksAllowed[ply:GetNWString("usergroup")] end,
CustomCheckFailMsg = "This job is accessed by Owners only!"
local ownerJobRanksAllowed = { "owner", "peeewpeew" }
})
[/Code]
[QUOTE=Marijuanaman;45381170]Instead of using table.HasValue you could use this
[Code]
TEAM_OWNER = DarkRP.createJob("OWNER", {
color = Color(19, 165, 228, 255),
model = "models/player/brsp.mdl",
description = [[You Know What To Do]],
weapons = {"m9k_winchester73",},
command = "owner",
max = 3,
salary = 85,
admin = 1,
vote = false,
hasLicense = false,
customCheck = function(ply) return CLIENT or ownerJobRanksAllowed[ply:GetNWString("usergroup")] end,
CustomCheckFailMsg = "This job is accessed by Owners only!"
local ownerJobRanksAllowed = { "owner", "peeewpeew" }
})
[/Code][/QUOTE]
That will not work since you are creating the table after you call it, and inside the DarkRP.createJob. Create it at the top of the file.
Also, the table should look like
[code]local ownerJobRanksAllowed = { [ "owner" ] = true, [ "peeewpeew" ] = true }[/code]
-snip-
when I use
[code]
local ownerJobRanksAllowed = { [ "owner" ] = true, [ "peeewpeew" ] = true } -- This is up at top of file
customCheck = function(ply) return CLIENT or ownerJobRanksAllowed[ply:GetNWString("usergroup")] end,
CustomCheckFailMsg = "This job is accessed by Owners only!" -- This is in TEAM_Owners
[/code]
I still get the same problem as in OP. No Jobs showing in F4. Any other suggestions?
I kinda had a feeling, i normally just put all my locals at the top of my jobs.lua file, omg lol such dumb mistakes defs going to do the code in NP instead of right in the box lol thanks for the correction
Uh, you should not return CLIENT. Just return the second parameter.
[QUOTE=code_gs;45381645]Uh, you should not return CLIENT. Just return the second parameter.[/QUOTE]
I've seen a few people return client or *insert check*
Why do people do this? (Question not aimed at you, just a general question)
Well, not sure how but my co owner fixed it! I think Jobs.lua just didnt like my code because the code that is currently working is essentially the same as the original.
Here is the current code that is working
[code]
/*---------------------------------------------------------------------------
DarkRP custom jobs
---------------------------------------------------------------------------
This file contains your custom jobs.
This file should also contain jobs from DarkRP that you edited.
Note: If you want to edit a default DarkRP job, first disable it in darkrp_config/disabled_defaults.lua
Once you've done that, copy and paste the job to this file and edit it.
The default jobs can be found here:
https://github.com/FPtje/DarkRP/blob/master/gamemode/config/jobrelated.lua
For examples and explanation please visit this wiki page:
http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields
Add jobs under the following line:
---------------------------------------------------------------------------*/
TEAM_CITIZEN = DarkRP.createJob("Citizen", {
color = Color(20, 150, 20, 255),
model = {
"models/player/Group01/Female_01.mdl",
"models/player/Group01/Female_02.mdl",
"models/player/Group01/Female_03.mdl",
"models/player/Group01/Female_04.mdl",
"models/player/Group01/Female_06.mdl",
"models/player/group01/male_01.mdl",
"models/player/Group01/Male_02.mdl",
"models/player/Group01/male_03.mdl",
"models/player/Group01/Male_04.mdl",
"models/player/Group01/Male_05.mdl",
"models/player/Group01/Male_06.mdl",
"models/player/Group01/Male_07.mdl",
"models/player/Group01/Male_08.mdl",
"models/player/Group01/Male_09.mdl"
},
description = [[The Citizen is the most basic level of society you can hold besides being a hobo. You have no specific role in city life.]],
weapons = {},
command = "citizen",
max = 0,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
candemote = false
})
TEAM_POLICE = DarkRP.createJob("Police", {
color = Color(25, 25, 170, 255),
model = {"models/player/elispolice/police.mdl"},
description = [[The protector of every citizen that lives in the city.
You have the power to arrest criminals and protect innocents.
Hit a player with your arrest baton to put them in jail.
Bash a player with a stunstick and they may learn to obey the law.
The Battering Ram can break down the door of a criminal, with a warrant for their arrest.
The Battering Ram can also unfreeze frozen props (if enabled).
Type /wanted <name> to alert the public to the presence of a criminal.]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_m92beretta", "stunstick", "door_ram", "weaponchecker"},
command = "cp",
max = 6,
salary = 50,
admin = 0,
vote = true,
hasLicense = true,
ammo = {
["pistol"] = 60,
}
})
TEAM_FBI = DarkRP.createJob("FBI", {
color = Color(25, 25, 170, 255),
model = {"models/player/elispolice/police.mdl"},
description = [[The FBI investigates criminals of the the city.]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_m92beretta", "stunstick", "door_ram", "weaponchecker"},
command = "FBI",
max = 6,
salary = 50,
admin = 0,
vote = true,
hasLicense = true,
NeedToChangeFrom = TEAM_POLICE,
})
TEAM_SPLINTER = DarkRP.createJob("Splinter Cell", {
color = Color(25, 25, 170, 255),
model = {"models/player/archer.mdl","models/player/kestrel.mdl"},
description = [[The Splinter Cell is the best of the best.You work for the mayor
when his police force cant handle a situation.]],
weapons = {"arrest_stick", "unarrest_stick", "m9k_mp5sd", "m9k_m92beretta", "stunstick", "door_ram", "weaponchecker"},
command = "splintercell",
max = 2,
salary = 100,
admin = 0,
vote = true,
hasLicense = true,
NeedToChangeFrom = TEAM_POLICE,
customCheck = function(ply) return table.HasValue({"Owner", "VIP PLUS", "superadmin", "moderator",}, ply:GetNWString("usergroup")) end, -- The extra check function. Enter nil or nothing to not have a restriction
})
TEAM_RAPE = DarkRP.createJob("Rapist", {
color = Color(229, 0, 225, 255),
model = {"models/grandtheftauto5/trevor.mdl",},
description = [[The Rapist lures unsuspecting citizens to his fungeon to play a few games with them in his naked puzzle
basement.]],
weapons = {"weapon_rape"},
command = "rapist",
max = 1,
salary = 25,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return table.HasValue({"Owner", "VIP PLUS", "moderator", "admin", "superadmin",}, ply:GetNWString("usergroup")) end,
customCheckFailMsg = "This Job is For Donators Only!"
})
TEAM_PROTHEIF = DarkRP.createJob("Pro Thief", {
color = Color(0, 0, 0, 255),
model = {"models/player/pd2_chains_p.mdl", "models/player/pd2_dallas_p.mdl", "models/player/pd2_hoxton_p.mdl", "models/player/pd2_wolf_p.mdl",},
description = [[The pro-theif can break into any
house or base to steal what he wants.
But may only kill when raiding.
he also has extra equipment.]],
weapons = {"climb_swep2","keypad_cracker","pro_lockpick"},
command = "protheif",
max = 4,
salary = 150,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return table.HasValue({"Owner", "VIP PLUS", "moderator", "admin", "superadmin",}, ply:GetNWString("usergroup")) end, -- The extra check function. Enter nil or nothing to not have a restriction
})
TEAM_HERO = DarkRP.createJob("Spiderman", {
color = Color(255, 0, 0, 255),
model = {"models/player/tasm2spider.mdl",},
description = [[The Spiderman can stop crime with his bare fists and his trusty webs.]],
weapons = {"m9k_fists", "spiderman's_swep", "climb_swep2"},
command = "Spiderman",
max = 1,
salary = 100,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return table.HasValue({"Owner", "VIP", "VIP PLUS", "moderator", "admin", "superadmin",}, ply:GetNWString("usergroup")) end,
})
TEAM_GANG = DarkRP.createJob("Sinaloa Cartel Foot Soldier", {
color = Color(75, 75, 75, 255),
model = {
"models/player/Group03/Male_04.mdl",
},
description = [[The lowest person of crime.
A gangster generally works for the El Chapo who runs the Cartel.
The Mob boss sets your agenda and you follow it or you might be punished.]],
weapons = {},
command = "Sinaloa",
max = 6,
salary = 15,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_MOB1 = DarkRP.createJob("Hitman", {
color = Color(25, 25, 25, 255),
model = "models/player/agent_47.mdl",
description = [[Hitman can be payed to hunt someone down and murder them in cold blood.]],
weapons = {"lockpick", "m9k_m92beretta"},
command = "Hitman",
max = 2,
salary = 50,
admin = 0,
vote = true,
hasLicense = false
})
TEAM_GUN = DarkRP.createJob("Weapons Trader", {
color = Color(255, 140, 0, 255),
model = "models/player/monk.mdl",
description = [[A Gun Dealer is the only person who can sell guns to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "weapontrader",
max = 2,
salary = 75,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_HEAVY = DarkRP.createJob("Heavy Weapons Trader", {
color = Color(138, 75, 8, 255),
model = "models/grandtheftauto5/michael.mdl",
description = [[A Heavy Gun Dealer is the only person who can sell guns to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "Heavytrader",
max = 2,
salary = 75,
admin = 0,
vote = false,
hasLicense = false
})
TEAM_blackmarket = DarkRP.createJob("Black Market Trader", {
color = Color(113, 14, 14, 255),
model = "models/player/guerilla.mdl",
description = [[A underground dealer is the only person who can sell special goods to other people.
Make sure you aren't caught selling illegal firearms to the public! You might get arrested!]],
weapons = {},
command = "blackmarket
Sorry, you need to Log In to post a reply to this thread.