Engine.GetPlayers

From Tomb Raider Mod Launcher Wiki
Jump to navigation Jump to search

Function

function array Engine.GetPlayers();

Description

This function retrieves all the players that are currently on the server.

Returns

The function returns if the server was able to start the resource, possible reasons could include scripts containing errors.

Example

// Add a handler for "online" so that the server will output who is online currently.
//
Engine.AddCommandHandler("online",function(player, commandLine, command, arguments){
	local players = Engine.GetPlayers(); // Get the players that are online
	foreach (k,v in players) // Loop through all the players...
	{
		Engine.OutputChatBox(Engine.GetPlayerName(v),player); // Output their name!
	}
});

Notes

If nobody is online the array is empty.