public void HostingSession([FromSource] Player source) { if (!String.IsNullOrEmpty(currentlyHosting)) { TriggerClientEvent(source, "sessionHostResult", "wait"); hostReleaseCallbacks.Add(() => TriggerClientEvent(source, "sessionHostResult", "free")); } string hostId; // (If no host exists yet null exception is thrown) try { hostId = NativeWrappers.GetHostId(); } catch (NullReferenceException) { hostId = null; } if (!String.IsNullOrEmpty(hostId) && NativeWrappers.GetPlayerLastMsg(hostId) < 1000) { TriggerClientEvent(source, "sessionHostResult", "conflict"); return; } hostReleaseCallbacks.Clear(); currentlyHosting = source.Handle; Debug.WriteLine($"[SESSIONMANAGER] current game host is '{currentlyHosting}'"); TriggerClientEvent(source, "sessionHostResult", "go"); BaseScript.Delay(5000); currentlyHosting = null; hostReleaseCallbacks.ForEach(f => f()); }