Commit 031f8c8f7cf41fa80fd55abf6e10674e74e28f86

Authored by Imanol-Mikel Barba Sabariego
1 parent 656921a2

Added max_players.

Fixed printing number of players.
check_csgo/check_csgo.cpp
... ... @@ -79,6 +79,7 @@ int check_csgo(char *hostname, uint16_t port, SERVERINFO *server_info)
79 79 offset += server_info->game.size()+1;
80 80 offset += 2;
81 81 server_info->players = (uint8_t) *((response->data)+offset);
  82 + server_info->max_players = (uint8_t) *((response->data)+(++offset));
82 83  
83 84 delete[] (response->data-HDR_SIZE);
84 85 delete response;
... ... @@ -140,7 +141,8 @@ int main(int argc, char **argv)
140 141 {
141 142 case 0:
142 143 cout << " OK";
143   - cout << " - " << hostname << " " << server_info.name << " " << server_info.game << " " << server_info.map << " " << server_info.players << endl;
  144 + cout << " - " << hostname << " " << server_info.name << " " << server_info.game << " " << server_info.map
  145 + << " " << (int)server_info.players << "/" << (int)server_info.max_players << " players" << endl ;
144 146 break;
145 147  
146 148 case 2:
... ...
check_csgo/check_csgo.h
... ... @@ -31,6 +31,7 @@ struct serverinfo_struct {
31 31 string game;
32 32 string map;
33 33 uint8_t players;
  34 + uint8_t max_players;
34 35 };
35 36 typedef struct serverinfo_struct SERVERINFO;
36 37  
... ...