Ulysses

General => Developers Corner => Topic started by: blackfire88 on January 11, 2012, 08:53:22 PM

Title: Ulx has permission.
Post by: blackfire88 on January 11, 2012, 08:53:22 PM
Hello,
How do I check if a player has a specific permission?
For example if the user can use ulx slay, then a certain toolgun lets them autokill people.
Just as an example.
Title: Re: Ulx has permission.
Post by: Stickly Man! on January 12, 2012, 08:28:48 AM
<player>:query( "accesstag" )

So for example, you would have something like this:

Code: [Select]
local ply = LocalPlayer()
if ply:query( "ulx slay" ) then
    --Kill all the peoples!
end
Title: Re: Ulx has permission.
Post by: blackfire88 on January 12, 2012, 03:48:50 PM
wow thanks stickly man!
Title: Re: Ulx has permission.
Post by: blackfire88 on January 12, 2012, 04:00:06 PM
Could I modify the darkrp code to use that? OR is it a ulx-only based thing.
Title: Re: Ulx has permission.
Post by: JamminR on January 12, 2012, 06:57:45 PM
Technically, it's ULib. You could design any ULib.ucl table query you wanted, as long as you stored permissions/flags in a Ulib table.
That particular example just shows the particular use of how we do the ulx storage for most commands.
See http://ulyssesmod.net/docs/files/lua/ulib/shared/sh_ucl-lua.html#ucl (lots of other Ulib documentation there too of course)
Title: Re: Ulx has permission.
Post by: Aaron113 on January 12, 2012, 07:20:32 PM
Could I modify the darkrp code to use that? OR is it a ulx-only based thing.
If you're good, you could make your own.  Shouldn't be too hard if you know what you're doing.

I am actually probably going to do something similar to this for URS.
Title: Re: Ulx has permission.
Post by: blackfire88 on January 13, 2012, 09:35:10 PM
DO i have to include ULib to use that function?
Title: Re: Ulx has permission.
Post by: blackfire88 on January 13, 2012, 11:59:04 PM
Because it isnt working :( i tried ply:query("vip") now im trying ULib.ucl.query
Title: Re: Ulx has permission.
Post by: MrPresident on January 14, 2012, 01:22:44 AM
What do you mean it isn't working?


It is supposed to return a boolean value of true or false.

Do you get an error or does it always return a false positive/negative?
Title: Re: Ulx has permission.
Post by: blackfire88 on January 15, 2012, 02:22:45 PM
Dont worry guys I got it working