Ulysses

General => Developers Corner => Topic started by: Samg381 on March 21, 2013, 12:30:55 PM

Title: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 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!
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: MrPresident 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.
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 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.
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: JamminR 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.
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 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.
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 on March 23, 2013, 08:49:16 AM
Solution?
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: MrPresident 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
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 on March 26, 2013, 09:24:10 AM
Please elaborate! I need help with the specifics.
Title: Re: Restrict Entity/SWEP for ULX 'Donator' Rank?
Post by: Samg381 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