Author Topic: [SOLVED] Custom permissions  (Read 3077 times)

0 Members and 1 Guest are viewing this topic.

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
[SOLVED] Custom permissions
« on: December 07, 2011, 12:23:16 PM »
Hello. I already know how to make custom ulx commands, and now I'd like to find out how to make custom permissions. By that I mean stuff like "ulx physgunplayer", "ulx spawnecho", etc.

For example, I'd like to do something like:
Code: [Select]
if ply has permission "ulx blabla" then
  do stuff
end
But also make it possible to edit the permission for each group with xgui just like the regular ones.

Is it possible? If yes, then could I see an example of how it could be done? Thanks.
« Last Edit: December 11, 2011, 10:19:58 AM by JackYack13 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Custom permissions
« Reply #1 on: December 07, 2011, 04:20:45 PM »
Is this a permission for a command or are you only using it as a flag? EG, "has permission to use reserved slots" would be a flagged permission.
Experiencing God's grace one day at a time.

Offline strategos

  • Jr. Member
  • **
  • Posts: 66
  • Karma: 2
  • I wanna be the guy
    • Community
Re: Custom permissions
« Reply #2 on: December 07, 2011, 05:47:52 PM »
Physgunning would be pretty hard to restrict to any kind of "admin"

Doesn't gmod by default just allow that to 'IsAdmin' and up

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Re: Custom permissions
« Reply #3 on: December 08, 2011, 06:41:49 AM »
Is this a permission for a command or are you only using it as a flag? EG, "has permission to use reserved slots" would be a flagged permission.

I already know how to make commands. I'd like to find out how to make those "flags".

Offline JackYack13

  • Newbie
  • *
  • Posts: 28
  • Karma: -1
Re: Custom permissions
« Reply #4 on: December 11, 2011, 10:18:45 AM »
Never mind. I've figured it out myself after looking at some default ULX lua files. For those of you who are having the same problem:

To create a custom permission: ULib.ucl.registerAccess("name", ULib.ACCESS_ALL, "help string", "category")
To check if a player has the permission: ULib.ucl.query(ply,"name") - this return true or false.