コード例 #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);
                }
            }
        }
コード例 #2
0
        private static void OnPlayerDeath(OakwoodPlayer player, OakwoodPlayer killer)
        {
            foreach (var p in Oakwood.Players)
            {
                p.HUD.Message($"{player.Name} died.", OakColor.White);
            }

            player.Spawn(spawnPosition, 0);
        }
コード例 #3
0
        static void SpawnCommand(OakwoodPlayer player, object[] args)
        {
            player.SpawnTempWeapons();

            player.Health = 200.0f;
            player.Spawn(new OakVec3(-1986.852539f, -5.089742f, 25.776871f), 180.0f);

            player.HUD.Fade(OakwoodFade.FadeIn, 500, 0xFFFFFF);
            player.HUD.Fade(OakwoodFade.FadeOut, 500, 0xFFFFFF);
        }
コード例 #4
0
        private static void OnPlayerConnect(OakwoodPlayer player)
        {
            foreach (var p in Oakwood.Players)
            {
                p.HUD.Message($"{player.Name} joined the session.", OakColor.White);
            }

            player.PlayerData = new OakPlayerData();
            player.Spawn(spawnPosition, 0);
        }
コード例 #5
0
 static void Kill(OakwoodPlayer player, object[] args)
 {
     foreach (OakwoodPlayer p in Oakwood.Players)
     {
         p.HUD.Message($"{player.Name} commited suicide.", OakColor.White);
     }
     player.HUD.Fade(OakwoodFade.FadeIn, 500, OakColor.Red);
     player.SpawnTempWeapons();
     player.Health = 200.0f;
     player.Spawn(new OakVec3(-759.3801f, 13.24883f, 761.6967f), 180.0f);
     player.HUD.Fade(OakwoodFade.FadeOut, 500, OakColor.Red);
 }
コード例 #6
0
        static void OnPlayerConnect(OakwoodPlayer player)
        {
            if (player.IsValid())
            {
                foreach (OakwoodPlayer p in Oakwood.Players)
                {
                    p.HUD.Message($"{player.Name} joined the game.", OakColor.White);
                }

                OakPlayerData data = new OakPlayerData();

                player.PlayerData = data;

                player.SpawnTempWeapons();

                player.Spawn(new OakVec3(-2136.182f, -5.768807f, -521.3138f), 90.0f);

                player.HUD.Announce("Welcome to SharpWood testing server!", 4.5f);
            }
        }
コード例 #7
0
        private static void OnPlayerDeath(OakwoodPlayer player, OakwoodPlayer killer)
        {
            if (player.IsValid())
            {
                foreach (OakwoodPlayer p in Oakwood.Players)
                {
                    if (player == killer)
                    {
                        p.HUD.Message($"{player.Name} died.", OakColor.White);
                    }
                    else
                    {
                        p.HUD.Message($"{player.Name} was killed by {killer.Name}.", OakColor.White);
                    }
                }

                player.HUD.Announce("Wasted", 4.85f);

                Timer spawnTimer = new Timer();
                spawnTimer.Interval  = 5000;
                spawnTimer.AutoReset = false;
                spawnTimer.Elapsed  += (object sender, ElapsedEventArgs e) =>
                {
                    Timer waitTimer = new Timer();
                    player.HUD.Fade(OakwoodFade.FadeIn, 2500, OakColor.Black);
                    waitTimer.Interval  = 2500;
                    waitTimer.AutoReset = false;
                    waitTimer.Elapsed  += (object snd, ElapsedEventArgs ea) =>
                    {
                        player.SpawnTempWeapons();
                        player.Health = 200.0f;
                        player.Spawn(new OakVec3(-759.3801f, 13.24883f, 761.6967f), 180.0f);
                        player.HUD.Fade(OakwoodFade.FadeOut, 2500, OakColor.Black);
                    };
                    waitTimer.Start();
                };

                spawnTimer.Start();
            }
        }