# You can define your own entity_condition function that should return# True for entities whose SetTransmit method we want to hookentity_condition = EntityCondition.equals_entity_classname( "prop_physics_multiplayer")

Basically, entity_condition is a function that receives an Entity instance and returns True if that's the entity we want to set the hook on. Different entity classes have different SetTransmit methods, so if we set the hook on CBaseCombatCharacter::SetTransmit, transmitting of the CSprite won't get hooked.

If you want to hook player transmission (e.g. make certain players invisible to some other players), you can go with

# We always transmit the player to himself. If we don't, bad things happen.if player.index == entity.index: return None

In all games "bad things" is player not being able to see themselves moving, i.e. they will be stuck on their screen. Apparently on CS:GO (and only on Windows SRCDS) the server will just disconnect the player with the following error:

pre_set_transmit is registered as a hook and gets called automatically.

Possible return values depend on the return type of the hooked function. If the hooked function for example returns an integer, you can return any number in the valid range of that integer type. This will cause the hooked functions not being called and your return value is returned to the caller instead. If you return None or if you simply have no return statement, the original function is called.

If the hooked function has no return type (void), which is the current case, then returning anything except None will block the hooked function from being called.

so it gets called automatically, but how do I know when/how it gets called? I mean I can debug print it and see it myself, but kind of want to understand it. What does it call and will it just print in an endless loop every frame?

To understand when it's getting called you need to dig in the SDK or the server binaries. But I can tell you that the function is getting called to set the entities that should be transmitted to which players.