コード例 #1
0
        void cmdSpawns(BasePlayer player, string command, string[] args)
        {
            if (!player.IsAdmin)
            {
                return;
            }
            if (args.Length < 2)
            {
                return;
            }
            if (zoneToSpawn.FindAll(x => x.zoneID == args[0]).Count > 0)
            {
                SendReply(player, $"A spawn file already exists for ZoneID {args[0]}");
            }
            else
            {
                string spawnTo = args[1];
                bool   toArena = spawnTo.StartsWith("A:");

                if (!toArena)
                {
                    List <Vector3> success = Spawns?.Call("LoadSpawnFile", args[1]) as List <Vector3>;
                    if (success != null && success.Count > 0)
                    {
                        string desc   = string.Empty;
                        ZSpawn zspawn = new ZSpawn(args[0], args[1]);
                        if (args.Length == 3)
                        {
                            zspawn.setDescription(args[2]);
                        }
                        zoneToSpawn.Add(zspawn);
                        SendReply(player, "Link saved");
                    }
                    else
                    {
                        SendReply(player, $"Spawn file {args[1]} either contains no spawns, or doesn't exist.");
                    }
                }
                else
                {
                    zoneToSpawn.Add(new ZSpawn(args[0], args[1]));
                    SendReply(player, $"Arena spawn added");
                }
                SaveSpawnData();
            }
        }
コード例 #2
0
        void OnEnterZone(string ZoneID, BasePlayer player)
        {
            if (ContainsZone(ZoneID))
            {
                ZSpawn spawnFile = zoneToSpawn.Find(x => x.zoneID == ZoneID);
                if (spawnFile.isArena)
                {
                    player.SendConsoleCommand($"chat.say \"/joingui arena {spawnFile.arenaName}\"");
                }
                else
                {
                    List <Vector3> spawns = LoadSpawnpoints(spawnFile.spawnName);

                    if (spawns != null)
                    {
                        MoveToSpawn(player, spawns);
                    }
                }
            }
        }