Author Topic: Restrict Entity/SWEP for ULX 'Donator' Rank?  (Read 5668 times)

0 Members and 1 Guest are viewing this topic.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Restrict Entity/SWEP for ULX 'Donator' Rank?
« on: March 21, 2013, 12:30:55 PM »
Hey,
I need a code that will restrict some entities: WAC Aircraft, SCars
and some SWeps: CSS Realistic, Murderthon 9K
To the ULX Rank 'Donator'. I'm making an auto-donation system and this is important.
Thank you!

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #1 on: March 21, 2013, 06:47:11 PM »
You could add this code to the entities and sweps to restrict them to donators.

Code: [Select]
if not ply:IsUserGroup("donator") then
     return
end

You might also want to put some kind of message before the return informing the player that only donators are allowed to spawn those things.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #2 on: March 22, 2013, 03:32:20 PM »
Thanks. I just set 'Donator' to inherit from Admin, and than disallowed all admin commands from donator in the groups.cfg.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #3 on: March 22, 2013, 03:45:44 PM »
Samg, that's really not a good idea.
Though perhaps they won't be able to run ULX admin commands, Gmod will see them as an admin, which means any gamemode/mod/whatever that uses IsAdmin to check a player for any special access, they will have it.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #4 on: March 23, 2013, 07:02:07 AM »
Well, I know that, but at the moment it's my only option.
I need Donators to have access to admin only sweps and vehicles.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #5 on: March 23, 2013, 08:49:16 AM »
Solution?

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #6 on: March 23, 2013, 05:20:01 PM »
Yes, Edit the spawn code with the snip I gave you earlier. Find where it says IsAdmin and add the above code in as well.

Also, take a look at the SWEP hooks. I assume you are running a gamemode that is based on Sandbox.
http://gmodwiki.net/Lua/Hooks/Sandbox
« Last Edit: March 23, 2013, 05:38:06 PM by MrPresident »

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #7 on: March 26, 2013, 09:24:10 AM »
Please elaborate! I need help with the specifics.

Offline Samg381

  • Newbie
  • *
  • Posts: 32
  • Karma: 0
  • Owner- Samg381's Sandbox
    • Samg381's Sandbox Server
Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
« Reply #8 on: March 26, 2013, 09:32:06 AM »
[ERROR] addons/wac community 1/lua/entities/wac_hc_ah1z_viper_u/shared.lua:64: attempt to index global 'ply' (a nil value)
  1. unknown - addons/wac community 1/lua/entities/wac_hc_ah1z_viper_u/shared.lua:64
   2. include - [C]:-1
    3. unknown - addons/wac community 1/lua/entities/wac_hc_ah1z_viper_u/cl_init.lua:1