func_brush GM Hook?

Is there a gamemode hook that gets called when a player touches an entity or to be specific, a func_brush?

use the collide hook to check it against brushes

Can you give a piece of example code?

[lua]function ShouldCollideTestHook(ent1,ent2)
local ent
if ent1:GetClass() == “func_brush” then
ent = ent1
elseif ent2:GetClass() == “func_brush” then
ent = ent2
end
if !ent == nil then
–/Do stuff now
end
end
hook.Add(“ShouldCollide”,“ShouldCollideTestHook”,ShouldCollideTestHook)[/lua]

No clue if that would actually work, but it’s a start.

It doesn’t show the func_brush class when I put a print statement in there
Only shows worldspawn

Also note that ShouldCollide isn’t called when entities collide, but rather to poll if they should.

Then what is called when entities collide?

I don’t think there is a hook for that purpose.

So there is no way to tell when a player is inside a func_brush?

If you’re the one making the map you can link the func_brush to a Lua_run entity so that code on the server gets ran. Otherwise I guess you could check if the player is within the bounds of that func_brush using a think hook. It’s all I can think of.

Okay awesome. I am making the map :stuck_out_tongue: