Ulysses

General => Developers Corner => Topic started by: daniel507 on April 18, 2013, 11:06:15 AM

Title: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 18, 2013, 11:06:15 AM
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
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 19, 2013, 07:20:14 AM
Please tell us what errors you are getting. Also, your topic was locked. Not sure if this was an error. I'm unlocking it.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 22, 2013, 10:43:09 AM
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:
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 22, 2013, 03:32:10 PM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 23, 2013, 12:53:37 PM
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!
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 24, 2013, 10:30:15 AM
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?!
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 27, 2013, 11:21:49 PM
bump
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 28, 2013, 12:15:25 AM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 12:02:20 PM
[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 :/
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 29, 2013, 12:22:00 PM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 12:36:33 PM
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
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 29, 2013, 12:42:11 PM
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)
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 12:45:44 PM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 12:49:46 PM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 29, 2013, 01:13:10 PM
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.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 01:19:05 PM
What do you recommend me to do? i might delete the whole DarkRP folder and replace it with a new one.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: MrPresident on April 29, 2013, 02:01:59 PM
I honestly don't know. I have 0% experience with DarkRP.

Try removing that entire block of code

Code: [Select]
if CLIENT then

if LocalPlayer():IsUserGroup("donator") or LocalPlayer():IsAdmin() then
TEAM_MTHEIF = AddExtraTeam("Master Thief", Color(150, 153, 0, 150), "models/player/arctic.mdl" , [[You are a faster and stronger thief. use your lockpick and keypad cracker to
get into peoples homes]], {"lockpick", "keypad_cracker"}, "mastertheif", 2, 150, 0, false, false)

TEAM_PARKOUR = AddExtraTeam("Parkour", Color(150, 140, 0, 130), "models/player/arctic.mdl" ,[[You are able to sneak up on you enimies and raid while they
dont expect it]], {"lockpick", "climb_swep"}, "parkour", 2, 135, 0, false, false)
end

end

and see if you still get any errors.
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 29, 2013, 02:02:33 PM
K ill do that tommorow
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 30, 2013, 08:34:27 AM
I deleted that and i get no errors :/
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on April 30, 2013, 08:41:55 AM
I am just going to remove DarkRP folder and replace with new one, then try the shared.lua then
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: nathan736 on April 30, 2013, 08:59:35 AM
theres a tutorial for this on the dark rp wiki i believe  #quick post
Title: Re: Lua errors after using function(ply) return ply:IsUserGroup("donator") end)
Post by: daniel507 on May 01, 2013, 08:53:15 AM
Nah i tried everything, making deathrun server now and it's looking pretty sleek, just tryinng to work out how to get custom models :/ ip - 91.121.31.16:27015 - it's  not properly finished yet :P

Thanks to everyone who helped me :) especially Mr.President thanks!

Thread Closed