Beispiel #1
0
        public static void PlayerMovement(Player player, Vector3 pos)
        {
            //MOVEMENT CHECK

            player.location = pos;
            NetworkSend.SendPlayerPosition(player.connectionID, pos);
        }
Beispiel #2
0
        public static void PlayerLooking(Player player, Quaternion looking)
        {
            //LOOKING CHECK

            player.looking = looking;
            NetworkSend.SendPlayerLook(player.connectionID, looking);
        }
Beispiel #3
0
        private static void Packet_PlayerLogin(int connectionID, ref byte[] data)
        {
            ByteBuffer buffer   = new ByteBuffer(data);
            string     email    = buffer.ReadString();
            bool       canLogin = GameManager.CanPlayerLogin(email, buffer.ReadString());

            NetworkSend.SendPlayerLoginResult(connectionID, canLogin);
            buffer.Dispose();
            if (canLogin)
            {
                string          username = "";
                MySqlDataReader reader   = Program.database.GetData("SELECT username FROM Users WHERE EMAIL='" + email + "'");
                if (reader.HasRows)
                {
                    reader.Read();
                    username = reader.GetString("username");
                }
                Player player = GameManager.TryToLoadPlayer(connectionID, username, email);
                GameManager.playerList.Add(connectionID, player);
                NetworkSend.InstantiateNetworkPlayer(connectionID, player);
                reader.Close();
            }
            else
            {
                MySqlDataReader reader = Program.database.GetData("SELECT * FROM Users WHERE EMAIL='" + email + "'");
                if (reader.HasRows)
                {
                    reader.Read();
                    if (reader.GetBoolean("baned"))
                    {
                        string reason  = reader.GetString("banreason");
                        long   bantime = reader.GetInt64("bantime");
                        NetworkSend.SendPlayerBanData(connectionID, reason, bantime);
                    }
                }
                reader.Close();
            }
        }