public static void respawn_sleepingbag(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if (!basePlayer || !basePlayer.IsDead()) { return; } uint uInt = args.GetUInt(0); if (uInt == 0) { args.ReplyWith("Missing sleeping bag ID"); } else if (basePlayer.CanRespawn()) { if (SleepingBag.SpawnPlayer(basePlayer, uInt)) { basePlayer.MarkRespawn(); } else { args.ReplyWith("Couldn't spawn in sleeping bag!"); } } else { basePlayer.ConsoleMessage("You can't respawn again so quickly, wait a while"); } }
public static void respawn(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if (!basePlayer) { return; } if (!basePlayer.IsDead() && !basePlayer.IsSpectating()) { if (developer > 0) { UnityEngine.Debug.LogWarning(string.Concat(basePlayer, " wanted to respawn but isn't dead or spectating")); } basePlayer.SendNetworkUpdate(); } else if (basePlayer.CanRespawn()) { basePlayer.MarkRespawn(); basePlayer.Respawn(); } else { basePlayer.ConsoleMessage("You can't respawn again so quickly, wait a while"); } }
public static void giveall(Arg arg) { Item item = null; string text = "SERVER"; if (ArgEx.Player(arg) != null) { text = ArgEx.Player(arg).displayName; } foreach (BasePlayer activePlayer in BasePlayer.activePlayerList) { item = ItemManager.CreateByPartialName(arg.GetString(0), 1, 0uL); if (item == null) { arg.ReplyWith("Invalid Item!"); return; } item.amount = arg.GetInt(1, 1); item.OnVirginSpawn(); if (!activePlayer.inventory.GiveItem(item)) { item.Remove(); arg.ReplyWith("Couldn't give item (inventory full?)"); continue; } activePlayer.Command("note.inv", item.info.itemid, item.amount); Debug.Log(" [ServerVar] giving " + activePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english); } if (item != null) { Chat.Broadcast(text + " gave everyone " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL); } }
public static void cinematic_stop(Arg arg) { if (!arg.IsServerside) { return; } BasePlayer basePlayer = ArgEx.Player(arg); if (!(basePlayer == null)) { string strCommand = string.Empty; if (basePlayer.IsAdmin || basePlayer.IsDeveloper) { strCommand = arg.cmd.FullName + " " + arg.FullString + " " + basePlayer.UserIDString; } else if (Server.cinematic) { strCommand = arg.cmd.FullName + " " + basePlayer.UserIDString; } if (Server.cinematic) { ConsoleNetwork.BroadcastToAllClients(strCommand); } else if (basePlayer.IsAdmin || basePlayer.IsDeveloper) { ConsoleNetwork.SendClientCommand(arg.Connection, strCommand); } } }
public static void fixcars(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if (basePlayer == null) { arg.ReplyWith("Null player."); return; } if (!basePlayer.IsAdmin) { arg.ReplyWith("Must be an admin to use fixcars."); return; } int @int = arg.GetInt(0, 2); @int = Mathf.Clamp(@int, 1, 3); ModularCar[] array = Object.FindObjectsOfType <ModularCar>(); int num = 0; ModularCar[] array2 = array; foreach (ModularCar modularCar in array2) { if (modularCar.isServer && Vector3.Distance(modularCar.transform.position, basePlayer.transform.position) <= 5f && modularCar.AdminFixUp(@int)) { num++; } } arg.ReplyWith($"Fixed up {num} cars."); }
public static void givearm(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if (!basePlayer) { return; } Item item = ItemManager.CreateByItemID(arg.GetInt(0), 1, 0uL); if (item == null) { arg.ReplyWith("Invalid Item!"); return; } item.amount = arg.GetInt(1, 1); item.OnVirginSpawn(); if (!basePlayer.inventory.GiveItem(item, basePlayer.inventory.containerBelt)) { item.Remove(); arg.ReplyWith("Couldn't give item (inventory full?)"); return; } basePlayer.Command("note.inv", item.info.itemid, item.amount); Debug.Log(" [ServerVar] giving " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english); if (basePlayer.IsDeveloper) { basePlayer.ChatMessage("you silently gave yourself " + item.amount + " x " + item.info.displayName.english); } else { Chat.Broadcast(basePlayer.displayName + " gave themselves " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL); } }
public static void equipslot(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic) || basePlayer == null) { return; } BasePlayer basePlayer2 = null; if (arg.HasArgs(2)) { basePlayer2 = ArgEx.GetPlayer(arg, 1); if (basePlayer2 == null) { uint uInt = arg.GetUInt(1); basePlayer2 = BasePlayer.FindByID(uInt); if (basePlayer2 == null) { basePlayer2 = BasePlayer.FindBot(uInt); } } } if (!(basePlayer2 == null)) { int @int = arg.GetInt(0); EquipItemInSlot(basePlayer2, @int); Debug.Log($"Equipped slot {@int} on player {basePlayer2.displayName}"); } }
public static void strafe(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer) { PatrolHelicopterAI heliInstance = PatrolHelicopterAI.heliInstance; RaycastHit hitInfo; if (heliInstance == null) { Debug.Log("no heli instance"); } else if (UnityEngine.Physics.Raycast(basePlayer.eyes.HeadRay(), out hitInfo, 1000f, 1218652417)) { Debug.Log("strafing :" + hitInfo.point); heliInstance.interestZoneOrigin = hitInfo.point; heliInstance.ExitCurrentState(); heliInstance.State_Strafe_Enter(hitInfo.point); } else { Debug.Log("strafe ray missed"); } } }
public static void teleport(Arg args) { if (args.HasArgs(2)) { BasePlayer playerOrSleeperOrBot = ArgEx.GetPlayerOrSleeperOrBot(args, 0); if ((bool)playerOrSleeperOrBot && playerOrSleeperOrBot.IsAlive()) { BasePlayer playerOrSleeperOrBot2 = ArgEx.GetPlayerOrSleeperOrBot(args, 1); if ((bool)playerOrSleeperOrBot2 && playerOrSleeperOrBot2.IsAlive()) { playerOrSleeperOrBot.Teleport(playerOrSleeperOrBot2); } } return; } BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer && basePlayer.IsAlive()) { BasePlayer playerOrSleeperOrBot3 = ArgEx.GetPlayerOrSleeperOrBot(args, 0); if ((bool)playerOrSleeperOrBot3 && playerOrSleeperOrBot3.IsAlive()) { basePlayer.Teleport(playerOrSleeperOrBot3); } } }
public static void deployLoadoutInRange(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((!basePlayer.IsAdmin && !basePlayer.IsDeveloper && !Server.cinematic) || basePlayer == null) { return; } string @string = arg.GetString(0); SavedLoadout so; if (!LoadLoadout(@string, out so)) { arg.ReplyWith("Can't find loadout: " + @string); return; } float @float = arg.GetFloat(1); List <BasePlayer> obj = Facepunch.Pool.GetList <BasePlayer>(); global::Vis.Entities(basePlayer.transform.position, @float, obj, 131072); int num = 0; foreach (BasePlayer item in obj) { if (!(item == basePlayer) && !item.isClient) { so.LoadItemsOnTo(item); num++; } } arg.ReplyWith($"Applied loadout {@string} to {num} players"); Facepunch.Pool.FreeList(ref obj); }
public static void spawnlootfrom(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); string @string = args.GetString(0, string.Empty); int @int = args.GetInt(1, 1); Vector3 vector = args.GetVector3(1, basePlayer ? basePlayer.CenterPoint() : Vector3.zero); if (string.IsNullOrEmpty(@string)) { return; } BaseEntity baseEntity = GameManager.server.CreateEntity(@string, vector); if (baseEntity == null) { return; } baseEntity.Spawn(); basePlayer.ChatMessage("Contents of " + @string + " spawned " + @int + " times"); LootContainer component = baseEntity.GetComponent <LootContainer>(); if (component != null) { for (int i = 0; i < @int * component.maxDefinitionsToSpawn; i++) { component.lootDefinition.SpawnIntoContainer(basePlayer.inventory.containerMain); } } baseEntity.Kill(); }
public static void giveto(Arg arg) { string text = "SERVER"; if (ArgEx.Player(arg) != null) { text = ArgEx.Player(arg).displayName; } BasePlayer basePlayer = BasePlayer.Find(arg.GetString(0)); if (basePlayer == null) { arg.ReplyWith("Couldn't find player!"); return; } Item item = ItemManager.CreateByPartialName(arg.GetString(1), 1, arg.GetULong(3, 0uL)); if (item == null) { arg.ReplyWith("Invalid Item!"); return; } item.amount = arg.GetInt(2, 1); item.OnVirginSpawn(); if (!basePlayer.inventory.GiveItem(item)) { item.Remove(); arg.ReplyWith("Couldn't give item (inventory full?)"); return; } basePlayer.Command("note.inv", item.info.itemid, item.amount); Debug.Log(" [ServerVar] giving " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english); Chat.Broadcast(text + " gave " + basePlayer.displayName + " " + item.amount + " x " + item.info.displayName.english, "SERVER", "#eee", 0uL); }
public static void sleepingusersinrange(Arg arg) { BasePlayer fromPlayer = ArgEx.Player(arg); if (fromPlayer == null) { return; } float range = arg.GetFloat(0); string text = "<slot:userid:\"name\">\n"; int num = 0; List <BasePlayer> obj = Facepunch.Pool.GetList <BasePlayer>(); foreach (BasePlayer sleepingPlayer in BasePlayer.sleepingPlayerList) { obj.Add(sleepingPlayer); } obj.RemoveAll((BasePlayer p) => p.Distance2D(fromPlayer) > range); obj.Sort((BasePlayer player, BasePlayer basePlayer) => (!(player.Distance2D(fromPlayer) < basePlayer.Distance2D(fromPlayer))) ? 1 : (-1)); foreach (BasePlayer item in obj) { text += $"{item.userID}:{item.displayName}:{item.Distance2D(fromPlayer)}m\n"; num++; } Facepunch.Pool.FreeList(ref obj); text += $"{num} sleeping users within {range}m\n"; arg.ReplyWith(text); }
public static void gesture_radius(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if (basePlayer == null || !basePlayer.IsAdmin) { return; } float @float = arg.GetFloat(0); List <string> list = Facepunch.Pool.GetList <string>(); for (int i = 0; i < 5; i++) { if (!string.IsNullOrEmpty(arg.GetString(i + 1))) { list.Add(arg.GetString(i + 1)); } } if (list.Count == 0) { arg.ReplyWith("No gestures provided. eg. player.gesture_radius 10f cabbagepatch raiseroof"); return; } List <BasePlayer> obj = Facepunch.Pool.GetList <BasePlayer>(); global::Vis.Entities(basePlayer.transform.position, @float, obj, 131072); foreach (BasePlayer item in obj) { GestureConfig toPlay = basePlayer.gestureList.StringToGesture(list[Random.Range(0, list.Count)]); item.Server_StartGesture(toPlay); } Facepunch.Pool.FreeList(ref obj); }
public static void teleport2owneditem(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); BasePlayer playerOrSleeper = ArgEx.GetPlayerOrSleeper(arg, 0); ulong result; if (playerOrSleeper != null) { result = playerOrSleeper.userID; } else if (!ulong.TryParse(arg.GetString(0), out result)) { arg.ReplyWith("No player with that id found"); return; } string @string = arg.GetString(1); BaseEntity[] array = BaseEntity.Util.FindTargetsOwnedBy(result, @string); if (array.Length == 0) { arg.ReplyWith("No targets found"); return; } int num = UnityEngine.Random.Range(0, array.Length); arg.ReplyWith($"Teleporting to {array[num].ShortPrefabName} at {array[num].transform.position}"); basePlayer.Teleport(array[num].transform.position); }
public static void sleep(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer && !basePlayer.IsSleeping() && !basePlayer.IsSpectating() && !basePlayer.IsDead()) { basePlayer.StartSleeping(); } }
public static void teleportpos(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer && basePlayer.IsAlive()) { basePlayer.Teleport(args.GetVector3(0, Vector3.zero)); } }
public static void endloot(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer && !basePlayer.IsDead() && !basePlayer.IsSleeping()) { basePlayer.inventory.loot.Clear(); } }
public static void lighttoggle(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer && !basePlayer.IsDead() && !basePlayer.IsSleeping()) { basePlayer.LightToggle(); } }
public static void testpuzzle(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer) { bool isDeveloper = basePlayer.IsDeveloper; } }
public static void unlockall(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer) { basePlayer.blueprints.UnlockAll(); } }
public static void resetbp(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if ((bool)basePlayer) { basePlayer.blueprints.Reset(); } }
public static void teleportany(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer && basePlayer.IsAlive()) { basePlayer.Teleport(args.GetString(0), false); } }
public static void status_sv(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer) { args.ReplyWith(basePlayer.GetDebugStatus()); } }
public static void markhostile(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if (basePlayer != null) { basePlayer.MarkHostileFor(); } }
public static void flushgroup(Arg arg) { BasePlayer basePlayer = ArgEx.Player(arg); if (!(basePlayer == null)) { basePlayer.net.SwitchGroup(BaseNetworkable.LimboNetworkGroup); basePlayer.UpdateNetworkGroup(); } }
public static void breakitem(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer) { Item activeItem = basePlayer.GetActiveItem(); activeItem?.LoseCondition(activeItem.condition); } }
public static void cancel(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if ((bool)basePlayer && !basePlayer.IsDead()) { int @int = args.GetInt(0); basePlayer.inventory.crafting.CancelBlueprint(@int); } }
public static void find_radius(Arg args) { BasePlayer player = ArgEx.Player(args); if (!(player == null)) { uint filter = args.GetUInt(0, 10u); TextTable entityTable = GetEntityTable((EntityInfo info) => Vector3.Distance(info.entity.transform.position, player.transform.position) <= (float)filter); args.ReplyWith(entityTable.ToString()); } }
public static void find_self(Arg args) { BasePlayer basePlayer = ArgEx.Player(args); if (!(basePlayer == null) && basePlayer.net != null) { uint filter = basePlayer.net.ID; TextTable entityTable = GetEntityTable((EntityInfo info) => info.entityID == filter); args.ReplyWith(entityTable.ToString()); } }