Moo Chor (พี่หมู จ่อย เองครับ) :
using UnityEngine;
using System.Collections.Generic;
namespace Oxide.Plugins
{
[Info("CraneHouseLifter", "Admin", "1.0.0")]
public class CraneHouseLifter : RustPlugin
{
[ChatCommand("lifthouse")]
private void CmdLiftHouse(BasePlayer player, string command, string[] args)
{
if (!player.IsAdmin) return;
MagnetCrane crane = player.GetMountedVehicle() as MagnetCrane;
if (crane == null)
{
SendReply(player, "Error: You must be driving a Magnet Crane.");
return;
}
RaycastHit hit;
if (Physics.Raycast(crane.magnet.transform.position, Vector3.down, out hit, 15f, LayerMask.GetMask("Construction", "Deployable")))
{
BuildingBlock block = hit.GetEntity() as BuildingBlock;
if (block != null)
{
BuildingManager.Building building = block.GetBuilding();
if (building != null)
{
foreach (DecayEntity entity in building.decayEntities)
{
entity.SetParent(crane.magnet, true, false);
entity.SendNetworkUpdateImmediate();
}
SendReply(player, "Success: Building structure attached to the magnet.");
}
}
else
{
SendReply(player, "Error: No valid building structure found directly below the magnet.");
}
}
}
[ChatCommand("drophouse")]
private void CmdDropHouse(BasePlayer player, string command, string[] args)
{
if (!player.IsAdmin) return;
MagnetCrane crane = player.GetMountedVehicle() as MagnetCrane;
if (crane == null) return;
List attachedEntities = new List();
for (int i = 0; i < crane.magnet.children.Count; i++)
{
attachedEntities.Add(crane.magnet.children[i]);
}
foreach (BaseEn
2026-10-25 20:19:30