• Job lua error
    6 replies, posted
Hi guys ! First time trying to make a server so I run into faults here and there which I usually correct by already made threads/tutorials. However I have met a problem with my job LUA file, and I think I need a second pair of eyes to see my own fault. Error: [CODE][ERROR] Lua is unable to understand file "darkrp_customthings/jobs.lua" because its author made a mistake around line number 46. The best help I can give you is this: Right before the ')', Lua encountered something it could not make sense of. Hints: - Did you forget something here? (Perhaps a closing bracket) - Is it a typo? ------- End of Simplerr error ------- [/CODE] Line 46= category = "Civil Protection", Job Lua: [CODE] TEAM_SERGEANT = DarkRP.createJob("PD Sergeant"), { color = Color(50, 150, 220, 255), model = "models/gta5/player/trooper.mdl", description = [[PD Sergeant <WHITELISTED ONLY> Is the second highest in command of the PD. They will use the same car as the other PD members, however have a undercover car available to use aswell. Sergeants has access to fine system/extra jail time.]], weapons = {"cw_ar15", "m9k_m61_frag", "weapon_stungun", "cw_g4p_usp40", "arrest_stick", "unarrest_stick", "stunstick", "door_ram", "weaponchecker"}, command = "Sergeant", max = 6, salary = 200, admin = 0, vote = false, hasLicense = true, PlayerLoadout = function( ply ) return ply:SetArmor( 50 ) end, candemote = true, help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", }) TEAM_CHIEF = DarkRP.createJob("PD Chief"), { color = Color(50, 150, 180, 255), model = "models/gta5/player/trooper.mdl", description = [[PD Chief <WHITELISTED ONLY> Is the second highest in command of the PD. They will use the same car as the other PD members, however have a undercover car available to use aswell. Sergeants has access to fine system/extra jail time.]], weapons = {"cw_ar15", "m9k_m61_frag", "m9k_m79gl", "weapon_stungun", "cw_g4p_usp40", "arrest_stick", "unarrest_stick", "stunstick", "door_ram", "weaponchecker"}, command = "Chief", max = 1, salary = 230, admin = 0, vote = false, chief = true, hasLicense = true, PlayerLoadout = function( ply ) return ply:SetArmor( 80 ) end, candemote = true, help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", }) TEAM_PATROL = DarkRP.createJob("PD Patrol unit"), { color = Color(90, 150, 190, 255), model = { "models/ccz/cop1.mdl", "models/ccz/cop2.mdl", "models/ccz/cop3.mdl", "models/ccz/cop4.mdl", "models/ccz/cop7.mdl", "models/ccz/cop9.mdl", "models/ccz/femalecop2.mdl", "models/ccz/femalecop1.mdl" }, description = [[The Patrol unit is the lowest ranked within the Police Department. You are not allowed to become corrupt and must serve and protect the people. The Class is equipped with the standard Police officer set, Pistol, Battering Ram, Arrest tools and you are entrusted with a Patrol Car. Join the Teamspeak for communication <CivilLife.voice.com>]], weapons = {"cw_g4p_usp40", "arrest_stick", "unarrest_stick", "stunstick", "door_ram", "weaponchecker"}, command = "Patrol", max = 4, salary = 85, admin = 0, vote = true, hasLicense = true, PlayerLoadout = function( ply ) return ply:SetArmor( 10 ) end, candemote = true, help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", }) TEAM_CORPORAL = DarkRP.createJob("PD Corporal"), { color = Color(90, 150, 190, 255), model = { "models/ccz/cop1.mdl", "models/ccz/cop2.mdl", "models/ccz/cop3.mdl", "models/ccz/cop4.mdl", "models/ccz/cop7.mdl", "models/ccz/cop9.mdl", "models/ccz/femalecop2.mdl", "models/ccz/femalecop1.mdl" }, description = [[PD Corporal <WHITELISTED ONLY> This rank is the second lowest ranked of the PD force. They have the same equipment set as the Patrol unit but at a higher level, meaning a better pistol and most likely a taser aswell. They have access to fine system and extended jail time. They will use the same car as the Patrol unit, but is higher ranked and can therefore order Patrol units within reason if needed only. ]], weapons = {"cw_g4p_usp40", "arrest_stick", "weapon_stungun", "cw_ar15", "unarrest_stick", "stunstick", "door_ram", "weaponchecker"}, command = "Corporal", max = 10, salary = 150, admin = 0, vote = false, hasLicense = true, PlayerLoadout = function( ply ) return ply:SetArmor( 30 ) end, candemote = true, help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", }) [/CODE] I am sure it is something simple that I am missing, but it is really annoying and I think I stare myself blind on the obvious error that I have. Hope that you can help me, thanks in advance Regards Holmenlund
You should have a comma after every variable in the table, before declaring your next variable. This doesn't change, when you have a table inside a table. Simply: [CODE] help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", [/CODE]
[QUOTE=mindfulhacker;48445223]You should have a comma after every variable in the table, before declaring your next variable. This doesn't change, when you have a table inside a table. Simply: [CODE] help = { "Please don't abuse your job", "When you arrest someone they are auto transported to jail.", "They are auto let out of jail after some time", "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" }, category = "Civil Protection", [/CODE][/QUOTE] Thanks for that m8 ! didn't notice it, however I still seem to have an open bracket somewhere in the line, I have updated the code and the error message. Thanks anyone who might help me out ^^
Why is there a ')' after '}' in line 48? [editline]13th August 2015[/editline] Why is there a ')' after }' on every single job table ending???
Aren't those supposed to be there? To close the job name? Like this? [code] 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. Raid = No Mug = No]], weapons = {}, command = "citizen", max = 0, salary = 25, admin = 0, vote = false, hasLicense = false, candemote = false }) [/code]
[QUOTE=JasonMan34;48449594]Why is there a ')' after '}' in line 48? [editline]13th August 2015[/editline] Why is there a ')' after }' on every single job table ending???[/QUOTE] Because they terminate the argument list in a function call statement.
The issue with your jobs, are that you close the jobs way too early, like ("Citizen"), { instead of ("Citizen", { and then the }) all the way at the bottom. AFAIK that will never work
Sorry, you need to Log In to post a reply to this thread.