General > Developers Corner
Is it possible to be in multiple ULX groups at the same time?
LightSiderDelta:
--- Quote from: Bytewave on February 18, 2016, 11:33:12 AM ---Don't DarkRP jobs have a CustomCheck function for whitelisting? Or are you not using that?
--- End quote ---
I tried using custom check, this is what I did for that the other day
I was making class "Clone Trooper" The individual whitelisting worked for it, but admins didnt have access because they were were in the admin group
customCheck = function(ply) return ply:GetNWString("usergroup") == "Clone Trooper" and customCheck = function(ply) return ply:GetNWString("usergroup") == "owner" end,
CustomCheckFailMsg = "This job is donator only."
I didn't just have owner there either, I put an and after that and put every admin group, then an end. I just put owner there for the sake of the forum.
I also tried putting a comma after the end, not using a comma after end, etc. On my server it said it was expecting the read "end" before "=". I have no idea what it's trying to say, and I have tried many variations of this code.
roastchicken:
A flexible way to do this would be to have your job check for a specific permission sting. That was you can assign that permission string to any group(s) or people that you want to have access.
Bytewave:
--- Quote from: LightSiderDelta on February 18, 2016, 12:23:09 PM ----snip-
--- End quote ---
--- Code: ---customCheck = function(ply) return ply:GetNWString("usergroup") == "Clone Trooper" and customCheck = function(ply) return ply:GetNWString("usergroup") == "owner" end,
CustomCheckFailMsg = "This job is donator only."
--- End code ---
There's a major flaw in your code there.
--- Code: ---customCheck = function(ply) --[[ ... ]]-- and customCheck = function(ply) --[[ ... ]]-- end
--- End code ---
While this makes sense grammatically, this is invalid in Lua's syntax.
You should instead write something like:
--- Code: ---customCheck = function(ply)
return ply:GetUserGroup() == "Storm Trooper" or ply:GetUserGroup() == "owner"
end
--- End code ---
This assumes, of course, that you want inheritance to be negligible, and ONLY the groups Storm Trooper and owner should be able to take this job.
The long-winded explanation is that, in Lua, a variable cannot contain two values like you seem to want it to have there. Instead, variables (or fields, like customCheck) may only have one value (or in this case, may only be one function). You tried to assign two functions to one variable and, moreover, forgot to close the initial function before moving on to the next.
I would recommend doing some reading on the Lua programming language. It's actually not too hard to get into, and would help you immensely in working with servers.
LightSiderDelta:
Okay, Thanks everyone who helped!
Ihremutter:
--- Quote from: roastchicken on February 18, 2016, 12:43:29 PM ---A flexible way to do this would be to have your job check for a specific permission sting. That was you can assign that permission string to any group(s) or people that you want to have access.
--- End quote ---
I hate to resurrect the dead but can anyone possibly tell me how to run a check like this? If I can just assign my "SMODs" the "Bronze" permission, then all would be solved with this issue.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version