void cmdChatPlaceback(BasePlayer player, string command, string[] args) { if (player.net.connection.authLevel < 1) { SendReply(player, "You are not allowed to use this command"); return; } if (args == null || args.Length == 0) { SendReply(player, "You need to set the name of the copy file: /placeback NAME"); return; } heightAdjustment = 0; filename = string.Format("copypaste-{0}", args[0].ToString()); Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename); if (PasteData["structure"] == null || PasteData["default"] == null) { SendReply(player, "This is not a correct copypaste file, or it\'s empty."); return; } Dictionary <string, object> defaultData = PasteData["default"] as Dictionary <string, object>; Dictionary <string, object> defaultPos = defaultData["position"] as Dictionary <string, object>; Vector3 defaultposition = new Vector3(Convert.ToSingle(defaultPos["x"]), Convert.ToSingle(defaultPos["y"]), Convert.ToSingle(defaultPos["z"])); List <object> structureData = PasteData["structure"] as List <object>; List <object> deployablesData = PasteData["deployables"] as List <object>; PasteBuilding(structureData, defaultposition, Convert.ToSingle(defaultData["yrotation"]), heightAdjustment); PasteDeployables(deployablesData, defaultposition, Convert.ToSingle(defaultData["yrotation"]), heightAdjustment, player); }
void Init() { LoadConfig(); mySave = Interface.GetMod().DataFileSystem.GetDatafile("UniqueName"); if (mySave["UserNames"] != null) { if (((Dictionary <string, object>)mySave["UserNames"]).Count != 0) { UserNames = (Dictionary <string, object>)mySave["UserNames"]; } } if (mySave["Users"] != null) { if (((Dictionary <string, object>)mySave["Users"]).Count != 0) { Users = (Dictionary <string, object>)mySave["Users"]; } } foreach (BasePlayer CurrentPlayer in BasePlayer.activePlayerList) { CheckPlayer(CurrentPlayer); } mySaveData(); }
void cmdChatPaste(BasePlayer player, string command, string[] args) { if (!hasAccess(player)) { return; } if (args == null || args.Length == 0) { SendReply(player, "You need to set the name of the copy file: /paste NAME optional:HeightAdjustment"); return; } // Adjust height so you don't automatically paste in the ground heightAdjustment = 0.5f; if (args.Length > 1) { float.TryParse(args[1].ToString(), out heightAdjustment); } // Get player camera view directly from the player if (!TryGetPlayerView(player, out currentRot)) { SendReply(player, "Couldn\'t find your eyes"); return; } // Get what the player is looking at if (!TryGetClosestRayPoint(player.transform.position, currentRot, out closestEnt, out closestHitpoint)) { SendReply(player, "Couldn\'t find any Entity"); return; } // Check if what the player is looking at is a collider var baseentity = closestEnt as Collider; if (baseentity == null) { SendReply(player, "You are not looking at a Structure, or something is blocking the view."); return; } closestHitpoint.y = closestHitpoint.y + heightAdjustment; filename = string.Format("copypaste-{0}", args[0].ToString()); Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename); if (PasteData["structure"] == null || PasteData["default"] == null) { SendReply(player, "This is not a correct copypaste file, or it\'s empty."); return; } List <object> structureData = PasteData["structure"] as List <object>; List <object> deployablesData = PasteData["deployables"] as List <object>; List <object> spawnablesData = PasteData["spawnables"] as List <object>; PasteBuilding(structureData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment); PasteDeployables(deployablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player); PasteSpawnables(spawnablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player); }
private void LoadBeaconData() { //Debug.Log("Loading data..."); try { //BeaconData = Interface.GetMod().DataFileSystem.ReadObject<Oxide.Core.Configuration.DynamicConfigFile>("PersonalBeacon_Data"); BeaconData = Interface.GetMod().DataFileSystem.GetDatafile("PersonalBeacon_Data"); } catch { Debug.Log("Failed to load datafile."); } //Debug.Log("Data should be loaded."); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Oxide Hooks ////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Loaded() { BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners"); lang.RegisterMessages(new Dictionary <string, string> { { "You don't have the permissions to use this command.", "You don't have the permissions to use this command." }, { "You are not allowed to use this command.", "You are not allowed to use this command." }, { "Syntax: /changeowner PLAYERNAME/STEAMID", "Syntax: /changeowner PLAYERNAME/STEAMID" }, { "Target player not found.", "Target player not found." }, { "New owner of this house is: {0}", "New owner of this house is: {0}" }, { "An admin gave you the ownership of this house", "An admin gave you the ownership of this house" } }, this); }
////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Oxide Hooks ////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Loaded() { BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners"); lang.RegisterMessages(new Dictionary<string, string> { {"You don't have the permissions to use this command.","You don't have the permissions to use this command." }, {"You are not allowed to use this command.","You are not allowed to use this command." }, {"Syntax: /changeowner PLAYERNAME/STEAMID","Syntax: /changeowner PLAYERNAME/STEAMID" }, {"Target player not found.","Target player not found." }, {"New owner of this house is: {0}","New owner of this house is: {0}" }, {"An admin gave you the ownership of this house","An admin gave you the ownership of this house" } }, this); }
void Init() { LoadConfig(); mySave = Interface.GetMod().DataFileSystem.GetDatafile("HappyHour"); if (mySave["Users"] != null) { if (((Dictionary <string, object>)mySave["Users"]).Count != 0) { Users = (Dictionary <string, object>)mySave["Users"]; } } mySaveData(); MainTimer = Interface.GetMod().GetLibrary <Oxide.Core.Libraries.Timer>("Timer"); MainTime = Interface.GetMod().GetLibrary <Time>("Time"); }
void cmdChatPaste(NetUser player, string command, string[] args) { if (!hasAccess(player)) { return; } if (args == null || args.Length == 0) { SendReply(player, "You need to set the name of the copy file: /paste NAME optional:HeightAdjustment"); return; } // Adjust height so you don't automatically paste in the ground heightAdjustment = 0.5f; if (args.Length > 1) { float.TryParse(args[1].ToString(), out heightAdjustment); } // Get player camera view directly from the player if (!TryGetPlayerView(player, out currentRot)) { SendReply(player, "Couldn't find your eyes"); return; } // Get what the player is looking at if (!TryGetClosestPoint(player.playerClient.rootControllable.GetComponent <Character>().eyesOrigin, currentRot, out closestEnt, out closestHitpoint)) { SendReply(player, "Couldn't find any Entity"); return; } closestHitpoint.y = closestHitpoint.y - 4f + heightAdjustment; filename = string.Format("copypaste-{0}", args[0].ToString()); Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename); if (PasteData["structure"] == null || PasteData["default"] == null) { SendReply(player, "This is not a correct copypaste file, or it's empty."); return; } List <object> structureData = PasteData["structure"] as List <object>; List <object> deployablesData = PasteData["deployables"] as List <object>; PasteBuilding(structureData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player); PasteDeployables(deployablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player); }
private void SendBasePlayerFind(BasePlayer player, ulong ownerid) { BasePlayer targetplayer = BasePlayer.FindByID(ownerid); if (targetplayer != null) { SendReply(player, string.Format("{0} - {1} - Online", targetplayer.displayName.ToString(), ownerid.ToString())); return; } targetplayer = BasePlayer.FindSleeping(ownerid); if (targetplayer != null) { SendReply(player, string.Format("{0} - {1} - Sleeping", targetplayer.displayName.ToString(), ownerid.ToString())); return; } if (deadplayers is Oxide.Core.Plugins.Plugin) { /*object deadplayer = ((Oxide.Core.Plugins.Plugin)deadplayers).CallHook("FindDeadPlayerByID", new object[1] { ownerid.ToString() }); * * if (!(deadplayer is bool)) * { * if (deadplayer != null) * { * Puts(deadplayer.ToString()); * Dictionary<string, object> data = deadplayer as Dictionary<string, object>; * foreach (KeyValuePair<string, object> pair in data) * { * Puts(pair.Key.ToString()); * //if (pair.Key.ToString() == "displayName") * //{ * // SendReply(player, string.Format("{0} - {1} - Dead", pair.Value.ToString(), ownerid.ToString())); * //} * } * } * }*/ deadPlayersData = Interface.GetMod().DataFileSystem.GetDatafile("deadPlayerList"); if (deadPlayersData[ownerid.ToString()] != null) { Dictionary <string, object> data = deadPlayersData[ownerid.ToString()] as Dictionary <string, object>; SendReply(player, string.Format("{0} - {1} - Dead", data["displayName"].ToString(), ownerid.ToString())); return; } } SendReply(player, string.Format("{0} - {1} - Dead", "Unknown Player", ownerid.ToString())); }
///////////////////////// // Loaded() // Called when the server was initialized (when people can start joining) ///////////////////////// void OnServerInitialized() { ACData = Interface.GetMod().DataFileSystem.GetDatafile("AntiCheat"); getblueprints = typeof(PlayerInventory).GetField("_boundBPs", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic)); getlooters = typeof(Inventory).GetField("_netListeners", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic)); wooddata = DatablockDictionary.GetByName("Wood"); PlayerHandler phandler; foreach (PlayerClient player in PlayerClient.All) { if (hasPermission(player.netUser)) { continue; } phandler = player.gameObject.AddComponent <PlayerHandler>(); phandler.timeleft = GetPlayerData(player); phandler.StartCheck(); } }
void OnNewSave(string name) { Interface.Oxide.LogWarning("BuildingOwners: Wipe detected. Saving last buildingowners data in BuildingOwners_backup"); var BuildingOwnersData_backup = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners_backup"); BuildingOwnersData_backup.Clear(); var e = BuildingOwnersData.GetEnumerator(); while (e.MoveNext()) { BuildingOwnersData_backup[e.Current.Key] = e.Current.Value; } Interface.GetMod().DataFileSystem.SaveDatafile("BuildingOwners_backup"); BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners"); BuildingOwnersData.Clear(); SaveData(); }
private void SendBasePlayerFind(BasePlayer player, ulong ownerid) { BasePlayer targetplayer = BasePlayer.FindByID(ownerid); if (targetplayer != null) { SendReply(player, string.Format("{0} - {1} - Online", targetplayer.displayName.ToString(), ownerid.ToString())); return; } targetplayer = BasePlayer.FindSleeping(ownerid); if (targetplayer != null) { SendReply(player, string.Format("{0} - {1} - Sleeping", targetplayer.displayName.ToString(), ownerid.ToString())); return; } if (deadplayers is Oxide.Core.Plugins.Plugin) { /*object deadplayer = ((Oxide.Core.Plugins.Plugin)deadplayers).CallHook("FindDeadPlayerByID", new object[1] { ownerid.ToString() }); if (!(deadplayer is bool)) { if (deadplayer != null) { Puts(deadplayer.ToString()); Dictionary<string, object> data = deadplayer as Dictionary<string, object>; foreach (KeyValuePair<string, object> pair in data) { Puts(pair.Key.ToString()); //if (pair.Key.ToString() == "displayName") //{ // SendReply(player, string.Format("{0} - {1} - Dead", pair.Value.ToString(), ownerid.ToString())); //} } } }*/ deadPlayersData = Interface.GetMod().DataFileSystem.GetDatafile("deadPlayerList"); if (deadPlayersData[ownerid.ToString()] != null) { Dictionary<string, object> data = deadPlayersData[ownerid.ToString()] as Dictionary<string, object>; SendReply(player, string.Format("{0} - {1} - Dead", data["displayName"].ToString(), ownerid.ToString())); return; } } SendReply(player, string.Format("{0} - {1} - Dead", "Unknown Player", ownerid.ToString())); }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("SleeperLog"); }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("PlayerInfo"); }
void OnServerInitialized() { ReverseData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners"); serverInitialized = true; ReverseTable(); }
void cmdChatCopy(BasePlayer player, string command, string[] args) { if (!hasAccess(player)) { return; } if (args == null || args.Length == 0) { SendReply(player, "You need to set the name of the copy file: /copy NAME"); return; } // Get player camera view directly from the player if (!TryGetPlayerView(player, out currentRot)) { SendReply(player, "Couldn\'t find your eyes"); return; } // Get what the player is looking at if (!TryGetClosestRayPoint(player.transform.position, currentRot, out closestEnt, out closestHitpoint)) { SendReply(player, "Couldn\'t find any Entity"); return; } // Check if what the player is looking at is a collider var baseentity = closestEnt as Collider; if (baseentity == null) { SendReply(player, "You are not looking at a Structure, or something is blocking the view."); return; } // Check if what the player is looking at is a BuildingBlock (like a wall or something like that) var buildingblock = baseentity.GetComponentInParent <BuildingBlock>(); if (buildingblock == null) { SendReply(player, "You are not looking at a Structure, or something is blocking the view."); return; } var returncopy = CopyBuilding(player.transform.position, currentRot.ToEulerAngles().y, buildingblock, out rawStructure, out rawDeployables, out rawSpawnables); if (returncopy is string) { SendReply(player, (string)returncopy); return; } if (rawStructure.Count == 0) { SendReply(player, "Something went wrong, house is empty?"); return; } Dictionary <string, object> defaultValues = new Dictionary <string, object>(); Dictionary <string, object> defaultPos = new Dictionary <string, object>(); defaultPos.Add("x", buildingblock.transform.position.x); defaultPos.Add("y", buildingblock.transform.position.y); defaultPos.Add("z", buildingblock.transform.position.z); defaultValues.Add("position", defaultPos); defaultValues.Add("yrotation", buildingblock.transform.rotation.ToEulerAngles().y); filename = string.Format("copypaste-{0}", args[0].ToString()); Core.Configuration.DynamicConfigFile CopyData = Interface.GetMod().DataFileSystem.GetDatafile(filename); CopyData.Clear(); CopyData["structure"] = rawStructure; CopyData["deployables"] = rawDeployables; CopyData["spawnables"] = rawSpawnables; CopyData["default"] = defaultValues; Interface.GetMod().DataFileSystem.SaveDatafile(filename); SendReply(player, string.Format("The house {0} was successfully saved", args[0].ToString())); SendReply(player, string.Format("{0} building parts detected", rawStructure.Count.ToString())); SendReply(player, string.Format("{0} deployables detected", rawDeployables.Count.ToString())); SendReply(player, string.Format("{0} spawnables detected", rawSpawnables.Count.ToString())); }
void fetchConfigs() { eventData = Interface.GetMod().DataFileSystem.GetDatafile("SkyEvent"); eventData["timer", "lobby"] = 30f; eventData["timer", "lobby-end"] = 2f; eventData["timer", "tick-timer"] = 1f; eventData["timer", "tick-count"] = 8; if (eventData["players", "min"] == null) { eventData["players", "min"] = 5; } }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("Bbr(pl)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Bbr(House.pl)"); }
private void InitializeKits() { KitsConfig = Interface.GetMod().DataFileSystem.GetDatafile("Kits_List"); KitsData = Interface.GetMod().DataFileSystem.GetDatafile("Kits_Data"); }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip.pl)"); Wl = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip.wl)"); }
///////////////////////////// // Data Management ///////////////////////////// void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("AdminTeleportation"); }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("ShareDatabase"); }
void LoadData() { Data = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(vpn)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(vpn.pl)"); Wl = Interface.GetMod().DataFileSystem.GetDatafile("whitelist(vpn)"); }