using AltV.Net.Async; public void Start() { AltAsync.Schedule(() => { // logic to execute after 5 seconds Console.WriteLine("Task executed after 5 seconds"); }, TimeSpan.FromSeconds(5)); }
using AltV.Net.Async; public void Start() { AltAsync.Schedule(() => { // logic to execute at a specific time Console.WriteLine("Task executed on 12:00:00 PM"); }, new DateTime(2021, 8, 15, 12, 0, 0) - DateTime.UtcNow); }This example schedules a task to execute at a specific time (12:00:00 PM on August 15, 2021). The TimeSpan object is calculated by subtracting the current UTC time from the desired execution time. AltV.Net.Async is a package library that extends the functionality of the AltV.Net game server engine, and AltVAsync Schedule is a method provided by this package library.