コード例 #1
0
        void cmdTeleSleep(NetUser netuser, string command, string[] args)
        {
            var Id = netuser.userID.ToString();

            if (!Acess(netuser))
            {
                rust.SendChatMessage(netuser, tag, GetMessage("Noaccess", Id)); return;
            }
            if (args.Length == 0)
            {
                rust.SendChatMessage(netuser, tag, GetMessage("erro1", Id)); return;
            }
            var playerdata = GetPlayerdata(args[0]);

            if (playerdata.ContainsKey("name"))
            {
                float x          = Convert.ToSingle(playerdata["PX"]);
                float y          = Convert.ToSingle(playerdata["PY"]);
                float z          = Convert.ToSingle(playerdata["PZ"]);
                var   management = RustServerManagement.Get();
                management.TeleportPlayerToWorld(netuser.playerClient.netPlayer, new Vector3(x, y, z));
                rust.SendChatMessage(netuser, tag, string.Format(GetMessage("Success1", Id), args[0]));
                return;
            }
            else
            {
                rust.SendChatMessage(netuser, tag, string.Format(GetMessage("erro2", Id), args[0]));
                return;
            }
        }
コード例 #2
0
        void cmdTpAdmin(NetUser netuser, string command, string[] args)
        {
            var Id = netuser.userID.ToString();

            if (!Acesso(netuser))
            {
                rust.SendChatMessage(netuser, tag, GetMessage("Access", Id)); return;
            }
            if (args.Length == 0)
            {
                rust.SendChatMessage(netuser, tag, GetMessage("erro1", Id)); return;
            }
            if (args.Length == 1)
            {
                NetUser targetuser = rust.FindPlayer(args[0]);
                if (targetuser == null)
                {
                    rust.Notice(netuser, tag, GetMessage("erro2", Id));
                    return;
                }
                if (!teleportBack.ContainsKey(Id))
                {
                    teleportBack.Add(Id, netuser.playerClient.lastKnownPosition);
                }
                var management = RustServerManagement.Get();
                management.TeleportPlayerToPlayer(netuser.playerClient.netPlayer, targetuser.playerClient.netPlayer);
                rust.SendChatMessage(netuser, tag, string.Format(GetMessage("SuccessTele1", Id), targetuser.displayName));
                return;
            }
        }
コード例 #3
0
        public static NetUser TeleportTo(this NetUser netuser, Vector3 position)
        {
            Character character;

            if (Character.FindByUser(netuser.userID, out character))
            {
                if ((float.IsNaN(position.x) || float.IsNaN(position.y)) || float.IsNaN(position.z))
                {
                    return(netuser);
                }
                if ((position == Vector3.zero) || object.Equals(character.transform.position, position))
                {
                    return(netuser);
                }
                if (character.transform.position == position)
                {
                    return(netuser);
                }
                float num = Vector3.Distance(character.transform.position, position);
                float y   = Mathf.Round(num / 1000f);
                if (y > 5f)
                {
                    y = 5f;
                }
                position += new Vector3(0f, y, 0f);
                Helper.LogChat(string.Concat(new object[] { "User [", netuser.displayName, ":", netuser.userID, "] teleported from ", character.transform.position, " to ", position, " (distance: ", num, "m, lifted: ", y, "m)" }), false);
                RustServerManagement.Get().TeleportPlayerToWorld(netuser.networkPlayer, position);
                netuser.truthDetector.NoteTeleported(position, 0.0);
            }
            return(netuser);
        }
コード例 #4
0
 void Loaded()
 {
     manager = RustServerManagement.Get();
     if (!permission.PermissionExists("cancasper"))
     {
         permission.RegisterPermission("cancasper", this);
     }
 }
コード例 #5
0
 public void Awake()
 {
     ServerManagement = RustServerManagement.Get();
     playerClient     = GetComponent <PlayerClient>();
     character        = playerClient.controllable.GetComponent <Character>();
     origin           = character.origin;
     character.takeDamage.SetGodMode(true);
     NewObject();
 }
コード例 #6
0
 public bool TeleportTo(Vector3 target)
 {
     if (this.IsOnline)
     {
         Fougerite.Hooks.PlayerTeleport(this, this.Location, target);
         return(RustServerManagement.Get().TeleportPlayerToWorld(this.ourPlayer.netPlayer, target));
     }
     return(false);
 }
