Class Server
- Namespace
- CounterStrikeSharp.API
- Assembly
- CounterStrikeSharp.API.dll
public class Server
- Inheritance
-
objectServer
Properties
CurrentTime
Returns the current map time in seconds, as an interval of the server's tick interval. e.g. 70.046875 would represent 70 seconds of map time and the 4483rd tick of the server (70.046875 / 0.015625).
public static float CurrentTime { get; }
Property Value
Remarks
Increments even when server is hibernating
EngineTime
Returns the total time the server has been running in seconds.
public static double EngineTime { get; }
Property Value
Remarks
Increments even when server is hibernating
FrameTime
Returns the time spent on last server or client frame
public static float FrameTime { get; }
Property Value
GameDirectory
public static string GameDirectory { get; }
Property Value
MapName
public static string MapName { get; }
Property Value
MaxPlayers
public static int MaxPlayers { get; }
Property Value
TickCount
Returns the current map tick count. CS2 is a 64 tick server, so the value will increment by 64 every second.
public static int TickCount { get; }
Property Value
TickInterval
Duration of a single game tick in seconds, based on a 64 tick server (hard coded in CS2).
public static float TickInterval { get; }
Property Value
TickedTime
Returns the total time the server has been running in seconds.
public static double TickedTime { get; }
Property Value
Remarks
Does not increment when server is hibernating
Methods
ExecuteCommand(string)
Executes a command on the server, as if it was entered from the console.
public static void ExecuteCommand(string command)
Parameters
command
string
GetMapList()
public static string[] GetMapList()
Returns
- string[]
IsMapValid(string)
public static bool IsMapValid(string mapName)
Parameters
mapName
string
Returns
NextFrame(Action)
Queue a task to be executed on the next game frame.
public static void NextFrame(Action task)
Parameters
task
Action
NextFrameAsync(Action)
Queue a task to be executed on the next game frame.
Returns Task that completes once the synchronous task has been completed.
public static Task NextFrameAsync(Action task)
Parameters
task
Action
Returns
NextWorldUpdate(Action)
Queue a task to be executed on the next pre world update.
public static void NextWorldUpdate(Action task)
Parameters
task
Action
NextWorldUpdateAsync(Action)
Queue a task to be executed on the next pre world update.
Returns Task that completes once the synchronous task has been completed.
public static Task NextWorldUpdateAsync(Action task)
Parameters
task
Action
Returns
PrecacheModel(string)
public static void PrecacheModel(string name)
Parameters
name
string
PrintToChatAll(string)
public static void PrintToChatAll(string message)
Parameters
message
string
PrintToConsole(string)
public static void PrintToConsole(string s)
Parameters
s
string
RunOnTick(int, Action)
Queue a task to be executed on the specified tick.
See TickCount to retrieve the current tick.
public static void RunOnTick(int tick, Action task)
Parameters
RunOnTickAsync(int, Action)
Queue a task to be executed on the specified tick.
See TickCount to retrieve the current tick.
Returns Task that completes once the synchronous task has been completed.
public static Task RunOnTickAsync(int tick, Action task)