• Blocking players from entering an area
    5 replies, posted
like most fps games is possible to block a player from entering a area they are not allowed to go into like in tf2 where you can not go into the enemies spawn room etc i cant seem to find anything on the subject
Easiest way I can think of this is to use a Think hook and a ents.FindInCube however this is resource intensive on your server as it's checking every single server tick to see what's in an area you defined and if it should be there. Hardest way yet probably less resource intensive is to add a trigger zone with a lua logic script to the map by decompiling and editing the map. This is what I mean for example Destinations/Scripting/Linking Lua with Hammer
Couldn't you create a custom entity that is an invisible wall and do a check for player team to decide rather the player could pass through it?
I'd create an empty entity, set it's physics bounds to block whatever you want, then use GM/ShouldCollide to determine who should/shouldn't be allowed through.
Can't believe I didn't think of an empty entity, good call. Though would it not be better to use ENTITY/PhysicsCollide ? To me seems better optimised when tying the event to the entity itself rather then calling a hook every time something collides
Not really better optimized, and you can't prevent the collision from ENTITY/PhysicsCollide anyway
Sorry, you need to Log In to post a reply to this thread.