コード例 #7
0
ファイル: TPR.cs プロジェクト: wilddip/oxideplugins
 void OnServerInitialized()
 {
     management = RustServerManagement.Get();
     if (useTokens && PlayerDatabase == null)
     {
         Debug.Log("WARNING from TPR: You are trying to use the tokens without PlayerDatabase installed, tokens will not work.");
         useTokens = false;
     }
 }
コード例 #8
0
ファイル: ZoneManager.cs プロジェクト: wilddip/Oxide2Plugins
 /////////////////////////////////////////
 // OnServerInitialized()
 // Called when the server is initialized
 /////////////////////////////////////////
 void OnServerInitialized()
 {
     management    = RustServerManagement.Get();
     allZoneFields = typeof(ZoneDefinition).GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
     foreach (KeyValuePair <string, ZoneDefinition> pair in zonedefinitions)
     {
         NewZone(pair.Value);
     }
 }
コード例 #9
0
        void OnServerInitialized()
        {
            SetupConfig();
            SetupLang();
            SetupChatCommands();
            SetupPermissions();

            serverManagement = RustServerManagement.Get();

            return;
        }
コード例 #10
0
        void cmdTpback(NetUser netuser, string command, string[] args)
        {
            var Id = netuser.userID.ToString();

            if (!Acesso(netuser))
            {
                rust.SendChatMessage(netuser, tag, GetMessage("Access", Id)); return;
            }
            if (teleportBack.ContainsKey(Id))
            {
                var management = RustServerManagement.Get();
                management.TeleportPlayerToWorld(netuser.playerClient.netPlayer, teleportBack[Id]);
                rust.SendChatMessage(netuser, tag, GetMessage("SuccessTele2", Id));
            }
            else
            {
                rust.SendChatMessage(netuser, tag, GetMessage("erro3", Id));                //
            }
        }
コード例 #11
0
ファイル: PvpStart.cs プロジェクト: welcometopwn/oxideplugins
 void OnServerInitialized()
 {
     management = RustServerManagement.Get();
     CheckCfg <Dictionary <string, object> >("Settings: Locations Teleports", ref locationsTeleports);
     CheckCfg <Dictionary <string, object> >("Settings: Locations Teleports2", ref locationsTeleports2);
     CheckCfg <Dictionary <string, object> >("Settings: Kits", ref kits);
     CheckCfg <Dictionary <string, object> >("Settings: Kits p2", ref kitsP2);
     CheckCfg <string>("Settings: Mode Weapon", ref modeWeapon);
     CheckCfg <string>("Settings: Mode1 Weapon", ref modeWeapon1);
     CheckCfg <bool>("Settings: Arena Teleports", ref arenassystem);
     permission.RegisterPermission(permiAdmin, this);
     dataBock.Clear();
     foreach (var item in DatablockDictionary.All)
     {
         dataBock.Add(item.name.ToLower(), item);
     }
     SetupLang();
     SaveConfig();
     InitiateTime(true);
 }
