Author Topic: Addons for Group X  (Read 3172 times)

0 Members and 1 Guest are viewing this topic.

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Addons for Group X
« on: May 11, 2008, 11:24:05 AM »
Ok, I have this fairy addon, and I want to make it donators/admins only, I know there is adminspawnable thing in the lua code which i have set, but now i need to let donators use it,

   if (Settings.SpawnWithPlayer and gmod.GetGamemode().Name == "Sandbox") and (Ply:IsAdmin() or Ply:IsDonator() or Settings.SpawnWithPlayerAdminOnly) then

I tried this but It doesn't work, I'm not very good :S

I'm using UTeam

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Addons for Group X
« Reply #1 on: May 11, 2008, 04:10:42 PM »
As you've probably already discovered, and gotten errors on, there is no such thing as "Ply:IsDonator()"
We've written ULib to use Garry's IsUserGroup. So all you'd have to add to whatever admin check it does now is add
Code: [Select]
... or Ply:IsUserGroup( "donator" ) ...
The three periods ... aren't going to actually be there...they just show where you would insert that code into the other checks.
Groupnames are case sensitive. ULX addgroup is written so that it turns all groupnames stored in groups.txt to lowercase.
If you've manually edited them, you'll need to use whatever case you added in.
« Last Edit: May 11, 2008, 04:13:57 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Re: Addons for Group X
« Reply #2 on: May 12, 2008, 07:54:40 AM »
Thanks so much! Now I can start adding more addons and insert this :D

Hmm, It didn't work, I checked the cases and everything, Here is my line of code

   if (Settings.SpawnWithPlayer and gmod.GetGamemode().Name == "Sandbox") and (Ply:IsAdmin() or Ply:IsUserGroup( "donator" ) or Settings.SpawnWithPlayerAdminOnly) then
« Last Edit: May 12, 2008, 08:35:34 AM by Sc00by22 »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Addons for Group X
« Reply #3 on: May 12, 2008, 12:43:32 PM »
You are really botching up that line of code... What are you trying to achieve?

I THINK this is what you want.. Try this...

if (Settings.SpawnWithPlayer and gmod.GetGamemode().Name == "Sandbox") and (Ply:IsAdmin() or Ply:IsUserGroup( "donator" )) and Settings.SpawnWithPlayerAdminOnly then
« Last Edit: May 12, 2008, 12:45:23 PM by MrPresident »

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Re: Addons for Group X
« Reply #4 on: May 12, 2008, 01:13:47 PM »
I'm trying to make it so my Admins and my Donators get the thing that i want :) It's normally admins only but i wanted them to have this addon

Offline Sc00by22

  • Jr. Member
  • **
  • Posts: 98
  • Karma: 0
Re: Addons for Group X
« Reply #5 on: May 12, 2008, 01:52:46 PM »
Ok, They can see it in there list, But they still can't spawn it :(