Players Filter
Manage and synchronize a list of players matching pre-defined conditions
Last updated
Manage and synchronize a list of players matching pre-defined conditions
Last updated
Code:
Extends:
Realm: Shared
Players filters are containers useful for caching a list of players with pre-determined conditions.
Similarly to filters, they must be instantiated on both client and server sides. As filters are automatically synchronized after a modification, only the server needs to manage their content. The client should only receive data from the server and should not alters the content by itself.
By itself, a filter won't do anything unless you told him so. Therefore, you should either use FILTER:listen_<...>
methods or manually hook into game events and use FILTER:add
and FILTER:remove
methods.
void
listen_disconnect()
Makes the filter to automatically clean-up disconnected players.
void
listen_weapon_users( string weapon_class )
Makes the filter to automatically add players who are using a specific weapon class and to remove those who are not.
A common use case is to gather a list of players using a certain SCP weapon for later use. Code from :