Author Topic: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)  (Read 7518 times)

0 Members and 1 Guest are viewing this topic.

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
Hi, i have recently made a dark RP server which has ULX on. I was thinking of making a donator group which were able to see donator jobs. i have made the group called "donator" but when i start using " function(ply) return ply:IsUserGroup("donator") end)" under the jobs i want to make donator. I get a load of LUA errors and there is no jobs at all appearing.

Please check out my Shared.lua and tell me what i have done wrong.

Thanks
« Last Edit: April 22, 2013, 10:41:54 AM by daniel507 »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Please tell us what errors you are getting. Also, your topic was locked. Not sure if this was an error. I'm unlocking it.

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
I can usually fix lua errors but this one doesn't make sense -

[ERROR] gamemodes/darkrp/gamemode/shared.lua:103: ')' expected (to close '(' at line 102) near '}'
  1. unknown - gamemodes/darkrp/gamemode/shared.lua:
« Last Edit: April 22, 2013, 12:14:46 PM by daniel507 »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Unless I'm missing something you posted this as your code in yours first post...

Code: [Select]
function(ply) return ply:IsUserGroup("donator") end)


Take a look. The error says that there is an unexpected ")"

If your code you have a ")" after the end but there is no opening parenthesis anywhere in your code.


Cope line 103 exactly as you have it in your code.

I looked at your shared.lua you posted. Take out that } at the end of your function. it shouldn't be end}) .. just .. end)

Hopefully that makes sense and fixes your issue.
« Last Edit: April 22, 2013, 03:34:54 PM by MrPresident »

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
Thanks, you taught me something that will help me in the future and i thank you very much for helping me resolve this problem :D. Great Admin +1!

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
New problem lol, everything was working fine but it has suddenly just gave the jobs to everyone. the script is there but it is not abiding by it. There are no script errors so i don't know what the problem is?!

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
bump

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Reading into the commented section of that file you provided: I hate to be the one to break this to you, but the AddExtraTeam function is not designed to do what you are trying to do.

You would need to modify the AddExtraTeam function to include a boolean argument for what groups can see this team.


ALTERNATELY you can try this..  I have NO idea if it will work or not, as I do not endorse DarkRP and will never run it to test scripts. You can feel free to try this though and see if it works.

I have modified your shared file and it is attached to this post.

Feel free to post any errors you receive and I will help you to the best of my ability.

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
[ERROR] gamemodes/darkrp/gamemode/shared.lua:117: attempt to call method 'IsUserGroup' (a nil value)
  1. unknown - gamemodes/darkrp/gamemode/shared.lua:117
   2. include - [C]:-1
    3. unknown - gamemodes/darkrp/gamemode/cl_init.lua:86

the donator jobs are not available for normal users which is good but they are now not even available to donators :/

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
If you change the file I posted then post the new file. Line 117 in the file I edited for you doesn't even have IsUserGroup in it.

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
i did, i downloaded your file and put it straight into server. Strangely it was the same size though? I didn't get that error before so that has to be your new modded one

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Right.. but your error code says:
Code: [Select]
[ERROR] gamemodes/darkrp/gamemode/shared.lua:117: attempt to call method 'IsUserGroup' (a nil value)
But in the file I sent you, line 117 is:
Code: [Select]
If you are caught, run and don't gun your way out.]], {"lockpick"}, "thief", 3, 90, 0, false, false)

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
Yep, your right but sometimes lua scripts are creating  errors and they don't know exactly where its from, so i says roughly line 117. Which i have experienced before.

Offline daniel507

  • Newbie
  • *
  • Posts: 21
  • Karma: 0
BTW it is definitely you shared.lua i even opened it up with notepad+ and i have seen what you have done which is brilliant but seems to have a weird error.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
There has to be something messing up in your code.

I ran this on myself in a listen server with allowcslua turned on:

Code: [Select]
] lua_run_cl print(LocalPlayer():IsUserGroup("user") or LocalPlayer():IsAdmin())

and it returned true, not an error.

I don't like how DarkRP does the class setups. The code is almost impossible to read. There might be something throwing an error somewhere else in the code and its not terminating until line 117.