• Print

Author Topic: Team / (DarkRP Job) Specific Commands? (For DarkRP)  (Read 8531 times)

0 Members and 1 Guest are viewing this topic.

Offline ItzKaneki

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Team / (DarkRP Job) Specific Commands? (For DarkRP)
« on: February 13, 2016, 04:45:21 am »
(DARKRP): Is there any way I can set it so when a player is a certain job (or team e.g TEAM_CIVILPROTECTION), they can do certain commands / have certain permissions.

I have seen this done (not sure how) but on a DarkRP server, staff on duty could use noclip, god ect but when they are any other job they can't and a message saying: "You have to be on duty in order to use this command".

Any suggestions? <3

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Team / (DarkRP Job) Specific Commands? (For DarkRP)
« Reply #1 on: February 13, 2016, 08:20:17 am »
Well you could just give them the permission to use the command each time they join the job, and then remove the permission if they change jobs or disconnect, but I'm not sure how safe that would be because running lua on map change for example is a pain. If you want you could just make a custom command and then wrap the command's code in this if statement:

Code: Lua
  1. local ply_job = calling_ply:getJobTable().name
  2. if ply_job == "myjobname" then
  3.   --command code
  4. else
  5.   calling_ply:PrintMessage( HUD_PRINTTALK, "You have to be on duty in order to use this command" )
  6. end
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 Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Team / (DarkRP Job) Specific Commands? (For DarkRP)
« Reply #2 on: February 13, 2016, 08:42:53 am »
You could use one of the ULib hooks for this, but it's not natively supported right now.

http://ulyssesmod.net/docs/files/lua/ulib/shared/defines-lua.html#ULibCommandCalled
Experiencing God's grace one day at a time.

Offline ItzKaneki

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Re: Team / (DarkRP Job) Specific Commands? (For DarkRP)
« Reply #3 on: February 13, 2016, 11:23:19 am »
Just wanna point out I haven't learned Lua or whatever yet as I have got by with my KNOWLEDGE (reference) so far... so saying things like "Just use this () or this () and compile into a ()" will just confuse me :P well... mostly.

Offline roastchicken

  • Respected Community Member
  • Sr. Member
  • *****
  • Posts: 476
  • Karma: 84
  • I write code
Re: Team / (DarkRP Job) Specific Commands? (For DarkRP)
« Reply #4 on: February 14, 2016, 07:13:05 am »
If you want to do this, you're going to need to learn lua.
Give a man some code and you help him for a day; teach a man to code and you help him for a lifetime.

  • Print