Squirrel/Functions/Server/GetPlayers

From VC-MP Wiki

Jump to: navigation, search

This returns the ammount of players currently in the server

Syntax

int GetPlayers()

Arguments

  • None

Example

This example will return amount of players currently ingame when a player types '/c players'.

function onPlayerCommand( player, cmd, text )
{
     if ( cmd == "players" )
     {
          MessagePlayer( "Players online: " + GetPlayers() + "/" + GetMaxPlayers(), player );
     }
}

Notes

The function MessagePlayer and call onPlayerCommand were used in in this example. More info about them in corresponding pages.

Related Functions

squirrel scripting