Author Topic: ULX ADMIN GROUPS LUA HALP!!!  (Read 9311 times)

0 Members and 1 Guest are viewing this topic.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
ULX ADMIN GROUPS LUA HALP!!!
« 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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #1 on: September 14, 2009, 09:58:08 AM »
I have no idea what you're talking about.
Experiencing God's grace one day at a time.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #2 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)

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #3 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).
Experiencing God's grace one day at a time.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #4 on: September 14, 2009, 12:51:35 PM »
I couldn'tfind CheckGroup in the Document.
Could you please link me?

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Experiencing God's grace one day at a time.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #6 on: September 14, 2009, 01:07:57 PM »
so

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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #7 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.
Experiencing God's grace one day at a time.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #8 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
« Last Edit: September 14, 2009, 01:51:50 PM by nofear1999 »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #9 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.
Experiencing God's grace one day at a time.

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #10 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

Offline jay209015

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 934
  • Karma: 62
    • Dev-Solutions
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #11 on: September 14, 2009, 02:36:43 PM »
CheckGroup("group")
An error only becomes a mistake when you refuse to correct it. --JFK

"And thus the downfall of the great ULX dynasty was wrought not by another dynasty, but the slow and steady deterioration of the leaders themselves, followed by the deprecation of the great knowledge they possessed." -Gmod, Chapter 28, verse 34 -- Stickly

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #12 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

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #13 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"

« Last Edit: September 14, 2009, 04:08:17 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline nofear1999

  • Newbie
  • *
  • Posts: 30
  • Karma: 0
Re: ULX ADMIN GROUPS LUA HALP!!!
« Reply #14 on: September 17, 2009, 11:22:24 AM »
Thank you jamminR, i just went in like that and added  or == ("admin") or ("superadmin") then