Donor only areas

Im thinking this has to do with lua, but may be mapping. Im not sure, so sorry if its not lua. But what I need is a way to make a Donator only area(Like in the Cinema gamemodes theater, theres Private Theater Rooms, how could I go about making those rooms only accessible by Donators?)

We already had such an topic recently, the only difference was, that it was admins only.

Why give him the only -paid- option if theres already an free option spoken about recently?

[editline]5th October 2015[/editline]

Oh yeah, now I see - its your script.

[lua]hook.Add( “Think”, “DonatorArea”, function()
local ents = ents.FindInBox( x, y )

for k,v in pairs(ents) do
if v:IsPlayer() and v:IsValid() then
if not v:IsUserGroup(“VIP”) then
end )


Even better: store a variable that updates with the player’s position if they are not found in the box. Then, if they do get found in the box, set them back to their position. That will block them walking there altogether.

or you could detect what side they’re walking into and just push them back 100 or so units in the opposite direction. I think updating the player’s position constantly is unnecessary even if it won’t cause much strain on the server.

local allowed = { "admin", "superadmin", "vip", "donator" } -- these are the allowed user groups.
local function CheckPermissions( ply )
	if ply:IsPlayer() then
		if not table.HasValue( allowed, ply:GetUserGroup() ) then
			ply:SetVelocity( -ply:GetVelocity() * 1.1 ) -- push back a little faster than the player came in.

local function CreateBob( mins, maxs, callback )
	local ent = ents.Create( "base_entity" )
	ent:SetPos( LerpVector( 0.5, mins, maxs ) )
	ent:SetModel( "models/hunter/blocks/cube025x025x025.mdl" ) -- Probably dont even have to call this.

	ent:SetTrigger( true )
	ent:SetNotSolid( true )
	ent:SetNoDraw( true )
	ent:DrawShadow( false )
	ent:PhysicsInitBox( ent:WorldToLocal( mins ), ent:WorldToLocal( maxs ) )

	function ent:StartTouch( ply )
		callback( ply )

	function ent:UpdateTransmitState()
		return TRANSMIT_NEVER --Client does not need to know the entity is there.


	return ent

local function PostReset()
	CreateBob( Vector( 0, 0, 0 ), Vector( 100, 100, 100 ), CheckPermissions ) -- create entity @ Vector 0,0,0 to 100,100,100 

hook.Add( "PostCleanupMap", "ZoneCheck", PostReset )
hook.Add( "InitPostEntity", "ZoneCheck", PostReset )

You can try this. It runs on StartTouch. It uses nearly no cpu power at all.
I use something like this. I edited it to be what you want. All you need to do is edit the Vectors. You can also SetPos() instead of pushing back. Or run it on Touch instead of StartTouch. (Be aware that it will shake the player so fast it will probably kill them.)