Ulysses

General => Developers Corner => Topic started by: [NNJG]Ben on February 02, 2010, 07:14:10 PM

Title: Rave
Post by: [NNJG]Ben 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
Title: Re: Rave
Post by: JamminR 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 (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Player.IsUserGroup)

Title: Re: Rave
Post by: Megiddo 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)
Title: Re: Rave
Post by: JamminR 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?
Title: Re: Rave
Post by: Megiddo 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)