-
Notifications
You must be signed in to change notification settings - Fork 5
A2S_PLAYER
Binary edited this page Dec 1, 2024
·
3 revisions
Emitting A2S_PLAYER server queries.
#include <ssq/a2s.h>
// See the `SSQ_SERVER' wiki page.
SSQ_SERVER *server;
uint8_t player_count;
A2S_PLAYER *players = ssq_player(server, &player_count);
/* Success */
if (ssq_server_eok(server)) {
printf("There are %hhu players on the server:\n", player_count);
for (uint8_t i = 0; i < player_count; ++i)
printf("- %s with a score of %d\n", players[i].name, players[i].score);
/* Cleanup */
ssq_player_free(players, player_count);
}
/* Failure */
if (!ssq_server_eok(server)) {
fprintf(stderr, "ssq_player: %s\n", ssq_server_emsg(server));
/* Cleanup */
ssq_server_eclr(server);
}
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 |
Retrieves information about the players currently on the server.
Name | Type | Nullable | Description |
---|---|---|---|
server | SSQ_SERVER * |
❌ | Source server instance to query |
player_count | uint8_t * |
❌ | Number of players in the response |
Returns an A2S_PLAYER response array of length *player_count
which must be freed using ssq_player_free
.
NULL
.
NULL
and updates the last error of server
.
Frees an A2S_PLAYER response array returned by ssq_player
.
Name | Type | Nullable | Description |
---|---|---|---|
players | A2S_PLAYER * |
✅ | A2S_PLAYER response array to free |
player_count | uint8_t |
Number of players in the array |