ULX

Author Topic: A way to check a users specific access table?  (Read 3365 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
A way to check a users specific access table?
« on: December 13, 2007, 08:07:12 PM »
Is there a Ulib way to check to see if a certain player has a specific access in their allow table?

I've noticed how if you use something like.. ulx userallow <player> "blahblah1" it will add blahblah1 to their list of allows. I thought this would be a GREAT way to use flags in ULX. With a little bit of modification to a tool or Server Entity file, you could have it check for these flags before allowing them to use/spawn the entity/tool.

Right now, Im using IsUserGroup("blah") to do this, but it only will work for groups I set in there.. where this would be soo much better and could even be done dynamically.. while in game and to users as opposed to groups..

something like this...

**ply is assumed to be the player and already defined by the function you are modifying... This example would be to my Fairy ENT.**

If !ulib.hasaccess(ply,"fairy") then
     ulib.tsay(ply,"Sorry, this entity is reserverd for donators and administrators only.", true)
     return
end


then you could just add "fairy" to all the groups in your groups.txt file to the allows to give them access... This would also let you use the

ulx userallow
and
ulx userdeny
commands to give and revoke these flags in game and without editing any files at all.


I think there has to already be a function like this, because you have tools and commands that can be given to players in game that is saved to the users.txt file and some function has to check if they ahve these accesses.

right?

*crosses fingers*

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: A way to check a users specific access table?
« Reply #1 on: December 13, 2007, 09:41:10 PM »
Yes, allows and denies are essentially flags and your idea would be a perfectly legitimate use for them.
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: A way to check a users specific access table?
« Reply #2 on: December 13, 2007, 10:07:16 PM »
lol.. i was asking you what the ulib command for checking if a user had a flag was.. =) If there was one already.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: A way to check a users specific access table?
« Reply #3 on: December 13, 2007, 10:26:09 PM »
ply:query( "flag" )
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: A way to check a users specific access table?
« Reply #4 on: December 13, 2007, 10:33:20 PM »
ply:query( "flag" )


sweet.. I actually just found it in the ULib files..

ulib.ucl.query(ply, access, hide)

but you say ply:query( "flag" ) will work?
Thanks a lot for your help Meg.. Im starting to do everything I've always wanted to be able to do with ULX.. it's a LOT more powerful than I had imagined previously.


::Edit::
Awesome.. it works just like I want.. even though it requires a little bit of editing inside the tools and entities config files.. this is a MUCH better method than ulx toolallow and ulx tooldeny.. because it will save accross sessions.. Thanks so much!
« Last Edit: December 13, 2007, 10:49:21 PM by zakap »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: A way to check a users specific access table?
« Reply #5 on: December 13, 2007, 10:51:02 PM »
Thanks a lot for your help Meg.. Im starting to do everything I've always wanted to be able to do with ULX.. it's a LOT more powerful than I had imagined previously.

Spread the word! We've been mostly disappointed that other authors haven't caught on yet. It's a sweet deal offered with no strings attached (except you can't charge for it). ;)

Yes, ply:query() will work too because I stuck it in the player meta table a while back. You won't see me write any code with that version because I like to maintain consistency across the code, but there's no reason why you can't.
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: A way to check a users specific access table?
« Reply #6 on: December 13, 2007, 11:00:11 PM »
You see, I have extra "tools and ents" that are easliy abusable but mainly for fun installed.. well I do now. These are things that I provide to people who donate, but we also have a point system as you probably know because of our timespent script that you didn't like =) SO now, with this flag system I have a way to provide these non essential but fun tools and SENTs to people in exchange for their points they've won in competitions.

I've been wishing you guys would add this for a long time.. never actually knowing that it was already included.. even though, up until recently I wouldn't have known how to do it anyways.

This also gives me a way to deny a donating member a tool if they abuse it.. where as before since all it did was assign them by groups with IsUserGroup, I couldn't do that without changing their group.