• Print

Author Topic: Custom Moderator and admin jobs?!  (Read 12985 times)

0 Members and 1 Guest are viewing this topic.

Offline Metaformed

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Custom Moderator and admin jobs?!
« on: February 18, 2015, 07:45:09 am »
So i cam currently setting up Dark RP server, I have this as my code for the Moderator class:

Code: Lua
  1. TEAM_SWAT = DarkRP.createJob("Moderator on Duty", {
  2. color = Color(255, 0, 0, 255),
  3. model = "models/trenchcoat/slow.mdl",    
  4. description = [[You are a moderator on duty, You moderate!]],    
  5. weapons = {},
  6. command = "mod",    
  7. max = 8,  
  8. salary = 100,
  9. admin = 0,
  10. vote = false,
  11. hasLicense = false,
  12. customCheck = function(ply) return ply:GetNWString("usergroup") == "Mod" end
  13. })

It works great right now, all the classes but user can join it, the only problem is, when I set myself to user, I cannot even see it in my f4 jobs menu. EDIT: It now only shows if you are in the ulx group : Mod. Anyone know how to make this work, And how I would replicate this one for Admin on duty?

EDIT: If it has to stay to where It dosent show for users, When the mods are on duty, are they going to be able to be seen by users, with their job names above their heads?
« Last Edit: February 18, 2015, 08:09:56 am by Metaformed »

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Custom Moderator and admin jobs?!
« Reply #1 on: February 18, 2015, 12:02:54 pm »
First, fix your Team name. If you have it named TEAM_SWAT, then if you have an actual SWAT Job with the TEAM_SWAT, then you're pretty much going to break the whole thing.

Second, if you're using ULX, I HIGHLY recommend changing your customCheck to the following:

Code: Lua
  1. customCheck = function(ply) return ply:GetUserGroup() == "Mod" end,
  2. CustomCheckFailMsg = "This job is for Moderators only!"

If you want a fully completed and modified code, this would be it:

Code: Lua
  1. TEAM_MOD = DarkRP.createJob("Moderator on Duty", {
  2. color = Color(255, 0, 0, 255),
  3. model = "models/trenchcoat/slow.mdl",    
  4. description = [[You are a moderator on duty, You moderate!]],    
  5. weapons = {},
  6. command = "mod",    
  7. max = 8,  
  8. salary = 100,
  9. admin = 0,
  10. vote = false,
  11. hasLicense = false,
  12. customCheck = function(ply) return ply:GetUserGroup() == "Mod" or ply:IsAdmin() end,
  13. CustomCheckFailMsg = "This job is for Moderators only!"
  14. })

And you also asked how to add an Admin on Duty job? Well just duplicate and replace with Admin:

Code: Lua
  1. TEAM_ADMIN = DarkRP.createJob("Admin on Duty", {
  2. color = Color(255, 0, 0, 255), -- Modify colour
  3. model = "models/trenchcoat/slow.mdl", -- Change to whatever you want
  4. description = [[You are an admin on duty, You administrate!]],    
  5. weapons = {},
  6. command = "admin",    
  7. max = 8,  
  8. salary = 100,
  9. admin = 1,
  10. vote = false,
  11. hasLicense = false,
  12. customCheck = function(ply) return ply:IsAdmin() end,
  13. CustomCheckFailMsg = "This job is for Admins only!"
  14. })

To make it so the job shows for everyone, go to your settings.lua and on line #367

Code: Lua
  1. GM.Config.hideNonBuyable = true


Change true to false
« Last Edit: February 18, 2015, 03:08:30 pm by syst3M4TiK »
Once you get to know me, you'll find you'll have never met me at all.

Offline Metaformed

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Custom Moderator and admin jobs?!
« Reply #2 on: February 18, 2015, 07:32:42 pm »
First, fix your Team name. If you have it named TEAM_SWAT, then if you have an actual SWAT Job with the TEAM_SWAT, then you're pretty much going to break the whole thing.

Second, if you're using ULX, I HIGHLY recommend changing your customCheck to the following:

Code: Lua
  1. customCheck = function(ply) return ply:GetUserGroup() == "Mod" end,
  2. CustomCheckFailMsg = "This job is for Moderators only!"

