Ulysses

General => Developers Corner => Topic started by: nofear1999 on September 14, 2009, 09:33:56 AM

Title: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 09:33:56 AM
does ULX Admin user groups function ply:IsUserGroup("group")

so ex. you can create a group called respected and

if ply:IsUserGroup("respected") then
code goes here
end
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: Megiddo on September 14, 2009, 09:58:08 AM
I have no idea what you're talking about.
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 11:36:14 AM
Ummm,

I was buzzed when I posted that.

Okay, ULX has function ulx addgroup

Does that function allow
function respectedcheck
if ply:IsUserGroup("respected") then
ply:Give("phygun")
ply:Give("toolgun")
end
concommand.Add("respected", respectedcheck)
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: Megiddo on September 14, 2009, 11:52:59 AM
IsUserGroup() is a garry function. It returns true if the user belongs to the group, yes. You might be looking for CheckGroup() though (see docs).
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 12:51:35 PM
I couldn'tfind CheckGroup in the Document.
Could you please link me?
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: Megiddo on September 14, 2009, 12:55:24 PM
http://ulyssesmod.net/docs/files/lua/ULib/shared/sh_ucl-lua.html#Player:CheckGroup
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 01:07:57 PM
so

if ply:CheckGroup() == "Respected" then
ply:Give( "physgun" )
ply:Give( "physgun" )
end
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: Megiddo on September 14, 2009, 01:19:44 PM
so

if ply:CheckGroup() == "Respected" then
ply:Give( "physgun" )
ply:Give( "physgun" )
end

No. Pay attention to the docs. CheckGroup returns a bool and takes a parameter.
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 01:49:59 PM
I'm not experianced with Booleans yet,

Could you explain? I don't see any formats on the Documentation.

if ply:CheckGroup() "Respected" == 1 then
ply:Give( "physgun" )
ply:Give( "toolgun" )
end
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: Megiddo on September 14, 2009, 02:15:33 PM
This isn't the right place to start learning lua. Look to http://lua.org/pil and the garrysmod wiki until you got off your feet.
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 02:17:07 PM
I have, could you please explain the format to me?
I look @ Gmod wiki alot, i've gone through EVERY tutorial.
Please, explain it to me. :/l
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: jay209015 on September 14, 2009, 02:36:43 PM
CheckGroup("group")
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 14, 2009, 03:01:22 PM
so

if ply:CheckGroup("respected") then
ply:Give("gmod_tool")
ply:Give("Physgun")
end

or
if CheckGroup("respected") then
ply:Give("gmod_tool")
ply:Give("Physgun")
end
Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: JamminR on September 14, 2009, 04:02:32 PM
Your first example should work.
Boolean basically means true or false.

Be careful though. CheckGroup will see inherited groups and return true.
For example, if admin inherits respected in the ULib UCL chain... admin's would get returned as true also.
If you only want the respected group to have something, then GetUserGroup is your best bet, and for that you would then use the example you showed already "if ply:GetUserGroup() == "respected" then"

Title: Re: ULX ADMIN GROUPS LUA HALP!!!
Post by: nofear1999 on September 17, 2009, 11:22:24 AM
Thank you jamminR, i just went in like that and added  or == ("admin") or ("superadmin") then