gameserver
gameserver
This module adds a new gameserver library for more control over the engine's CGameServer and CGameClients.
Supports: Linux32
Methods
number gameserver.ApproximateProcessMemoryUsage( )
Approximates the memory usage of the server in bytes.
This function was removed since it never actually worked
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.
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 function was removed since it never actually worked
Creates a new fake client (bot) with the given name and adds it to the server.
Returns nil if the server isn't active or the engine failed to create the client (e.g. no free client slot left).
Returns nil if the server isn't active or the engine failed to create the client (e.g. no free client slot left).
Creates a new fake client with the given name, similar to gameserver.CreateFakeClient, but manually replicates the connection process instead of going through the engine's sv_stressbots-based fake client creation.
It sets a bunch of default user convars (rate, cl_updaterate, cl_interp, ...) and puts the client into the SIGNONSTATE_PRESPAWN state before returning it.
It sets a bunch of default user convars (rate, cl_updaterate, cl_interp, ...) and puts the client into the SIGNONSTATE_PRESPAWN state before returning it.
CNetChan gameserver.CreateNetChannel( string ip, boolean useDNS, number protocolVersion = 1, number socket = NS_SERVER )
Creates a net channel for the given ip.
CGameClient gameserver.CreateNewClient( )
Creates and returns a brand new CGameClient appended to the end of the server's client list (at slot gameserver.GetClientCount).
Unlike gameserver.CreateFakeClient this does not connect the client or configure it as a bot, it merely allocates the client object.
Unlike gameserver.CreateFakeClient this does not connect the client or configure it as a bot, it merely allocates the client object.
number gameserver.GetClassBits( )
Returns the CGameClient at that player slot or nil on failure.
Returns the CGameClient for the given steamID or nil on failure. (steamID not steamID64!)
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
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
number gameserver.GetCPUUsage( )
Returns the server's current CPU usage as tracked by the engine itself (CBaseServer::GetCPUUsage).
table gameserver.GetCreatedNetChannels( )
Returns a table containing all net channels created by gameserver.CreateNetChannel
number gameserver.GetCurrentRandomNonce( )
Returns the server's current random nonce, used internally by the engine for Steam client authentication.
Finds (or creates) a free client slot for the given address, this is the same lookup the engine performs internally whenever a new player connects.
Calling this function will not trigger the HolyLib:GetFreeClient hook, to prevent infinite recursion.
Calling this function will not trigger the HolyLib:GetFreeClient hook, to prevent infinite recursion.
Directly looks up (or creates) a free client from HolyLib's internal queue client list for the given address.
This is the same fallback that gameserver.GetFreeClient (and the engine's own free client search) uses when the server has no regular free client slot left.
Queue clients are kept out of the server's normal client list (see CBaseClient:AddToQueueList) until moved back in.
This is the same fallback that gameserver.GetFreeClient (and the engine's own free client search) uses when the server has no regular free client slot left.
Queue clients are kept out of the server's normal client list (see CBaseClient:AddToQueueList) until moved back in.
number gameserver.GetLastRandomNonce( )
Returns the server's previous random nonce, used internally by the engine for Steam client authentication.
string gameserver.GetMapName( )
Returns the current map name.
number gameserver.GetMaxClients( )
returns current client limit
Returns the current server/host name.
Should be the same as GetConVar("hostname"):GetString()
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.
Returns the network socket index the server is listening on, usable with functions like gameserver.SendConnectionlessPacket or gameserver.CreateNetChannel.
number gameserver.GetSpawnCount( )
number gameserver.GetTickInterval( )
Returns the current tick interval
number gameserver.GetUDPPort( )
returns the udp port the server is running on.
boolean gameserver.IsDedicated( )
boolean gameserver.IsMultiplayer( )
boolean gameserver.IsPausable( )
gameserver.NS_CLIENT()
gameserver.NS_HLTV()
gameserver.NS_SERVER()
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
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.
Should do nothing.
gameserver.SetPassword( string password )
Sets the server password.