private void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "WorldEditor") { if (msgc.MessageByClient == "worldeditadmin") { msgc.ReturnMessage = user.Player.Admin ? "yes" : "no"; } else if (msgc.MessageByClient == "worldedit_finished") { // this._protectedPlayers.Remove(user.SteamID); // user.Player.Notice("", "All custom objects loaded. You are no longer protected!", 10); user.Player.Notice("", "All custom objects loaded.", 10); } else if (msgc.MessageByClient.Contains("worldedit_spawn")) { var splitted = msgc.MessageByClient.Split('|'); foreach (var player in Server.GetServer().Players) { player.SendConsoleMessage("worldedit_spawn|" + splitted[1]); } } else if (msgc.MessageByClient == "worldedit_kick") { user.Player.Disconnect(); } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msg) { if (msg.PluginSender == "WarpsClient") { if (teleporting.Contains(user.Player.UID)) { user.Player.Message("[color red]You are already teleporting"); return; } if (Cooldown.ContainsKey(user.Player.UID)) { double calc = TimeSpan.FromTicks(DateTime.Now.Ticks).TotalSeconds - Cooldown[user.Player.UID]; if (calc < seconds) { user.Player.Message("Cooldown Time " + (Math.Round(calc)) + " | " + seconds + " Seconds"); return; } } string[] split = msg.MessageByClient.Split(','); float one = float.Parse(split[0]); float two = float.Parse(split[1]); float three = float.Parse(split[2]); Vector3 loc = new Vector3(one, two, three); var data = new Dictionary <string, object>(); data["user"] = user.Player; data["location"] = loc; TeleportPlayer(10 * 1000, data).Start(); user.Player.Notice("Teleporting you in 10 seconds"); teleporting.Add(user.Player.UID); } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "LootSpawnerClient") { string msg = msgc.MessageByClient; string[] split = msg.Split('-'); switch (split[0]) { case "IsAdmin": msgc.ReturnMessage = user.Player.Admin ? "yes" : "no"; break; case "direct": DirectSpawn(user.Player, split[1]); msgc.ReturnMessage = "done"; break; case "spawn": bool b = AddSpawnPoint(user.Player, split[1]); msgc.ReturnMessage = b ? "yes" : "no"; break; case "forcespawn": SpawnLoots(user.Player); msgc.ReturnMessage = "done"; break; case "clearspawn": ClearLoot(user.Player); msgc.ReturnMessage = "done"; break; case "starttimer": if (!LootClass.LoadupLootEnabled) { LootClass.LoadupLootEnabled = true; msgc.ReturnMessage = "yes"; } else { msgc.ReturnMessage = "no"; } break; case "stoptimer": if (LootClass.LoadupLootEnabled) { LootClass.LoadupLootEnabled = false; msgc.ReturnMessage = "yes"; } else { msgc.ReturnMessage = "no"; } break; } } }
private void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "WorldEditor") { if (msgc.MessageByClient == "worldeditadmin") { msgc.ReturnMessage = user.Player.Admin ? "yes" : "no"; } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "StackSizesClient") { string msg = msgc.MessageByClient; string[] split = msg.Split('-'); if (split[0] == "UpdateStackSizes") { SendStackSizes(user.Player); } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "RBTestClient") { string fullmessage = msgc.MessageByClient; string[] split = fullmessage.Split('-'); if (split[0] == "randomnumber") { string randomnumber = split[1]; System.Random rnd = new Random(); msgc.ReturnMessage = rnd.Next(1000, 3000).ToString(); } } }
public void On_MessageReceived(API.RustBusterUserAPI user, Message msgc) { // If the Client Plugin that is sending the message is TestPlugin // Ensure to do this ALL the time, or you can mess up other plugin's code. if (msgc.PluginSender == "TestPlugin") { string msg = msgc.MessageByClient; string[] split = msg.Split('-'); // If The client wants to know that it can enable the gui if (split[1] == "CanGUI") { if (IDs.Contains(split[0])) { // Answer yes msgc.ReturnMessage = "yes"; } else { msgc.ReturnMessage = "no"; } } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "JianxianC") { Fougerite.Player player = user.Player; string[] spl = msgc.MessageByClient.Split('-'); if (spl.Length != 3) { return; } string evt = spl[0]; string username = spl[1]; string password = spl[2]; if (evt == "AuthMeLogin") { if (!WaitingUsers.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "You are logged in already."); msgc.ReturnMessage = "DisApproved"; return; } if (!Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", orange + "This steamid is not registered yet!"); player.MessageFrom("仙域授权", orange + "Type /authme register username password"); msgc.ReturnMessage = "DisApproved"; return; } Credential cred = Credentials[player.UID]; if (!string.Equals(cred.Username, username, StringComparison.CurrentCultureIgnoreCase)) { player.MessageFrom("仙域授权", orange + "Invalid username!"); AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username); msgc.ReturnMessage = "DisApproved"; return; } if (username.Length > 25 || password.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); msgc.ReturnMessage = "DisApproved"; return; } if (cred.HashedPassword != SHA1Hash(password)) { AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " tried to login using: " + username); player.MessageFrom("仙域授权", red + "Invalid password! Seek help here: " + yellow + " " + SocialSiteForHelp); msgc.ReturnMessage = "DisApproved"; } else { PrivilegeStorage storage = WaitingUsers[player.UID]; if (storage.WasAdmin) { player.ForceAdminOff(false); player.PlayerClient.netUser.SetAdmin(true); } if (storage.WasModerator) { player.ForceModeratorOff(false); } WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " logged in using: " + username); player.MessageFrom("仙域授权", green + "Successfully logged in!"); msgc.ReturnMessage = "Approved"; } } else if (evt == "AuthMeRegister") { if (Credentials.ContainsKey(player.UID)) { player.MessageFrom("仙域授权", red + "This STEAMID is already protected using password authentication!"); msgc.ReturnMessage = "InvalidRegistration"; return; } if (username.ToLower() == "username" || password.ToLower() == "password") { player.MessageFrom("仙域授权", orange + "Type /authme register username password"); msgc.ReturnMessage = "InvalidRegistration"; return; } bool b = Regex.IsMatch(username, @"^[a-zA-Z0-9_&@%!+<>]+$"); bool b2 = Regex.IsMatch(password, @"^[a-zA-Z0-9_&@%!+<>]+$"); if (!b || !b2) { player.MessageFrom("仙域授权", orange + "Sorry, no special characters or space! Only: a-zA-Z0-9_&@%!+<>"); msgc.ReturnMessage = "InvalidRegistration"; return; } if (username.Length > 25 || password.Length > 25) { player.MessageFrom("仙域授权", orange + "Sorry, username and password length must be below 25."); msgc.ReturnMessage = "InvalidRegistration"; return; } string hash = SHA1Hash(password); Auths.AddSetting("Login", player.SteamID, username.ToLower() + "---##---" + hash); Auths.Save(); Credentials.Add(player.UID, new Credential(username.ToLower(), hash)); player.MessageFrom("仙域授权", orange + "You have registered with: " + username + " - " + password + " (Your console has this info now too.)"); player.SendConsoleMessage(orange + "You have registered with: " + username + " - " + password); WaitingUsers.Remove(player.UID); DataStore.GetInstance().Remove("AuthMeLogin", player.UID); uLink.NetworkView.Get(player.PlayerClient.networkView) .RPC("DestroyFreezeAuthMe", player.NetworkPlayer); foreach (var x in RestrictedCommands) { player.UnRestrictCommand(x); } AuthLogger.Log(player.Name + " - " + player.SteamID + " - " + player.IP + " registered an account: " + username); msgc.ReturnMessage = "ValidRegistration"; } } }
public void OnRustBusterUserMessage(API.RustBusterUserAPI user, Message msgc) { if (msgc.PluginSender == "AdminPlusClient") { string msg = msgc.MessageByClient; string[] split = msg.Split('-'); if (split[0] == "IsAllowed") { Fougerite.Player player = user.Player; if (player.Admin || player.Moderator) { msgc.ReturnMessage = "yes"; } else { msgc.ReturnMessage = "no"; } } else { //Fougerite.Server.GetServer().Broadcast("Message: " + split[0]); Fougerite.Player SenderPlayer = FindPlayerByHWID(user.HardwareID); if (SenderPlayer != null && SenderPlayer.Admin || SenderPlayer.Moderator) { Fougerite.Player target; switch (split[0]) { case "GetPlayers": if (split.Length == 2) { Dictionary <string, string> list = GetOnlinePlayers; foreach (string hwid in list.Keys) { rpc.SendMessageToPlayer(SenderPlayer, "AddPlayerToList", hwid, list[hwid]); } } break; case "AdminMode": if (split.Length == 2) { target = SenderPlayer; if (target != null && target.IsOnline && target.IsAlive) { if (AdminInventory.ContainsKey(user.HardwareID)) { target.Inventory.ClearAll(); foreach (int slot in AdminInventory[user.HardwareID].Keys) { foreach (string item in AdminInventory[user.HardwareID][slot].Keys) { target.Inventory.AddItemTo(item, slot, AdminInventory[user.HardwareID][slot][item]); } } AdminInventory.Remove(user.HardwareID); Fougerite.Server.GetServer().BroadcastNotice(user.Name + " has gone off duty!"); } else { try { int count = 0; Dictionary <int, Dictionary <string, int> > dictslot = new Dictionary <int, Dictionary <string, int> >(); foreach (PlayerItem x in target.Inventory.Items) { if (!x.IsEmpty()) { //HWID - SLOT - ITEM NAME - QTY count++; dictslot.Add(x.Slot, new Dictionary <string, int> { { x.Name, x.Quantity } }); } } foreach (PlayerItem x in target.Inventory.ArmorItems) { if (!x.IsEmpty()) { //HWID - SLOT - ITEM NAME - QTY count++; dictslot.Add(x.Slot, new Dictionary <string, int> { { x.Name, x.Quantity } }); } } foreach (PlayerItem x in target.Inventory.BarItems) { if (!x.IsEmpty()) { //HWID - SLOT - ITEM NAME - QTY count++; dictslot.Add(x.Slot, new Dictionary <string, int> { { x.Name, x.Quantity } }); } } AdminInventory.Add(user.HardwareID, dictslot); target.Inventory.ClearAll(); target.Inventory.AddItemTo("Invisible Helmet", 36, 1); target.Inventory.AddItemTo("Invisible Vest", 37, 1); target.Inventory.AddItemTo("Invisible Pants", 38, 1); target.Inventory.AddItemTo("Invisible Boots", 39, 1); Fougerite.Server.GetServer().BroadcastNotice(user.Name + " is now on duty!"); } catch (Exception ex) { Fougerite.Server.GetServer().Broadcast(ex.StackTrace); Fougerite.Server.GetServer().Broadcast(ex.Message); } } } } break; case "ServerTime": float time = float.Parse(split[1]); World.GetWorld().Time = time; break; case "GiveKit": if (split.Length == 4) { //GiveKit - Kit - HWID //Fougerite.Player target; if (split[2] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[2]); } if (target != null && target.IsOnline && target.IsAlive) { if (target.Inventory.FreeSlots > 0) { switch (split[1]) { case "KitWood": target.Inventory.AddItem("Wood Pillar", 250); target.Inventory.AddItem("Wood Foundation", 250); target.Inventory.AddItem("Wood Wall", 250); target.Inventory.AddItem("Wood Doorway", 250); target.Inventory.AddItem("Wood Window", 250); target.Inventory.AddItem("Wood Stairs", 250); target.Inventory.AddItem("Wood Ramp", 250); target.Inventory.AddItem("Wood Ceiling", 250); target.Inventory.AddItem("Metal Door", 15); target.Inventory.AddItem("Metal Window Bars", 15); target.InventoryNotice("Received Wood Kit"); break; case "KitMetal": target.Inventory.AddItem("Metal Pillar", 250); target.Inventory.AddItem("Metal Foundation", 250); target.Inventory.AddItem("Metal Wall", 250); target.Inventory.AddItem("Metal Doorway", 250); target.Inventory.AddItem("Metal Window", 250); target.Inventory.AddItem("Metal Stairs", 250); target.Inventory.AddItem("Metal Ramp", 250); target.Inventory.AddItem("Metal Ceiling", 250); target.Inventory.AddItem("Metal Door", 15); target.Inventory.AddItem("Metal Window Bars", 15); target.InventoryNotice("Received Metal Kit"); break; case "KitWeapons": target.Inventory.AddItem("Bolt Action Rifle", 1); target.Inventory.AddItem("M4", 1); target.Inventory.AddItem("MP5A4", 1); target.Inventory.AddItem("9mm Pistol", 1); target.Inventory.AddItem("P250", 1); target.Inventory.AddItem("Shotgun", 1); target.Inventory.AddItem("556 Ammo", 250); target.Inventory.AddItem("9mm Ammo", 250); target.Inventory.AddItem("Shotgun Shells", 250); target.InventoryNotice("Received Weapons Kit"); break; case "KitUber": target.Inventory.AddItem("Uber Hatchet", 1); target.Inventory.AddItem("Uber Hunting Bow", 1); target.Inventory.AddItem("Arrow", 80); target.InventoryNotice("Received Uber Kit"); break; case "KitKevlar": target.Inventory.RemoveItem(36); target.Inventory.RemoveItem(37); target.Inventory.RemoveItem(38); target.Inventory.RemoveItem(39); target.Inventory.AddItemTo("Kevlar Helmet", 36, 1); target.Inventory.AddItemTo("Kevlar Vest", 37, 1); target.Inventory.AddItemTo("Kevlar Pants", 38, 1); target.Inventory.AddItemTo("Kevlar Boots", 39, 1); target.InventoryNotice("Received Kevlar Armour"); break; case "KitAdmin": target.Inventory.RemoveItem(36); target.Inventory.RemoveItem(37); target.Inventory.RemoveItem(38); target.Inventory.RemoveItem(39); target.Inventory.AddItemTo("Invisible Helmet", 36, 1); target.Inventory.AddItemTo("Invisible Vest", 37, 1); target.Inventory.AddItemTo("Invisible Pants", 38, 1); target.Inventory.AddItemTo("Invisible Boots", 39, 1); target.InventoryNotice("Received Admin Suit"); break; } if (split[2] != user.HardwareID) { target.Notice(user.Name + " has given you a kit"); } } } } break; case "GiveItem": if (split.Length == 5) { //GiveItem - Item Name - Amount - Target HWID if (split[3] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[3]); } if (target != null && target.IsOnline && target.IsAlive) { if (target.Inventory.FreeSlots > 0) { target.Inventory.AddItem(split[1], int.Parse(split[2])); if (split[3] == user.HardwareID) { target.InventoryNotice(split[2] + "x " + split[1]); } else { target.Notice(user.Name + " has given you " + split[2] + "x " + split[1]); } } } } break; case "Mute": if (split.Length == 3) { //Mute - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { rpp.Mute(target.UID, target.Name); target.Notice("", "You have been muted by " + user.Name, 15); } } break; case "UnMute": if (split.Length == 3) { //UnMute - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { rpp.UnMute(target.UID); target.Notice("", "You have been unmuted by " + user.Name, 15); } } break; case "Freeze": if (split.Length == 3) { //Freeze - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { rpc.SendMessageToPlayer(target, "FreezeMode", true); target.Notice("", "You have been frozen by " + user.Name, 15); } } break; case "UnFreeze": if (split.Length == 3) { //UnFreeze - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { rpc.SendMessageToPlayer(target, "FreezeMode", false); target.Notice("", "You have been unfrozen by " + user.Name, 15); } } break; case "ClearInventory": if (split.Length == 3) { //ClearInventory - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { target.Inventory.ClearAll(); target.InventoryNotice("Inventory cleared"); } } break; case "ClearArmour": if (split.Length == 3) { //ClearInventory - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null && target.IsOnline && target.IsAlive) { target.Inventory.ClearArmor(); target.InventoryNotice("Armour cleared"); } } break; case "Ban": if (split.Length == 3) { //Ban - Target HWID target = FindPlayerByHWID(split[1]); if (target != null && target.IsOnline) { Logger.LogWarning(user.Name + " has banned " + target.Name); Fougerite.Server.GetServer().BanPlayerIPandID(target.IP, target.SteamID, target.Name, "You have been banned [AdminPlus]", user.Name); } } break; case "Kick": if (split.Length == 3) { //Kick - Target HWID target = FindPlayerByHWID(split[1]); if (target != null && target.IsOnline) { Logger.LogWarning(user.Name + " has kicked " + target.Name); target.Notice("You were kicked by " + user.Name); target.Disconnect(false); } } break; case "Rename": if (split.Length == 4) { //Rename - NewName - Target HWID target = FindPlayerByHWID(split[2]); if (target != null && target.IsOnline && target.IsAlive) { target.Name = Base64ToString(split[1]); target.InventoryNotice("Name changed!"); if (user.HardwareID != split[2]) { target.Notice(user.Name + " has changed your name to: " + split[1]); } } } break; case "GodMode": if (split.Length == 2) { target = SenderPlayer; if (rpp.HasGod(target.UID)) { rpp.RemoveGod(target.UID); target.InventoryNotice("Disabled"); } else { rpp.AddGod(target.UID); target.InventoryNotice("Enabled"); } } break; case "AdminDestroy": if (split.Length == 2) { target = SenderPlayer; if (target != null) { string steamid = target.SteamID; if (DestroyMode.Contains(steamid)) { DestroyMode.Remove(steamid); target.InventoryNotice("Disabled"); } else { DestroyMode.Add(steamid); target.InventoryNotice("Enabled"); } } } break; case "TeleportTo": if (split.Length == 3) { //TeleportTo - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null) { if (target.IsOnline) { if (target.IsAlive) { target.Notice("", user.Name + " has teleported to you!", 10); user.Player.SafeTeleportTo(target.Location, true); user.Player.Notice("✔", "You have teleported to " + target.Name, 10); } else { user.Player.Notice("✘", target.Name + " is currently not alive!"); } } else { user.Player.Notice("✘", target.Name + " is not online!"); } } else { user.Player.Notice("✘", "Could not find that player!"); } } break; case "TeleportToMe": if (split.Length == 3) { //TeleportToMe - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null) { if (target.IsOnline) { if (target.IsAlive) { LastUserLocation[split[1]] = target.Location; target.SafeTeleportTo(user.Player.Location, true); target.Notice("", user.Name + " has teleported you to them!", 10); } else { user.Player.Notice("✘", target.Name + " is currently not alive!"); } } else { user.Player.Notice("✘", target.Name + " is not online!"); } } else { user.Player.Notice("✘", "Could not find that player!"); } } break;; case "SilentTeleport": if (split.Length == 3) { //Silent - Target HWID if (split[1] == user.HardwareID) { target = SenderPlayer; } else { target = FindPlayerByHWID(split[1]); } if (target != null) { if (target.IsOnline) { if (target.IsAlive) { user.Player.Inventory.RemoveItem(36); user.Player.Inventory.RemoveItem(37); user.Player.Inventory.RemoveItem(38); user.Player.Inventory.RemoveItem(39); user.Player.Inventory.AddItemTo("Invisible Helmet", 36, 1); user.Player.Inventory.AddItemTo("Invisible Vest", 37, 1); user.Player.Inventory.AddItemTo("Invisible Pants", 38, 1); user.Player.Inventory.AddItemTo("Invisible Boots", 39, 1); user.Player.SafeTeleportTo(Util.GetUtil().Infront(target, 10), true); } else { user.Player.Notice("✘", target.Name + " is currently not alive!", 10); } } else { user.Player.Notice("✘", target.Name + " is not online!", 10); } } else { user.Player.Notice("✘", "Could not find that player!", 10); } } break; default: break; } } else { Logger.LogError("AdminPlus: " + user.Name + " just tried to use AdminPlus GUI but isn't an admin or moderator!"); Logger.LogError("AdminPlus: " + user.Name + " has possibly bypassed Admin authorization inside of the Client plugin"); } } } }
/// <summary> /// If we have an incoming RB connection store It, and wait until the player actually spawns on the server. (Loaded.) /// </summary> /// <param name="user"></param> public void OnRustBusterLogin(API.RustBusterUserAPI user) { RBConnectionList[Convert.ToUInt64(user.SteamID)] = user; }