• Print

Author Topic: How to set jobs for certain groups  (Read 5760 times)

0 Members and 1 Guest are viewing this topic.

Offline Will Creamer

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
How to set jobs for certain groups
« on: March 08, 2015, 09:25:08 pm »
So I wondering. I have made a job "Staff on duty". And i also have a group Moderator. Group Moderator inherits from group user. so when i am making the job there is Admin = 0,1,2ETC... Setting it to 0 makes it where users can become that job. Setting it to 1 makes it to high for moderators to have access. Please help thanks

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: How to set jobs for certain groups
« Reply #1 on: March 09, 2015, 10:24:06 am »
Depending on your ranks...

Code: Lua
  1. customCheck = function(ply) return ply:GetUserGroup() == "moderator" or ply:IsAdmin() end,
  2. customCheckFailMsg = "This job is for Staff only!",
Once you get to know me, you'll find you'll have never met me at all.

Offline Will Creamer

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
Re: How to set jobs for certain groups
« Reply #2 on: March 09, 2015, 12:52:09 pm »
Where would i put that code?

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: How to set jobs for certain groups
« Reply #3 on: March 09, 2015, 03:49:13 pm »
In the job..
Once you get to know me, you'll find you'll have never met me at all.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: How to set jobs for certain groups
« Reply #4 on: March 11, 2015, 01:42:47 pm »
Exmple of my DarkRP staff job:

Code: Lua
  1. TEAM_STAFF = DarkRP.createJob("Staff On Duty", {
  2.     color = Color(0, 0, 0, 255),
  3.     model = {"models/player/combine_super_soldier.mdl"},
  4.     description = [[You are staff on duty! NO RP!!!]],
  5.     weapons = {""},
  6.     command = "staff",
  7.     max = 3,
  8.     salary = 0,
  9.     admin = 0,
  10.     vote = false,
  11.     hasLicense = true,
  12.     customCheck = function(ply) return ply:GetNWString("usergroup") == "Owner" end,
  13.     CustomCheckFailMsg = "This job is for staff only." 
  14. })
  15.  

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: How to set jobs for certain groups
« Reply #5 on: March 11, 2015, 04:48:25 pm »
Player:CheckGroup

Code: [Select]
customCheck = function(ply) return ply:CheckGroup("owner") end
That should do it.  Just change it to whatever rank you want and anything above it will have access.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: How to set jobs for certain groups
« Reply #6 on: March 11, 2015, 10:18:46 pm »

Code: [Select]
customCheck = function(ply) return ply:CheckGroup("owner") end

That may or may not work. DarkRP likes to be picky.
Once you get to know me, you'll find you'll have never met me at all.

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: How to set jobs for certain groups
« Reply #7 on: March 11, 2015, 10:25:19 pm »
As long as the customcheck works the way he has it shown, it should work?  It returns a boolean just like his example does.  I guess it depends on whether he did it correctly or not.

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: How to set jobs for certain groups
« Reply #8 on: March 12, 2015, 11:25:13 am »
For one or more rank to use it the ranks must be seperated by commas.
~The friendly neighborhood duckie~

  • Print