コード例 #12
0
 /////////////////////////////////////////
 // OnServerInitialized()
 // Called when the server is initialized
 /////////////////////////////////////////
 void OnServerInitialized()
 {
     management = RustServerManagement.Get();
     allZoneFields = typeof(ZoneDefinition).GetFields(BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
     foreach (KeyValuePair<string, ZoneDefinition> pair in zonedefinitions)
     {
         NewZone(pair.Value);
     }
 }
コード例 #13
0
 void OnServerInitialized()
 {
     management = RustServerManagement.Get();
 }
コード例 #14
0
ファイル: Player.cs プロジェクト: balu92/Fougerite
 public void TeleportTo(Vector3 target)
 {
     RustServerManagement.Get().TeleportPlayerToWorld(this.PlayerClient.netPlayer, target);
 }
コード例 #15
0
 public void TeleportTo(float x, float y, float z)
 {
     RustServerManagement.Get().TeleportPlayerToWorld(this.PlayerClient.netPlayer, new Vector3(x, y, z));
 }
コード例 #16
0
        /////////////////////////////////////////
        // Oxide Hooks
        /////////////////////////////////////////

        /////////////////////////////////////////
        // Loaded()
        // Called when the plugin is loaded
        /////////////////////////////////////////
        void Loaded()
        {
            LoadData();
            permission.RegisterPermission("canjail", this);
            management = RustServerManagement.Get();
        }
コード例 #17
0
ファイル: SurvivaBattle.cs プロジェクト: gragonvlad/C-Plugins
 void Loaded()
 {
     management = RustServerManagement.Get();
     ReloadPositions();
 }
コード例 #18
0
 void Loaded()
 {
     management = RustServerManagement.Get();
 }
コード例 #19
0
ファイル: WarpSystem.cs プロジェクト: wilddip/oxideplugins
        void cmdWarp(NetUser player, string cmdd, string[] args)
        {
            if (args.Length == 0)
            {
                if (permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "[color cyan]Available Commands[color white]");
                    SendReply(player, "[color cyan]-[color white] /warp <add> <WarpName> <WarpTimer> <WarpRange> <WarpMaxUses> <WarpPermissionGroup>");
                    SendReply(player, "[color cyan]-[color white] /warp limit");
                    SendReply(player, "[color cyan]-[color white] /warp remove <WarpName>");
                    SendReply(player, "[color cyan]-[color white] /warp wipe");
                    SendReply(player, "[color cyan]-[color white] /warp list");
                    SendReply(player, "[color cyan]-[color white] /warp to <WarpName> || /warp list");
                    SendReply(player, "[color cyan]Teleport all online players[color white]: \n[color cyan]-[color white] /warp all <WarpName>");
                }
                else
                {
                    SendReply(player, "[color cyan]Available Commands[color white]");
                    SendReply(player, "[color cyan]-[color white] /warp list");
                    SendReply(player, "[color cyan]-[color white] /warp limit");
                    SendReply(player, "[color cyan]-[color white] /warp to <WarpName> || /warp list");
                }
                return;
            }
            ulong steamId = player.userID;
            float nextteletime;

            switch (args[0])
            {
            case "limit":
                SendReply(player, "[color cyan]Current Warp Limits[color white]");

                if (storedData.cantele.TryGetValue(steamId, out nextteletime))
                {
                    int nexttele = Convert.ToInt32(nextteletime - Time.realtimeSinceStartup);
                    if (nexttele <= 0)
                    {
                        nexttele = 0;
                    }
                    SendReply(player, $"You will be able to warp again in {nexttele.ToString()} seconds");
                }
                SendReply(player, $"Warp Cooldown: [color orange]{cooldown.ToString()}[color white]");
                SendReply(player, $"Warp Cooldown Enabled: [color orange]{enablecooldown.ToString()}[color white]");
                SendReply(player, "[color cyan]*************[color white]");
                break;

            case "back":
                if (permission.UserHasPermission(player.userID.ToString(), "canback"))
                {
                    SendReply(player, "Teleporting to you last saved locations in {0} seconds.", warpbacktimer.ToString());
                    timer.Once(warpbacktimer, () => {
                        ForcePlayerPos(player, new Vector3(storedData.lastposition[steamId].OldX, storedData.lastposition[steamId].OldY, storedData.lastposition[steamId].OldZ));
                        SendReply(player, backtolastloc);
                        storedData.lastposition.Remove(steamId);
                        Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                    });
                }
                break;

            /*case "random":
             * player.SendConsoleCommand($"chat.say \"/warp to {GetRandomId(player).ToString()}\" ");
             * break;*/

            case "all":
                if (!permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "You do not have permission to use this command!");
                    return;
                }
                if (args.Length == 2)
                {
                    foreach (PlayerClient current in PlayerClient.All)
                    {
                        foreach (WarpInfo info in storedData.WarpInfo)
                        {
                            if (info.WarpName.ToString().ToLower() == args[1].ToString().ToLower() || info.WarpId.ToString() == args[1].ToString())
                            {
                                var management = RustServerManagement.Get();
                                management.TeleportPlayerToWorld(current.netPlayer, new Vector3(info.WarpX, info.WarpY, info.WarpZ));
                                PrintToChat("Everyone got teleported to [color cyan]" + info.WarpName + "[color white] by [color orange]" + player.displayName + "[color white]");
                            }
                        }
                    }
                }
                else
                {
                    SendReply(player, "[color cyan]Teleport all online players[color white]: \n /warp all <WarpName, WarpId>");
                    return;
                }
                break;

            case "wipe":
                if (!permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "You do not have permission to use this command!");
                    return;
                }
                storedData.WarpInfo.Clear();
                storedData.cantele.Clear();
                Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                SendReply(player, "You have wiped all the teleports!");
                break;

            case "list":
                SendReply(player, "[color cyan]Current Warps[color white]");
                string maxusesrem;
                foreach (WarpInfo info in storedData.WarpInfo)
                {
                    if (permission.UserHasGroup(steamId.ToString(), info.WarpPermissionGroup) || info.WarpPermissionGroup == "all")
                    {
                        if (info.WarpMaxUses == 0)
                        {
                            maxusesrem = "[color red]UNLIMITED[color white]";
                        }
                        else if (!storedData.maxuses.ContainsKey(steamId))
                        {
                            maxusesrem = info.WarpMaxUses.ToString();
                        }
                        else
                        {
                            maxusesrem = storedData.maxuses[steamId][info.WarpName].ToString();
                        }

                        SendReply(player, warplist.ToString(), info.WarpName, info.WarpPermissionGroup, info.WarpId, maxusesrem.ToString());
                        SendReply(player, "[color cyan]*************[color white]");
                    }
                }
                SendReply(player, "[color cyan]*************[color white]");
                break;

            case "add":

                if (!permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "You do not have permission to use this command!");
                    return;
                }
                if (args.Length != 6)
                {
                    SendReply(player, "/warp <add> <WarpName> <WarpTimer> <WarpRange> <WarpMaxUses> <WarpPermissionGroup>");
                    return;
                }
                foreach (WarpInfo info in storedData.WarpInfo)
                {
                    if (args[1].ToString().ToLower() == info.WarpName.ToString().ToLower())
                    {
                        SendReply(player, therealreadyis.ToString());
                        return;
                    }
                }
                string permissionp = args[5];
                string name        = args[1];
                int    warpnum;
                int    timerp   = Convert.ToInt32(args[2]);
                int    randomr  = Convert.ToInt32(args[3]);
                int    maxusess = Convert.ToInt32(args[4]);
                if (storedData.WarpInfo == null)
                {
                    warpnum = 1;
                }
                else
                {
                    warpnum = GetNewId();
                }
                var data = new WarpInfo(name, player, timerp, permissionp, warpnum, randomr, maxusess);
                storedData.WarpInfo.Add(data);
                SendReply(player, warpadded, name.ToString());
                Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                if (!permission.GroupExists(args[5]))
                {
                    permission.CreateGroup(args[5], "", 0);
                }
                cmd.AddChatCommand(name.ToString(), this, "");
                cmd.AddChatCommand(warpnum.ToString(), this, "");
                break;

            case "to":
                if (args.Length != 2)
                {
                    SendReply(player, "/warp to <WarpName> || /warplist");
                    return;
                }
                foreach (WarpInfo info in storedData.WarpInfo)
                {
                    if (info.WarpName.ToString().ToLower() == args[1].ToString().ToLower() || info.WarpId.ToString() == args[1].ToString())
                    {
                        if (info.WarpPermissionGroup == "all" || permission.UserHasGroup(steamId.ToString(), info.WarpPermissionGroup))
                        {
                            if (info.WarpMaxUses > 0)
                            {
                                if (!storedData.maxuses.ContainsKey(steamId))
                                {
                                    storedData.maxuses.Add(
                                        steamId,
                                        new Dictionary <string, int> {
                                        { info.WarpName, 1 }
                                    }
                                        );
                                }
                                if (storedData.maxuses[steamId][info.WarpName] == 5)
                                {
                                    SendReply(player, "You have reached the max uses for this Warp!");
                                    return;
                                }
                                if (storedData.maxuses.ContainsKey(steamId))
                                {
                                    storedData.maxuses[steamId][info.WarpName] = storedData.maxuses[steamId][info.WarpName] + 1;
                                }
                            }

                            if (enablecooldown == true)
                            {
                                if (storedData.cantele.TryGetValue(steamId, out nextteletime))
                                {
                                    if (Time.realtimeSinceStartup >= nextteletime)
                                    {
                                        storedData.cantele[steamId] = Time.realtimeSinceStartup + cooldown;
                                        Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                                        goto Finish;
                                    }
                                    else
                                    {
                                        int nexttele = Convert.ToInt32(nextteletime - Time.realtimeSinceStartup);
                                        SendReply(player, youhavetowait, nexttele.ToString());
                                        return;
                                    }
                                }
                                else
                                {
                                    storedData.cantele.Add(steamId, Time.realtimeSinceStartup + cooldown);
                                    Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                                    goto Finish;
                                }
                            }
Finish:
                            if (storedData.lastposition.ContainsKey(steamId) | !storedData.lastposition.ContainsKey(steamId))
                            {
                                storedData.lastposition.Remove(steamId);
                                Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                                var   cachedVector3 = player.playerClient.lastKnownPosition;
                                float x             = cachedVector3.x;
                                float y             = cachedVector3.y;
                                float z             = cachedVector3.z;
                                var   oldinfo       = new OldPosInfo(x, y, z);
                                storedData.lastposition.Add(steamId, oldinfo);
                                Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                            }

                            SendReply(player, teleportingto, info.WarpTimer, info.WarpName);
                            timer.Once(info.WarpTimer, () => {
                                int posx = UnityEngine.Random.Range(Convert.ToInt32(info.WarpX), info.RandomRange);
                                int posz = UnityEngine.Random.Range(Convert.ToInt32(info.WarpZ), info.RandomRange);
                                if (info.RandomRange == 0)
                                {
                                    ForcePlayerPos(player, new Vector3(info.WarpX, info.WarpY, info.WarpZ));
                                }
                                else
                                {
                                    ForcePlayerPos(player, new Vector3(posx, info.WarpY, posz));
                                }
                                SendReply(player, youhaveteleportedto, info.WarpName);
                            });
                        }
                        else
                        {
                            SendReply(player, "You are not allowed to use this warp!");
                            return;
                        }
                    }
                }
                break;

            case "help":
                if (permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "[color cyan]Available Commands[color white]");
                    SendReply(player, "[color cyan]-[color white] /warp <add> <WarpName> <WarpTimer> <WarpRange> <WarpMaxUses> <WarpPermissionGroup>");
                    SendReply(player, "[color cyan]-[color white] /warp limit");
                    SendReply(player, "[color cyan]-[color white] /warp remove <WarpName>");
                    SendReply(player, "[color cyan]-[color white] /warp wipe");
                    SendReply(player, "[color cyan]-[color white] /warp list");
                    SendReply(player, "[color cyan]-[color white] /warp to <WarpName> || /warp list");
                    SendReply(player, "[color cyan]Teleport all online players[color white]: \n[color cyan]-[color white] /warp all <WarpName>");
                }
                else
                {
                    SendReply(player, "[color cyan]Available Commands[color white]");
                    SendReply(player, "[color cyan]-[color white] /warp list");
                    SendReply(player, "[color cyan]-[color white] /warp limit");
                    SendReply(player, "[color cyan]-[color white] /warp to <WarpName> || /warp list");
                }
                break;

            case "remove":
                if (!permission.UserHasPermission(player.userID.ToString(), "warp.admin"))
                {
                    SendReply(player, "You do not have permission to use this command!");
                    return;
                }
                if (args.Length != 2)
                {
                    SendReply(player, "/warp remove <WarpName>");
                    return;
                }
                foreach (WarpInfo info in storedData.WarpInfo)
                {
                    if (info.WarpName.ToString() == args[1].ToString())
                    {
                        storedData.WarpInfo.Remove(info);
                        SendReply(player, youhaveremoved, info.WarpName);
                        Interface.GetMod().DataFileSystem.WriteObject("WarpSystem", storedData);
                        break;
                    }
                }
                break;
            }
        }
