• DarkRP lua errors when adding customized police class to jobs.lua (after disabling default cp)
    4 replies, posted
[CODE] [ERROR] addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:32: attempt to index field 'Config' (a nil value) 1. unknown - addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:32 2. include - [C]:-1 3. loadCustomDarkRPItems - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:112 4. v - gamemodes/darkrp/gamemode/libraries/modificationloader.lua:120 5. Call - lua/includes/modules/hook.lua:82 6. unknown - lua/includes/modules/gamemode.lua:40 7. DeriveGamemode - [C]:-1 8. unknown - gamemodes/darkrp/gamemode/cl_init.lua:5 [/CODE]
Post the job
[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_MAYOR = DarkRP.createJob("Mayor", { color = Color(94, 54, 255, 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 /lottery <cost> to start a lottery. 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 = GM.Config.normalsalary * 1.89, admin = 0, vote = true, hasLicense = false, mayor = true, help = { "Type /warrant [Nick|SteamID|Status ID] to set a search warrant for a player.", "Type /wanted [Nick|SteamID|Status ID] to alert everyone to a wanted suspect.", "Type /unwanted [Nick|SteamID|Status ID] to clear the suspect.", "Type /lockdown to initiate a lockdown", "Type /unlockdown to end a lockdown", "Type /placelaws to place a screen containing the laws.", "Type /addlaw and /removelaw to edit the laws.", "Type /lottery [Cost to buy in] to start a lottery." }, PlayerDeath = function(ply, weapon, killer) if( ply:Team() == TEAM_MAYOR ) then ply:changeTeam( GAMEMODE.DefaultTeam, true ) for k,v in pairs( player.GetAll() ) do v:PrintMessage( HUD_PRINTCENTER, "The mayor has been killed!" ) end end end }) TEAM_HITMAN = DarkRP.createJob("Hitman", { color = Color(102, 0, 0, 255), model = "models/player/leet.mdl", description = [[As a hitman, you recieve hit requests from people." If you accept the hit request, you must kill the designated person. You start with a gun license, but you must purchase your own weapon. Don't get caught killing your target, you may get arrested.]], weapons = {}, command = "hitman", max = 1, salary = GM.Config.normalsalary, admin = 0, vote = false, hasLicense = true, }) TEAM_HOBO = DarkRP.createJob("Hobo", { color = Color(128, 60, 0, 255), model = "models/player/corpse1.mdl", description = [[The lowest member of society. Everybody laughs at you. You have no home. Beg for your food and money Sing for everyone who passes to get money Make your own wooden home somewhere in a corner or outside someone else's door]], weapons = {"weapon_bugbait"}, command = "hobo", max = 0, salary = 0, admin = 0, vote = false, hasLicense = false, candemote = false, hobo = true }) TEAM_POLICE = DarkRP.createJob("Police Officer", { color = Color(0, 38, 255, 255), model = {"models/player/riot.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. Type /wanted <name> to alert the public to the presence of a criminal.]], weapons = {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "weaponchecker"}, command = "cp", max = 2, salary = GM.Config.normalsalary * 1.45, admin = 0, vote = true, hasLicense = true }) /*--------------------------------------------------------------------------- Define which team joining players spawn into and what team you change to if demoted ---------------------------------------------------------------------------*/ GAMEMODE.DefaultTeam = TEAM_CITIZEN /*--------------------------------------------------------------------------- Define which teams belong to civil protection Civil protection can set warrants, make people wanted and do some other police related things ---------------------------------------------------------------------------*/ GAMEMODE.CivilProtection = { [TEAM_MAYOR] = true, [TEAM_POLICE] = true, } /*--------------------------------------------------------------------------- Jobs that are hitmen (enables the hitman menu) ---------------------------------------------------------------------------*/ DarkRP.addHitmanTeam(TEAM_HITMAN) [/CODE] My jobs.lua
Try change: [lua]salary = GM.Config.normalsalary * 1.89,[/lua] to [lua]salary = GAMEMODE.Config.normalsalary * 1.89,[/lua]
Thank you, that worked.
Sorry, you need to Log In to post a reply to this thread.