• Print

Author Topic: Cant get VERY SIMPLE code too work.  (Read 5230 times)

0 Members and 1 Guest are viewing this topic.

Offline Coltonjman

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Cant get VERY SIMPLE code too work.
« on: July 11, 2016, 10:37:18 am »
Im basicly brand new at Lua coding but im not a idiot i think. For the life of me i cant get this Garrys mod custom job too work.

the code i used at first.
TEAM_DANK = DarkRP.createJob("Pika Pika", {
   color = Color(211, 17, 17, 255),
   model = {"models/pokemon/pikachu.mdl"},
   description = [[DANK]],
   weapons = {"m9k_glock"},
   command = "Dank",
   max = 2,
   salary = 250,
   admin = 1,
   vote = true,
   hasLicense = true,
   candemote = true,
   -- CustomCheck
   medic = false,
   chief = false,
   mayor = false,
   hobo = false,
   cook = false,
   category = "Citizens",
})

I could not get that too work at all so then i used the darkRP code its self too see if it even works and nothing.
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,
    category = "Citizens",
})

Heres the error code and under it will be the jobs file its self Thanks for any help at all,

[ERROR] addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:20: ')' expected near 'models'
  1. unknown - addons/darkrpmodification/lua/darkrp_customthings/jobs.lua:0

--[[---------------------------------------------------------------------------
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,
    category = "Citizens",










--[[---------------------------------------------------------------------------
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_POLICE] = true,
   [TEAM_CHIEF] = true,
   [TEAM_MAYOR] = true,
}

--[[---------------------------------------------------------------------------
Jobs that are hitmen (enables the hitman menu)
---------------------------------------------------------------------------]]
DarkRP.addHitmanTeam(TEAM_MOB)



Offline Michael Brady

  • Newbie
  • *
  • Posts: 12
  • Karma: -3
Re: Cant get VERY SIMPLE code too work.
« Reply #1 on: July 11, 2016, 10:54:22 am »
now because you didn't put that in the code format (I dont know how to do this either so it can be forgiven) its harder to tel where the error is but its on line 20
heres a working job that should help you

EAM_MOB = DarkRP.createJob("Mob boss", {
   color = Color(25, 25, 25, 255),
   model = "models/player/gman_high.mdl",
   description = [[Command your gang or ride alone.]],
   weapons = {"lockpick", "unarrest_stick", "m9k_coltpython", "weapon_arc_atmcard"},
   command = "mobboss",
   max = 1,
   salary = 50,
   admin = 0,
   vote = false,
   hasLicense = false,
   category = "Criminals",
})



Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Cant get VERY SIMPLE code too work.
« Reply #2 on: July 11, 2016, 12:30:58 pm »
First of all, use the  tags to capture code and make it much neater.

Secondly, I noticed in the second part:
Code: Lua
  1. --[[---------------------------------------------------------------------------
  2. DarkRP custom jobs
  3. ---------------------------------------------------------------------------
  4.  
  5. This file contains your custom jobs.
  6. This file should also contain jobs from DarkRP that you edited.
  7.  
  8. Note: If you want to edit a default DarkRP job, first disable it in darkrp_config/disabled_defaults.lua
  9.    Once you've done that, copy and paste the job to this file and edit it.
  10.  
  11. The default jobs can be found here:
  12. https://github.com/FPtje/DarkRP/blob/master/gamemode/config/jobrelated.lua
  13.  
  14. For examples and explanation please visit this wiki page:
  15. http://wiki.darkrp.com/index.php/DarkRP:CustomJobFields
  16.  
  17.  
  18. Add jobs under the following line:
  19. ---------------------------------------------------------------------------]]
  20. TEAM_CITIZEN = DarkRP.createJob("Citizen", {
  21.     color = Color(20, 150, 20, 255),
  22.     model = {
  23.         "models/player/Group01/Female_01.mdl",
  24.         "models/player/Group01/Female_02.mdl",
  25.         "models/player/Group01/Female_03.mdl",
  26.         "models/player/Group01/Female_04.mdl",
  27.         "models/player/Group01/Female_06.mdl",
  28.         "models/player/group01/male_01.mdl",
  29.         "models/player/Group01/Male_02.mdl",
  30.         "models/player/Group01/male_03.mdl",
  31.         "models/player/Group01/Male_04.mdl",
  32.         "models/player/Group01/Male_05.mdl",
  33.         "models/player/Group01/Male_06.mdl",
  34.         "models/player/Group01/Male_07.mdl",
  35.         "models/player/Group01/Male_08.mdl",
  36.         "models/player/Group01/Male_09.mdl"
  37.     },
  38.     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.]],
  39.     weapons = {},
  40.     command = "citizen",
  41.     max = 0,
  42.     salary = GAMEMODE.Config.normalsalary,
  43.     admin = 0,
  44.     vote = false,
  45.     hasLicense = false,
  46.     candemote = false,
  47.     category = "Citizens",
  48. }) -- <<< YOU FORGOT THESE HERE <<<
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. --[[---------------------------------------------------------------------------
  59. Define which team joining players spawn into and what team you change to if demoted
  60. ---------------------------------------------------------------------------]]
  61. GAMEMODE.DefaultTeam = TEAM_CITIZEN
  62.  
  63.  
  64. --[[---------------------------------------------------------------------------
  65. Define which teams belong to civil protection
  66. Civil protection can set warrants, make people wanted and do some other police related things
  67. ---------------------------------------------------------------------------]]
  68. GAMEMODE.CivilProtection = {
  69.    [TEAM_POLICE] = true,
  70.    [TEAM_CHIEF] = true,
  71.    [TEAM_MAYOR] = true,
  72. }
  73.  
  74. --[[---------------------------------------------------------------------------
  75. Jobs that are hitmen (enables the hitman menu)
  76. ---------------------------------------------------------------------------]]
  77. DarkRP.addHitmanTeam(TEAM_MOB)

You don't have a closing '})' to finish the job. I've gone ahead and added it in for you, if should work unless there's something else wrong in there I didn't notice. Also, the error was being thrown at such a high level because of how model works, and it ends with a '}' (which, as you didn't finish it below, it expected as the finish and was missing the ')')


EDIT: I just noticed something else. For the first "Pika Pika" job, as you only have one model there and you have it in a table ({}'s). Maybe that's why it wasn't working. It DOES need to be in quotes still.
« Last Edit: July 11, 2016, 12:38:07 pm by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

  • Print