How to make only certain groups able to use an entity?

Post Reply
bfrancom
New to forums
New to forums
Posts: 4
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sat Sep 14, 2013 11:25 am

How to make only certain groups able to use an entity?

Post by bfrancom »

Hi. I have custom printers, but need to restrict certain to certain groups. How do I do this?
bfrancom
New to forums
New to forums
Posts: 4
Joined: Sat Sep 14, 2013 11:25 am

Re: How to make only certain groups able to use an entity?

Post by bfrancom »

Also, this means restricted to ULX groups, not fadmin.
Trooper
A semi-regular
A semi-regular
Posts: 16
Joined: Fri Jun 14, 2013 4:19 pm

Re: How to make only certain groups able to use an entity?

Post by Trooper »

This is easy,

Things you should know:

Should have know a very tiny bit of lua in order to attempt, this is very good for new coders. Also you should have a save copy of addentities IE a backup file. In case you screw up.

Follow this File Path:

gamemodes/DarkRP/Gamemode/addentities

go in there and add the Entitie you wish to add

Example:

Code: Select all

 

AddEntity("Money Printer Level 1", {  -- First Line of code stating Name of the Entitie
         ent = "money_printer1", -- The folders name
         model = "models/props_lab/consolebox01a.mdl",  -- what the F4menu will display
         price = 5000, -- price of this entitie in F4Menu
         max = 2, -- how many the player can spawn
         cmd = "/buylevel1printer" -- chat command to buy
         customCheck = function(ply) if ply:GetUserGroup() == "name of VIP group" or ply:IsAdmin()
end

Couple of notes.

1. ply:IsAdmin -- What this means is that Admins and higher can spawn in this item as well
2. ply:IsSuperadmin -- Superadmins and higher can spawn this item ( not admins )
3. you can add more UserGroups if you have Multiply Donator groups.


EXAMPLE:

Code: Select all

 
customCheck = function(ply) if ply:GetUserGroup() == "Name of first VIP group" or "Name of Second VIPGroup"

end


Hoped that helped!
Post Reply