umsg filter

How can I filter who a usermessage goes to?

I never quite understood it.

[lua]umsg.Start(“umsg_name”, ply)

Not how to start a usermessage, how to decide who it is sent to.


If you noticed, the second argument of umsg.Start indicates which entity receives the umsg.

If you want to send it to all players, don’t give a filter argument.

umsg.Start( "SomeMessage" )
umsg.End( )

Will send to all players

umsg.Start( "SomeMessage", pl )
umsg.End( )

Will send it to a specific player.

If you want to send it to some players, use a recipient filter for the filter argument.


local rf

rf = RecipientFilter( )
rf:AddPVS( tr.HitPos )

umsg.Start( "SomeMessage", rf )
umsg.End( )


local filter = RecipientFilter()
Edit: damn, you beat me to it, kogitsune :expressionless:


Thats what I though with the function parameters.

Seems I had another slit of code that was interfering with it.