From SA-MP Wiki

Jump to: navigation, search

MAX_PLAYERS is a value which defines the number of players that can join the server. It is separate from the 'maxplayers' server variable.

By default, in, this value is 500 (or 800/1000 depending on the server package). If one is only running a server with maxplayers set to 100, MAX_PLAYERS will still be 500 - 400 more than you need. To fix this, simply re-define MAX_PLAYERS directly under the inclusion of a_samp:

#include <a_samp>
#define MAX_PLAYERS 100
// The rest of your script follows..

You can also add this code at the top of OnGameModeInit to verify that MAX_PLAYERS is big enough for what 'maxplayers' is set to. If not, your server may face big issues.

public OnGameModeInit()
    if(GetMaxPlayers() > MAX_PLAYERS)
        SendRconCommand("hostname Server Closed - Back Soon!");
        SendRconCommand("password bahr4h25h");
        printf("[ERROR]: 'maxplayers' (%i) exceeds MAX_PLAYERS (%i). Please fix this.", GetMaxPlayers(), MAX_PLAYERS);
    // More code...

If 'maxplayers' exceeds the limits of MAX_PLAYERS, the server will be locked until it is fixed.

Personal tools