Ulysses

Ulysses Stuff => General Chat & Help and Support => Topic started by: JackYack13 on December 07, 2011, 12:23:16 PM

Title: [SOLVED] Custom permissions
Post by: JackYack13 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.
Title: Re: Custom permissions
Post by: Megiddo 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.
Title: Re: Custom permissions
Post by: strategos 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
Title: Re: Custom permissions
Post by: JackYack13 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".
Title: Re: Custom permissions
Post by: JackYack13 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.