• Print

Author Topic: Job relation to staff rank, (Access relationships).  (Read 5223 times)

0 Members and 1 Guest are viewing this topic.

Offline aussie0411

  • Newbie
  • *
  • Posts: 4
  • Karma: 0
Job relation to staff rank, (Access relationships).
« on: June 13, 2016, 09:45:58 am »
So practically I am helping a server owner out and I forgot what the command line is for a job to make it to where it simply can be accessed by a certain ulx rank plus. So, for example, I want ARC Captain on a SWRP server to be switched to if you're either mod plus or you're whitelisted to the job. How do I make it to where you can join all jobs if you are Moderator or up? Whats the command line for that?

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Job relation to staff rank, (Access relationships).
« Reply #1 on: June 13, 2016, 10:05:33 am »
I don't know how it would be for Star Wars RP, but I remember when I was a dev for a DarkRP server, it was something like:

Code: Lua
  1. customCheck = function(ply) return ply:GetUserGroup() == "Moderator" end,

However, I'm not sure if customCheck is the correct thing you need, nor do I know if it will allow anyone above "Moderator" as well. (Remember, GetUserGroup() is case-sensitive, so if the role is 'moderator' it must be "moderator").


Edit: After looking around for a quite a bit it seems they're pretty similar (if not the same), is the first line of your custom ranks
Code: Lua
  1. DarkRP.createJob( "name", {
? Because if so, put the line I put above at the very bottom (under the category = ) but before the closing }


Like I said, I could be wrong bc I don't know how SWRP works :P
« Last Edit: June 13, 2016, 10:21:07 am by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline dankpepe

  • Jr. Member
  • **
  • Posts: 51
  • Karma: 1
Re: Job relation to staff rank, (Access relationships).
« Reply #2 on: June 13, 2016, 10:23:11 am »
It would actually be

Code: Lua
  1. customCheck = function(ply) return ply:CheckGroup("Moderator") end,
  2.  

 

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Job relation to staff rank, (Access relationships).
« Reply #3 on: June 13, 2016, 10:24:02 am »
It would actually be

Code: Lua
  1. customCheck = function(ply) return ply:CheckGroup("Moderator") end,
  2.  

 

CheckGroup() isn't a function... it would just return as nil because it doesn't exist.
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline dankpepe

  • Jr. Member
  • **
  • Posts: 51
  • Karma: 1
Re: Job relation to staff rank, (Access relationships).
« Reply #4 on: June 13, 2016, 10:26:50 am »
CheckGroup is a ulx function which checks if a user is a rank or inherits from that rank. The code you have would only work if the user is a mod but not if they inherit from mod.

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Job relation to staff rank, (Access relationships).
« Reply #5 on: June 13, 2016, 10:29:03 am »
CheckGroup is a ulx function which checks if a user is a rank or inherits from that rank. The code you have would only work if the user is a mod but not if they inherited from mod.
Oh, I was checking the Gmod wiki, I tend to not use ULib things for that as not everyone uses ULX (even though I'd assume this person is) so I tend to use GetUserGroup() or IsUserGroup().
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Job relation to staff rank, (Access relationships).
« Reply #6 on: June 13, 2016, 01:28:48 pm »
We're on the forums for ULib/ULX. It's safe to assume anyone posting here asking for help with groups is using ULib/ULX
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

Offline dankpepe

  • Jr. Member
  • **
  • Posts: 51
  • Karma: 1
Re: Job relation to staff rank, (Access relationships).
« Reply #7 on: June 13, 2016, 03:23:22 pm »
Also he aid he was using ulx.

  • Print