Module plugin_clients
SparkMod managed clients table.
Available to server plugins
Fields
| clients | The managed clients table is a magic table that can be used to store client specific data or iterate over the connected clients. |
Fields
- clients
-
The managed clients table is a magic table that can be used to store client specific data or iterate
over the connected clients. Client data can be indexed by ServerClient, Player or numeric steam id. Client
data stored in this table is specific to the plugin and is removed automatically when the client disconnects.
Usage:
-- Loop through all clients and their data: for client, info in clients do Puts("%N voted for map: %s", client, info.voted_for_map) end -- Set an attribute for a specific client clients[client].voted_for_map = "ns2_tram" -- Count how many clients voted for map "ns2_tram" clients.Count { voted_for_map = "ns2_tram" } -- Counting can also be done using a function if more flexibility is needed clients.Count(function(info) return info.voted_for_map == "ns2_tram" end) -- Clear an attribute for all clients clients.Each(function(info) info.voted_for_map = nil end) -- Count all connected clients clients.count