ULX

Author Topic: Temporary user group change  (Read 10545 times)

0 Members and 1 Guest are viewing this topic.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Temporary user group change
« Reply #15 on: July 02, 2011, 03:08:10 PM »
What Stickly said, I don't see any problem with "hijacking" a function like that. I do it with some of the default gmod functions in fact. As long as you're still calling the original function, it's pretty much like a very specific hook. It's just not something I recommend in general since very few people can even get return values from hooks right...
Experiencing God's grace one day at a time.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6213
  • Karma: 394
  • Project Lead
Re: Temporary user group change
« Reply #16 on: July 03, 2011, 09:12:01 AM »
After reviewing the source, I remember why I didn't have UCLCHANGED pass in more information. Each place I call it (about ten locations) would be using a slightly different format for the hook parameters. I'd be implementing a function-level hook, so it's way easier for both me and other devs to hook into the function as discussed above.

They're designed to be easy to hook into! All functions throw errors on invalid calls, so you don't need to worry about picking up on a false positive. The exception to this is userallow and groupallow which will return a boolean stating whether or not anything actually changed.

EDIT: Basically, the ucl changed hook was only meant as a high level, "Hey! Access has changed! You should refresh your cache!", so that you don't have to hook into these ten different functions.
« Last Edit: July 03, 2011, 09:25:27 AM by Megiddo »
Experiencing God's grace one day at a time.