---
title: "GetMaxPlayers | open.mp"
description: "Returns the maximum number of players that can join the server, as set by the server variable 'max_players'."
canonical: https://omp.itsneufox.com/th/docs/scripting/functions/GetMaxPlayers
language: th
---

# GetMaxPlayers

## คำอธิบาย

Returns the maximum number of players that can join the server, as set by the server variable 'max\_players' in config.json.

| Name | Description |
| --- | --- |

## ตัวอย่าง

```c
new str[128];
format(str, sizeof(str), "There are %i slots on this server!", GetMaxPlayers());
SendClientMessage(playerid, 0xFFFFFFFF, s);
```

## บันทึก

warning

This function can not be used in place of MAX\_PLAYERS. It can not be used at compile time (e.g. for array sizes). MAX\_PLAYERS should always be re-defined to what the 'max\_players' var will be, or higher. See MAX\_PLAYERS for more info.

## ฟังก์ชั่นที่เกี่ยวข้องกัน

-   [GetPlayerPoolSize](https://omp.itsneufox.com/th/docs/scripting/functions/GetPlayerPoolSize): Gets the highest playerid connected to the server.
-   [IsPlayerConnected](https://omp.itsneufox.com/th/docs/scripting/functions/IsPlayerConnected): Check if a player is connected to the server.
