コード例 #1
0
        internal static void OnConnect(object[] args)
        {
            int playerID = int.Parse(args[0].ToString());

            OakwoodPlayer newPlayer = new OakwoodPlayer();

            newPlayer.ID = playerID;

            newPlayer.Name = newPlayer.GetName();

            Random rand = new Random();

            int index = rand.Next(OakwoodResources.PlayerModels.Length);

            newPlayer.Model = OakwoodResources.PlayerModels[index].Modelname;

            if (newPlayer.Name == "|>>>failed<<<|" || newPlayer.Name == "Server")
            {
                newPlayer.Kick("Invalid player name!");
            }
            else
            {
                Oakwood.Players.Add(newPlayer);

                newPlayer.SetModel(newPlayer.Model);

                newPlayer.Spawn(new OakVec3(-1986.852539f, -5.089742f, 25.776871f), 180.0f);

                if (OnPlayerConnect != null)
                {
                    OnPlayerConnect(newPlayer);
                }
            }
        }