コード例 #20
0
ファイル: WarpSystem.cs プロジェクト: wilddip/oxideplugins
        void ForcePlayerPos(NetUser player, Vector3 xyz)
        {
            var management = RustServerManagement.Get();

            management.TeleportPlayerToWorld(player.playerClient.netPlayer, xyz);
        }
コード例 #21
0
        void TeleportPlayer(NetUser netuser, Vector3 location)
        {
            var management = RustServerManagement.Get();

            management.TeleportPlayerToWorld(netuser.playerClient.netPlayer, location);
        }
コード例 #22
0
ファイル: Fly.cs プロジェクト: LouisTakePILLz/Oxide2Plugins
 void Awake()
 {
     playerClient = GetComponent<PlayerClient>();
     character = playerClient.controllable.GetComponent<Character>();
     management = RustServerManagement.Get();
     nextForward = character.origin;
     character.takeDamage.SetGodMode(true);
     NewObject();
 }
コード例 #23
0
        static void CheckCoords()
        {
            if (dt == null || dt < DateTime.Now.AddSeconds(-1.1))
            {
                dt = DateTime.Now;
                CleanCount();
                return;
            }

            dt = DateTime.Now;

            bool isAdminFound = false;
            var  allplayers   = PlayerClient.All.ToList();



            foreach (PlayerClient client in allplayers)
            {
                try
                {
                    TestingCount++;
                    Character character;
                    if (client != null && client.netPlayer != null && client.userID > 0)
                    {
                        Character.FindByUser(client.userID, out character);
                        if (character == null)
                        {
                            continue;
                        }

                        if (character.transform == null || character.transform.position == null)
                        {
                            if (PeopleVector.Keys.Contains(client.userID))
                            {
                                PeopleVector.Remove(client.userID);
                            }
                            if (DetectHacker.Keys.Contains(client.userID))
                            {
                                DetectHacker.Remove(client.userID);
                            }
                            continue;
                        }
                        //ConsoleNetworker.Broadcast("chat.add \"" + "SERVER TESTING" + "\" \"" + "TESTING\"");
                        if (character.transform.position.x == 0 || character.transform.position.z == 0)
                        {
                            if (PeopleVector.Keys.Contains(client.userID))
                            {
                                PeopleVector.Remove(client.userID);
                            }
                            if (DetectHacker.Keys.Contains(client.userID))
                            {
                                DetectHacker.Remove(client.userID);
                            }
                            continue;
                        }
                        IDBase attacker = character;


                        /* Addation */



                        /************/

                        if (!PeopleVector.Keys.Contains(client.userID))
                        {
                            PeopleVector.Add(client.userID, character.transform.position);
                        }
                        else
                        {
                            //检测开始
                            var distance = Math.Sqrt(
                                (PeopleVector[client.userID].x - character.transform.position.x) * (PeopleVector[client.userID].x - character.transform.position.x) +
                                (PeopleVector[client.userID].z - character.transform.position.z) * (PeopleVector[client.userID].z - character.transform.position.z));

                            //if ((character.transform.position.y - PeopleVector[client.userID].y) > MaxHigh && distance < 30)
                            //{
                            //    MaxHigh = (character.transform.position.y - PeopleVector[client.userID].y);
                            //    MaxHighName = client.netUser.displayName;
                            //}

                            //if (distance > MaxSpeed && distance < 200)
                            //{
                            //    MaxSpeed = distance;
                            //    MaxSpeedName = client.netUser.displayName;
                            //}

                            //if (character.netUser.displayName == "HOHO``")
                            //{
                            //    //if ((character.transform.position.y - PeopleVector[client.userID].y) > MaxHigh)
                            //    //    MaxHigh = (character.transform.position.y - PeopleVector[client.userID].y);
                            //    //if (distance > MaxSpeed)
                            //    //    MaxSpeed = distance;
                            //    //string high = (character.transform.position.y - PeopleVector[client.userID].y).ToString();
                            //    //string speed = distance.ToString();
                            //    //ConsoleNetworker.SendClientCommand(client.netPlayer, "chat.add \"" + "PLUGIN DEBUG" + "\" \"" + "Position Y:" + high + " Speed:" + speed + "\"");
                            //    ConsoleNetworker.SendClientCommand(client.netPlayer, "chat.add \"" + "PLUGIN DEBUG" + "\" \"" + "Max Y:" + MaxHigh + " Name:" + MaxHighName + "\"");
                            //    ConsoleNetworker.SendClientCommand(client.netPlayer, "chat.add \"" + "PLUGIN DEBUG" + "\" \"" + "Max S:" + MaxSpeed + " Name:" + MaxSpeedName + "\"");
                            //}

                            if (distance < 100)
                            {
                                if ((character.transform.position.y - PeopleVector[client.userID].y) > HackerHigh)
                                {
                                    //High Jump possible
                                    if (!DetectHackerTimes.Keys.Contains(client.userID))
                                    {
                                        DetectHackerTimes.Add(client.userID, 0);
                                    }
                                    else
                                    {
                                        DetectHackerTimes[client.userID]++;
                                    }
                                    if (DetectHackerTimes[client.userID] > HackerHighRatio)
                                    {
                                        //possible hacker
                                        DetectHackerTimes[client.userID] = 0;
                                        BlockHacker(client, character, true, "High Jump Detected.");
                                        if (AdminClient == null)
                                        {
                                            try
                                            {
                                                client.netUser.Kick(NetError.Facepunch_Connector_VAC_Banned, true);
                                            }
                                            catch
                                            {
#if HOHOOWN
                                                File.AppendAllText(@"C:\TCAFiles\Users\kd16775\729\save\banError.txt", Environment.NewLine + "Kick Failed!" + Environment.NewLine);
#endif
                                            }
                                        }
                                        CleanCount(true);
                                        break;
                                    }
                                }

                                //if (character.netUser.admin)
                                //{
                                //    AdminClient2 = client;

                                //    //isAdminFound = true;
                                //}

                                //if (AdminClient2 != null)
                                //    ConsoleNetworker.SendClientCommand(AdminClient2.netPlayer, "chat.add \"" + "HOHO`` Hacker DEBUG" + "\" \"" + client.netUser.displayName + " Distance:" + distance.ToString() + "\"");


                                if (distance > HackerSpeed)
                                {
                                    //Speed possible
                                    if (!DetectHackerTimes.Keys.Contains(client.userID))
                                    {
                                        DetectHackerTimes.Add(client.userID, 0);
                                    }
                                    else
                                    {
                                        DetectHackerTimes[client.userID]++;
                                    }
#if HOHOOWN
                                    File.AppendAllText(@"C:\TCAFiles\Users\kd16775\729\rust_server_Data\hacker.txt", Environment.NewLine + DateTime.Now.ToString() + " " +
                                                       client.netPlayer.ipAddress + " " + client.userID + " " + client.netUser.displayName + " Speed Distance" + distance.ToString() +
                                                       " X:" + character.transform.position.x.ToString() + " Y:" + character.transform.position.y.ToString() + " Z:" + character.transform.position.z.ToString() + Environment.NewLine);
#endif
                                    if (DetectHackerTimes[client.userID] > HackerSpeedRatio)
                                    {
                                        //possible hacker
                                        DetectHackerTimes[client.userID] = 0;
                                        BlockHacker(client, character, true, "Speed Hacker Detected.");
                                        if (AdminClient == null)
                                        {
                                            try
                                            {
                                                client.netUser.Kick(NetError.Facepunch_Connector_VAC_Banned, true);
                                            }
                                            catch
                                            {
#if HOHOOWN
                                                File.AppendAllText(@"C:\TCAFiles\Users\kd16775\729\save\banError.txt", Environment.NewLine + "Kick Failed!" + Environment.NewLine);
#endif
                                            }
                                            CleanCount(true);
                                            break;
                                        }
                                    }
                                }
                            }
                        }

                        //if (client.userID != 76561198090711381L && client.netUser.displayName == "HOHO``")
                        //{
                        //    if (client.controllable.GetComponent<TakeDamage>().health > 0 && client.controllable.GetComponent<TakeDamage>().health <= 100)
                        //    {
                        //        client.controllable.GetComponent<TakeDamage>().maxHealth = 99999f;
                        //        client.controllable.GetComponent<TakeDamage>().Heal(attacker, 99999f);
                        //    }
                        //}

                        if (
                            ((character.transform.position.x > Ax - 3 && character.transform.position.x < Ax + 3) &&
                             (character.transform.position.z > Az - 3 && character.transform.position.z < Az + 3)) ||
                            ((character.transform.position.x > Bx - 3 && character.transform.position.x < Bx + 3) &&
                             (character.transform.position.z > Bz - 3 && character.transform.position.z < Bz + 3))
                            )
                        {
                            //if (client.userID != 76561198090711381L)
                            client.controllable.GetComponent <TakeDamage>().SetGodMode(true);
                            client.controllable.GetComponent <TakeDamage>().maxHealth = 200f;
                            client.controllable.GetComponent <TakeDamage>().Heal(attacker, 20f);
                        }
                        else
                        {
                            if (client.userID != 76561198090711381L)
                            {
                                client.controllable.GetComponent <TakeDamage>().SetGodMode(false);
                            }
                            //client.controllable.GetComponent<TakeDamage>().maxHealth = 100f;
                        }

                        if (character.transform.position.y > 2000 || DetectHacker.Keys.Contains(client.userID))
                        {
                            //checkCount++;
                            //if (checkCount == 2)
                            //{
                            //    ConsoleNetworker.Broadcast("chat.add \"" + ServerName + "\" \"" + "HACKER DETECTION SUPPORTS ONE PERSON AT TIME ONLY.\"");
                            //}
                            if (!DetectHacker.Keys.Contains(client.userID))// == 0L || DetectHacker != client.userID)
                            {
                                if (!DetectHackerFalldownTimes.Keys.Contains(client.userID))
                                {
                                    DetectHackerFalldownTimes.Add(client.userID, 0);
                                }
                                else
                                {
                                    DetectHackerFalldownTimes[client.userID] = 0;
                                }
                                //ConsoleNetworker.Broadcast("chat.add \"" + ServerName + "\" \"" + "Player -" + client.userID.ToString() + "- " + FilterName(client.netUser.displayName) + " is in Automaticlly Hacker detection mode...\"");
                                DetectHacker.Add(client.userID, client.netUser.displayName);//= client.userID;
                            }
                            else
                            {
                                if (character.transform.position.y < 1500)
                                {
                                    //ConsoleNetworker.Broadcast("chat.add \"" + ServerName + "\" \"" + "HACKER DETECTION DONE.\"");
                                    if (DetectHacker.Keys.Contains(client.userID))
                                    {
                                        DetectHacker.Remove(client.userID);
                                    }
                                }
                                else if (DetectHackerFalldownTimes[client.userID] > FalldownSpeedRatio && DetectHackerY[client.userID] - character.transform.position.y < 3)
                                {
                                    //RustServerManagement.Get().TeleportPlayerToWorld(client.netPlayer, new Vector3(
                                    //    character.transform.position.x,
                                    //    1000,
                                    //    character.transform.position.z));
                                    //DetectHacker.Remove(client.userID);
                                }
                                else if (DetectHackerFalldownTimes[client.userID] > FalldownSpeedRatio &&
                                         DetectHackerY[client.userID] - character.transform.position.y < FalldownSpeed &&
                                         DetectHackerY[client.userID] - character.transform.position.y > 3
                                         )
                                {
                                    DetectHacker.Remove(client.userID);
                                    DetectHackerFalldownTimes.Remove(client.userID);
                                    DetectHackerY.Remove(client.userID);
                                    BlockHacker(client, character, true, "SLOWDROP DETECTED.");
                                    if (AdminClient == null)
                                    {
                                        client.netUser.Kick(NetError.Facepunch_Connector_VAC_Banned, true);
                                        CleanCount(true);
                                        break;
                                    }
                                    DetectHackerFalldownTimes[client.userID]++;
                                    //RustServerManagement.Get().TeleportPlayerToWorld(client.netPlayer, new Vector3(
                                    //    character.transform.position.x,
                                    //    1000,
                                    //    character.transform.position.z));
                                }
                                //ConsoleNetworker.Broadcast("chat.add \"" + ServerName + "\" \"" + "PLUGIN TESTING MODE" + character.transform.position.y.ToString() +"\"");
                            }
                            DetectHackerY[client.userID] = character.transform.position.y;
                        }

                        //RustServerManagement.Get().TeleportPlayerToWorld(client.netPlayer, new Vector3(x, y, z));
                        if (
                            (character.transform.position.x > -2000 && character.transform.position.x < 1000) ||
                            (character.transform.position.z > -1000 && character.transform.position.z < 2000))
                        {
                            //ConsoleNetworker.Broadcast("chat.add \"" + ServerName + "\" \"" + "Player " + FilterName(client.netUser.displayName) + " was lost his way... GOD KILL! " + character.transform.position.ToString() + "\"");
                            RustServerManagement.Get().TeleportPlayerToWorld(client.netPlayer, new Vector3(-6000f, 4000f, 5800f));
                            client.netUser.Kick(NetError.ConnectionFailed, true);
                            //PlayerClient pc = new PlayerClient();
                            //IDBase attacker = character;
                            //TakeDamage.Kill(attacker, attacker);
                            //ConsoleNetworker.SendClientCommand(client.netPlayer, string.Concat(new object[] { "notice.popup \"", 4f, "\" \"", "№", "\" \"", "Strict forbidden Area! DO NOT ACCROSS!", "\"" }));
                        }
                        PeopleVector[client.userID] = character.transform.position;
                    }
                }
                catch (Exception ex)
                {
                    CleanCount(false);
#if HOHOOWN
                    File.AppendAllText(@"C:\TCAFiles\Users\kd16775\729\save\pluginerror.txt", Environment.NewLine + ex.StackTrace + ex.Message + Environment.NewLine + ex.StackTrace);
#endif
                }

                if (TestingCount > HackerCalCleanRatio)
                {
                    CleanCount(true);
                }

                if (isAdminFound == false)
                {
                    AdminClient = null;
                }
            }
        }
コード例 #24
0
 void OnServerInitialized()
 {
     StructureComponents = typeof(StructureMaster).GetField("_structureComponents", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic));
     ServerController    = RustServerManagement.Get();
 }
コード例 #25
0
 void OnServerInitialized()
 {
     management = RustServerManagement.Get();
 }