Detecting when two players collide

Hey everyone,
I’m working on a script that will essentially ‘bash’ another player out of the way when a skill is used. The player using the skill will charge at a high speed, and I want any loose props or players to take damage and get knocked back. I can handle everything in the script, but just can figure out how to detect a player on player collision. I found hooks that deal with if they can collide with other players, but nothing else.

Can someone steer me in the right direction?

Not sure if you can use a trigger on a player without weird side-effects happening.
But you can use a hull trace in front of the player.

You can use ShouldCollide to run a function like the one you want, just make sure that you set it so that it will only run if both entities are players. Its basicly the same as calling something on a collide.

ShouldCollide is a polling function to test if collisions SHOULD take place, not if they will or have.
It also breaks the physics engine if used incorrectly.

If you want to get dirty, you can create an entity that encases the player’s bounding box and parent it to the player, and use some of the entity hooks to try to get when those encasing entities collide with another ent/brush.

It breaks the physics engine even when used correctly over time. I made a system so when in admin-mode, and invisible, you’d nocollide through everything and everyone except the world. It would work great, but I did some stress tests. Sometimes after switching between invis and visible around 100 times it would cause all cars to fall through map. Sometimes after only a few it would too.

I may be able to avoid that by respawning the admin when going invisible but I never went that far with it because if it worked fine over 100 times and then broke or a few times… I couldn’t put that in a production server and risk it. I may play around with it a little more though.