-
Notifications
You must be signed in to change notification settings - Fork 7
A2S_PLAYER
Binary edited this page Oct 30, 2022
·
3 revisions
Structure reflecting the response of an A2S_PLAYER query.
#include <ssq/a2s.h> #include <inttypes.h> #include <stdio.h> SSQ_SERVER server; // ... uint8_t player_count = 0; A2S_PLAYER *players = ssq_player(&server, &player_count); if (ssq_server_ok(&server)) { printf("There are %" PRIu8 " players currently on the server:\n", player_count); for (uint8_t i = 0; i < player_count; ++i) printf("%s (score: %" PRId32 ")\n", players[i].name, players[i].score); ssq_player_free(players, player_count); } else { // ... } // ...
| Identifier | Type | Description |
|---|---|---|
| index | uint8_t |
Index of player chunk starting from 0. |
| name | char * |
Name of the player. |
| name_len | size_t |
Length of the name string. |
| score | int32_t |
Player's score (usually "frags" or "kills"). |
| duration | float |
Time (in seconds) player has been connected to the server. |
Send an A2S_PLAYER query to a Source game server.
| Name | Type | Nullable | Description |
|---|---|---|---|
| server | SSQ_SERVER * |
no | Source game server to query. |
| player_count | uint8_t * |
no | Number of players in the response. |
Returns NULL when an error occurs or there are no players currently on the
server, otherwise returns an A2S_PLAYER structure array of size
*player_count containing details about each player.
ssq_player_free when done using it.
ssq_server_err_clr when done handling it.
Free an A2S_PLAYER structure array.
| Name | Type | Nullable | Description |
|---|---|---|---|
| players | A2S_PLAYER * |
no | A2S_PLAYER structure array to free. |
| player_count | uint8_t |
Number of players in the array. |