HolyLib Wiki

gameserver

gameserver

This module adds a new gameserver library for more control over the engine's CGameServer and CGameClients. Supports: Linux32

Methods

Approximates the memory usage of the server in bytes.

This will be removed in version (0.8 - DEV).This function was removed since it never actually worked

gameserver.BroadcastMessage( number type, string name, bf_write buffer )
Sends a custom net message to all clients.
This function allows you send any netmessage you want.
You should know what your doing since this function doesn't validate anything.
number gameserver.CalculateCPUUsage( )
Calculates and returns the CPU Usage.

This will be removed in version (0.8 - DEV).This function was removed since it never actually worked

CNetChan gameserver.CreateNetChannel( string ip, boolean useDNS, number protocolVersion = 1, number socket = NS_SERVER )
Creates a net channel for the given ip.
table gameserver.GetAll( )
Returns a table that contains all CGameClients.
It will return nil on failure.
number gameserver.GetClassBits( )
CGameClient gameserver.GetClient( number playerSlot )
Returns the CGameClient at that player slot or nil on failure.
CGameClient gameserver.GetClientByUserID( number userID )
Returns the CGameClient for the given userID or nil on failure.
number gameserver.GetClientCount( )
returns client count for iteration of gameserver.GetClient
This will include inactive CGameClient's since the engine re-uses them and doesn't delete them on disconnect.
If you want to get the count of active client's use gameserver.GetNumClients
Returns a table containing all net channels created by gameserver.CreateNetChannel
string gameserver.GetMapName( )
Returns the current map name.
number gameserver.GetMaxClients( )
returns current client limit
string gameserver.GetName( )
Returns the current server/host name.
Should be the same as GetConVar("hostname"):GetString()
number gameserver.GetNumClasses( )
number gameserver.GetNumClients( )
returns current number of clients
number gameserver.GetNumFakeClients( )
returns current number of fake clients/bots
number gameserver.GetNumProxies( )
returns number of attached HLTV proxies
string gameserver.GetPassword( )
Returns the current server password.
number gameserver.GetSpawnCount( )
number gameserver.GetTick( )
Returns the current tick
number gameserver.GetTickInterval( )
Returns the current tick interval
number gameserver.GetTime( )
Returns the current time/curtime
number gameserver.GetUDPPort( )
returns the udp port the server is running on.
boolean gameserver.IsActive( )
boolean gameserver.IsDedicated( )
boolean gameserver.IsHLTV( )
boolean gameserver.IsLoading( )
boolean gameserver.IsMultiplayer( )
boolean gameserver.IsPausable( )
boolean gameserver.IsPaused( )
gameserver.RemoveNetChannel( CNetChan channel )
Removes/Destroys a net channel invalidating it.
number gameserver.SendConnectionlessPacket( bf_write bf, string ip, boolean useDNS, number socket = NS_SERVER )
Sends out a connectionless packet to the target ip.
See HolyLib:ProcessConnectionlessPacket for examples. It's expected that YOU already added the connectionless header, this was done to not have to copy the buffer.
bf:WriteLong(-1) -- Write this as the first thing. This is the CONNECTIONLESS_HEADER
gameserver.SetMaxClients( number slots )
Sets the max client count.
Should do nothing.
gameserver.SetPassword( string password )
Sets the server password.
gameserver.SetPaused( boolean paused = false )
Pauses/Unpauses the server. does this actually work?