public override Task Loaded() { // Client log mirroring this.comms.Event(CoreEvents.LogMirror).FromClients().On <DateTime, LogLevel, string, string>(OnLogMirror); // TODO: Const // Rebroadcast raw FiveM server events as wrapped server events RpcManager.OnRaw(FiveMServerEvents.PlayerConnecting, new Action <Player, string, CallbackDelegate, ExpandoObject>(OnPlayerConnectingRaw)); RpcManager.OnRaw(FiveMServerEvents.PlayerDropped, new Action <Player, string>(OnPlayerDroppedRaw)); RpcManager.OnRaw(FiveMServerEvents.ResourceStart, new Action <string>(OnResourceStartRaw)); RpcManager.OnRaw(FiveMServerEvents.ResourceStop, new Action <string>(OnResourceStopRaw)); // Deprecated by FiveM RpcManager.OnRaw(FiveMServerEvents.RconCommand, new Action <string, List <object> >(OnRconCommandRaw)); // Requires FiveM server version >= 1543 RpcManager.OnRaw(FiveMServerEvents.Explosion, new Action <string, dynamic>(OnExplosionEventRaw)); return(base.Loaded()); }
public override Task Loaded() { // Rebroadcast raw FiveM RPC events as wrapped server events RpcManager.OnRaw(FiveMServerEvents.HostingSession, new Action <Player>(OnHostingSessionRaw)); RpcManager.OnRaw(FiveMServerEvents.HostedSession, new Action <Player>(OnHostedSessionRaw)); this.comms.Event(ServerEvents.HostedSession).FromServer().On <IClient>(OnHostedSession); this.comms.Event(ServerEvents.PlayerConnecting).FromServer().On <IClient, ConnectionDeferrals>(OnConnecting); this.comms.Event(ServerEvents.PlayerDropped).FromServer().On <IClient, string>(OnDropped); this.comms.Event(CoreEvents.ClientInitialize).FromClients().OnRequest <string>(OnInitialize); this.comms.Event(CoreEvents.ClientInitialized).FromClients().On(OnInitialized); this.comms.Event(SessionEvents.DisconnectPlayer).FromClients().On <string>(OnDisconnect); this.comms.Event(ServerEvents.ServerInitialized).FromServer().On(OnSeverInitialized); this.comms.Event(SessionEvents.GetMaxPlayers).FromServer().On(e => e.Reply(this.Configuration.MaxClients)); this.comms.Event(SessionEvents.GetCurrentSessionsCount).FromServer().On(e => e.Reply(this.sessions.Count)); this.comms.Event(SessionEvents.GetCurrentSessions).FromServer().On(e => e.Reply(this.sessions.ToList())); return(base.Loaded()); }