roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
743 stars 111 forks source link

feat: add `Server.RunOnTick` method which allows tick scheduling #374

Closed roflmuffin closed 5 months ago

roflmuffin commented 5 months ago

Adds RunOnTick and RunOnTickAsync methods which allow you to queue a task for a specific game frame. Closes #367

Example usage:

Server.RunOnTick(Server.TickCount + 64, () => Console.WriteLine("Hello World"));

The async overload simply returns a Task which can be awaited which resolves once the callback has executed.