public bool SendMessageToServer(ushort id, byte[] message, bool reliable)
            {
                if (message.Length > MAX_MESSAGE_SIZE)
                {
                    return(false);
                }

                if (reliable)
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageServerReliable, id, message, Sync.ServerId);
                }
                else
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageServerUnreliable, id, message, Sync.ServerId);
                }

                return(true);
            }
            public bool SendMessageTo(ushort id, byte[] message, ulong recipient, bool reliable)
            {
                if (message.Length > MAX_MESSAGE_SIZE)
                {
                    return(false);
                }

                if (reliable)
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageClientReliable, id, message, recipient, new EndpointId(recipient));
                }
                else
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageClientUnreliable, id, message, recipient, new EndpointId(recipient));
                }

                return(true);
            }
            public bool SendMessageToOthers(ushort id, byte[] message, bool reliable)
            {
                if (message.Length > MAX_MESSAGE_SIZE)
                {
                    return(false);
                }

                if (reliable)
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageBroadcastReliable, id, message);
                }
                else
                {
                    MyMultiplayerMain.RaiseStaticEvent(s => MyMultiplayer.ModMessageBroadcastUnreliable, id, message);
                }

                return(true);
            }
 public static void SendScriptedChatMessage(ref ScriptedChatMsg msg)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyMultiplayerBase.OnScriptedChatMessageRecieved, msg);
 }
 protected static void SendChatMessage(ref ChatMsg msg)
 {
     MyMultiplayer.RaiseStaticEvent(s => MyMultiplayerBase.OnChatMessageRecieved, msg);
 }
Ejemplo n.º 6
0
 public static void TeleportControlledEntity(Vector3D location)
 {
     MyMultiplayer.RaiseStaticEvent(x => OnTeleport, MySession.Static.LocalHumanPlayer.Id.SteamId, location);
 }