▦GMDB Developer ManualGameMaker SDK documentation
AdvertisementAdvertising space

gmdb_mp_player_count

Returns the number of players currently connected to the multiplayer room, including the local player. Returns zero when the local client is not in a room.

Syntax

gmdb_mp_player_count();

Arguments

No arguments

Return value / result

0 - Not in a multiplayer room, or controller unavailable.
1 - Only the local player is in the room
2 - or more Total connected players in the room, including the local player.

GameMaker example

// Step Event: wait until at least two players are in the room.
if (gmdb_mp_in_room() && gmdb_mp_player_count() >= 2)
{
    show_debug_message("Both players are in the room!");
}

Display the Player Count

// Draw GUI Event
var _count = gmdb_mp_player_count();
draw_text(20, 20, "Players in room: " + string(_count));