If you want a fully completed and modified code, this would be it:

Code: Lua
  1. TEAM_MOD = DarkRP.createJob("Moderator on Duty", {
  2. color = Color(255, 0, 0, 255),
  3. model = "models/trenchcoat/slow.mdl",    
  4. description = [[You are a moderator on duty, You moderate!]],    
  5. weapons = {},
  6. command = "mod",    
  7. max = 8,  
  8. salary = 100,
  9. admin = 0,
  10. vote = false,
  11. hasLicense = false,
  12. customCheck = function(ply) return ply:GetUserGroup() == "Mod" or ply:IsAdmin() end,
  13. CustomCheckFailMsg = "This job is for Moderators only!"
  14. })

And you also asked how to add an Admin on Duty job? Well just duplicate and replace with Admin:

Code: Lua
  1. TEAM_ADMIN = DarkRP.createJob("Admin on Duty", {
  2. color = Color(255, 0, 0, 255), -- Modify colour
  3. model = "models/trenchcoat/slow.mdl", -- Change to whatever you want
  4. description = [[You are an admin on duty, You administrate!]],    
  5. weapons = {},
  6. command = "admin",    
  7. max = 8,  
  8. salary = 100,
  9. admin = 1,
  10. vote = false,
  11. hasLicense = false,
  12. customCheck = function(ply) return ply:IsAdmin() end,
  13. CustomCheckFailMsg = "This job is for Admins only!"
  14. })

To make it so the job shows for everyone, go to your settings.lua and on line #367

Code: Lua
  1. GM.Config.hideNonBuyable = true


Change true to false

Hey when I did that thing for showing for users, It was not on line 367 of my darkrpmodifications settings.lua. I found it on 387 but when I set it to true It made it so nothing showed up in my f4 menu, it was just blanked out.

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Custom Moderator and admin jobs?!
« Reply #3 on: February 19, 2015, 02:09:56 am »
I messed up my edit first go around,  make sure its FALSE
Once you get to know me, you'll find you'll have never met me at all.

Offline Metaformed

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Custom Moderator and admin jobs?!
« Reply #4 on: February 19, 2015, 05:06:31 am »
I messed up my edit first go around,  make sure its FALSE

This is my current code under f4 menu, It now has it where, All the jobs show up If I set myself to user but not the moderator or admin jobs.
Code: Lua
  1. --[[---------------------------------------------------------------------------
  2. F4 menu
  3. ---------------------------------------------------------------------------]]
  4. -- hide the items that you can't buy and the jobs you can't get (instead of graying them out)
  5. -- this option hides items when you don't have enough money, when the maximum is reached for a job or any other reason
  6. GM.Config.hideNonBuyable = false
  7.  
  8. -- Hide only the items that you have the wrong job for (or for which the customCheck says no)
  9. -- When you set this option to true and hideNonBuyable to false, you WILL see e.g. items that are too expensive for you to buy
  10. -- but you won't see gundealer shipments when you have the citizen job
  11. GM.Config.hideTeamUnbuyable = false
  12.  

This is how my current f4 menus section looks, the only problem is, now the players can see shipments that the gun dealers can spawn. How could I fix this?

Offline Caustic Soda-Senpai

  • Sr. Member
  • ****
  • Posts: 469
  • Karma: 54
  • <Insert something clever here>
    • Steam Page
Re: Custom Moderator and admin jobs?!
« Reply #5 on: February 19, 2015, 10:30:54 am »
change

Code: Lua
  1. GM.Config.hideTeamUnbuyable = false

to true
Once you get to know me, you'll find you'll have never met me at all.

Offline Metaformed

  • Newbie
  • *
  • Posts: 5
  • Karma: 0
Re: Custom Moderator and admin jobs?!
« Reply #6 on: February 19, 2015, 07:16:16 pm »
change

Code: Lua
  1. GM.Config.hideTeamUnbuyable = false

to true

Still shows up in f4 menus as citizen or any other job, just grayed out so it cannot be spawned.  :-\

EDIT: Nevermind, I had to fully restart the server, It now works, fully. Thanks for all the help  ;)
« Last Edit: February 19, 2015, 07:23:11 pm by Metaformed »

  • Print