Strip Weapons, Dis-Allow Prop Spawning, and God

I’m creating a simple sandbox gamemode, and I am trying to make a section of the map for a movie theater.

Players shouldn’t be able to have weapons or spawn props in the movie theater.
Players should be godded in the area.

I’ve read about [lua]Ents.FindInSphere()[/lua], but don’t fully understand how it works.

So basically, I need an area of the map to strip players weapons, disallow them to spawn props, and god them.

Thanks in advance for help.

i don’t have to for advance right now… :frowning: sorry but… you know :stuck_out_tongue:

this maybe give you idea

What if I use this:


There are 2 ways to make this, the hard coded or the dynamic way xD

Hardcoded = you make a costum map, and in the part where your Theater is you add brushes and stuff that automatically strip and god the player.

Dynamic = You have to search around your THeater (aka you need the coordinates) and then strip them and god them.

Thank you commander.

I am leaning more towards the dynamic way of doing this.
Could you lead me in the right direction as how exactly to do this?

Can someone help me please?
How do I do this?

This might be a little messy and isn’t very optimised but it should work.

local nextWeaponCheck = 0; – Don’t change this.
local checkInterval = 5; – Change how often the game checks for who is in the Theater. (In seconds)
local theaterPos = Vector(0, 0, 0); – Where is the theater?
local theaterSize = 256; – How big should the theater be?

function NoWeaponsAllowed()
if nextWeaponCheck < CurTime() then
for k,v in pairs(player.GetAll()) do
if v:GetPos():Distance(theaterPos) < theaterSize then
v._TheaterWeapons = {}; – Create a table to store their weapons.
v._IsTheater = true; – Let the game know they are in the theater.

			for _,weapon in pairs(v:GetWeapons()) do
				table.insert(v._TheaterWeapons, weapon:GetClass()); -- Add the players weapons to the table.
			v:StripWeapons(); -- Strip their weapons.
			v:GodEnable(); -- Enable godmode.
			-- Check if they are in theater mode.
			if v._IsTheater then
				v:GodDisable() -- Disable godmode.
				for k2,v2 in pairs(v._TheaterWeapons) do
					v:Give(v2); -- Give them their weapons back.
				v._TheaterWeapons = {}; -- Don't give them any more weapons.
				v._IsTheater = false; -- They are no longer in the theater.
	nextWeaponCheck = CurTime() + checkInterval; -- Check again later.

hook.Add(“Think”, “TheaterThink”, NoWeaponsAllowed);

function NoSpawningAllowed(ply)
– If they are in the theater, stop them spawning props.
if ply._IsTheater then return false; end;
hook.Add(“PlayerSpawnProp”, “TheaterSpawnBlock”, NoSpawningAllowed);


So every 5 seconds, this will check if anyone has entered the theater area. If they have, it strips their weapons, gods them and prevents them from spawning weapons.
It also checks if anyone has left the theater area. And if they have, it gives them their weapons back, disables godmode on them and allows them to spawn props again.

If you find that people are spamming the theater within the 5 second grace period, try lowering the “checkInterval” variable.

In order to define the theater, go into your map, find the area you want the theater to be in and type “getpos” in console.
You will see something like " setpos 1061.696411 172.850784 95.031250;" Take the three numbers here, round them if you wish and enter them into the “theaterPos” variable.
Change the “theaterSize” variable to make the theater bigger or smaller.

Also, put this in a server-side file.

Hope this helps.

ZeMaster thank you so much.

How do I know if the theaterSize is as big as the room?