Forum

> > CS2D > Scripts > Incorrect Bot Count Value in Server Data Update
Forums overviewCS2D overview Scripts overviewLog in to reply

English Incorrect Bot Count Value in Server Data Update

3 replies
To the start Previous 1 Next To the start

old Incorrect Bot Count Value in Server Data Update

mrc
User Off Offline

Quote
Spoiler >

Nvm, the res.gamemode was actually showing the number of bots. I just renamed it to res.bots. Was there not supposed to be a flag for gamemodes?
edited 4×, last 23.07.24 06:36:59 pm

old Re: Incorrect Bot Count Value in Server Data Update

DC
Admin Off Offline

Quote
This is the PHP code I'm using on the website
1
2
3
4
5
6
7
$mode=readByte();									//Mode Bit Flags
$name=readString();									//Server Name
$map=readString();									//Map
$players=min(readByte(),32);						//Players
$players_max=min(readByte(),32);					//Players Max
if ($mode & 32){ $gmi=readByte(); }else{ $gmi=0; }	//Game Mode
$bots=readByte();
Bit 5 (32) is NOT a flag which indicates whether the server has bots or not.
It's a flag which indicates if a non-standard game mode is being used on the server!

• If the server is using any other game mode than "Standard", flag bit 5 (32) will be set and the game mode byte will be sent.
• Otherwise flag bit 5 (32) won't be set and the game mode byte won't be set. You can safely assume then that the game mode is 0 (standard).

The bot count will always be sent but the game mode is only sent when necessary.

It's crucial to implement that logic properly. Otherwise your bot count might be broken because it is read after the game mode byte. This means you may read the game mode as bot count or the bot count as game mode with a wrong implementation.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview