ULX

Author Topic: Rave  (Read 3498 times)

0 Members and 1 Guest are viewing this topic.

Offline [NNJG]Ben

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Rave
« on: February 02, 2010, 07:14:10 PM »
Hello,
I created a ULX group called "donatorplus" and I want to enable ravebreak for them. My rave file is in /garrysmod/lua and I want to know how I can change it to work.
Current code is this, which I am told I should change.
Code: [Select]
function RaveCommand( pl, cmd, args )
if pl:IsAdmin() then
if not Raving then
RaveBreak()
else
pl:ChatPrint("You're already raving dude!")
end

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Rave
« Reply #1 on: February 02, 2010, 09:02:11 PM »
Ben,
Easiest way of modifying the code you have now (if it's working for admins) would be to change
Code: [Select]
   if pl:IsAdmin() then
to
Code: [Select]
   if pl:IsAdmin() or pl:IsUserGroup("donatorplus") then
Beware though, any group that inherits donatorplus in your groups file will have access.

See Player.IsUserGroup

"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Rave
« Reply #2 on: February 02, 2010, 09:18:53 PM »
Beware though, any group that inherits donatorplus in your groups file will have access.

That only applies to ply:CheckGroup -- http://ulyssesmod.net/docs/files/lua/ULib/shared/sh_ucl-lua.html#Player:CheckGroup (er, in SVN anyways)
« Last Edit: February 03, 2010, 07:41:53 AM by Megiddo »
Experiencing God's grace one day at a time.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Rave
« Reply #3 on: February 03, 2010, 03:27:57 PM »
Megiddo, in ULib release(non-svn), didn't we overwrite/enhance IsUserGroup to see inherited groups?
I thought we had some complaints because of that and hence why we made Checkgroup.
Superadmin inherits admin inherits operator inherits user. If testing Admin, wouldn't a Superadmin be considered an Admin?
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Rave
« Reply #4 on: February 03, 2010, 06:01:34 PM »
Megiddo, in ULib release(non-svn), didn't we overwrite/enhance IsUserGroup to see inherited groups?
I thought we had some complaints because of that and hence why we made Checkgroup.
Superadmin inherits admin inherits operator inherits user. If testing Admin, wouldn't a Superadmin be considered an Admin?

That's right, I had forgotten that this was the case in release when I made the post. (rats on me for not checking the revision history in the docs)
Experiencing God's grace one day at a time.