void cmdRot(BasePlayer player, string command, string[] args) { if (!player.IsAdmin) { return; } if (args.Length == 0) { SendReply(player, msg("/rot add - Adds a rotator to the sign you are looking at", player.UserIDString)); SendReply(player, msg("/rot remove - Removes a rotator from the sign you are looking at", player.UserIDString)); SendReply(player, msg("/rot remove all - Removes all rotators and wipes data", player.UserIDString)); SendReply(player, msg("/rot start - Starts the rotation of the sign you are looking at", player.UserIDString)); SendReply(player, msg("/rot stop - Stops the rotation of the sign you are looking at", player.UserIDString)); return; } switch (args[0].ToLower()) { case "add": { var entity = FindEntityFromRay(player); if (entity != null) { Signage sign = entity as Signage; if (!storedData.data.Contains(sign.net.ID)) { storedData.data.Add(sign.net.ID); var rotator = sign.gameObject.AddComponent <Rotator>(); rotator.enabled = true; billBoards.Add(rotator); rotator.ToggleRotation(); SaveData(); SendReply(player, msg("You have successfully created a rotating billboard")); } else { SendReply(player, msg("This sign already has a rotator attached to it")); } } else { SendReply(player, msg("Unable to find a valid sign")); } } return; case "remove": if (args.Length == 2 && args[1].ToLower() == "all") { foreach (var rotator in billBoards) { UnityEngine.Object.Destroy(rotator); } billBoards.Clear(); storedData.data.Clear(); SaveData(); SendReply(player, msg("Removed all rotating billboards")); } else { var entity = FindEntityFromRay(player); if (entity != null) { BaseEntity sign = (entity as BaseEntity); if (sign.GetComponent <Rotator>()) { billBoards.Remove(sign.GetComponent <Rotator>()); UnityEngine.Object.Destroy(sign.GetComponent <Rotator>()); if (storedData.data.Contains(sign.net.ID)) { storedData.data.Remove(sign.net.ID); } SaveData(); SendReply(player, msg("You have successfully removed this rotating billboard")); } else { SendReply(player, msg("This sign does not have a rotator attached to it")); } } else { SendReply(player, msg("Unable to find a valid sign")); } } return; case "start": { var entity = FindEntityFromRay(player); if (entity != null) { Rotator sign = (entity as BaseEntity).GetComponent <Rotator>(); if (sign != null) { if (sign.IsRotating()) { SendReply(player, msg("This sign is already rotating")); } else { sign.ToggleRotation(); SendReply(player, msg("Rotation started")); } return; } else { SendReply(player, msg("This sign does not have a rotator attached to it")); } } else { SendReply(player, msg("Unable to find a valid sign")); } } return; case "stop": { var entity = FindEntityFromRay(player); if (entity != null) { Rotator sign = (entity as BaseEntity).GetComponent <Rotator>(); if (sign != null) { if (!sign.IsRotating()) { SendReply(player, msg("This sign is already stopped")); } else { sign.ToggleRotation(); SendReply(player, msg("Rotation stopped")); } return; } else { SendReply(player, msg("This sign does not have a rotator attached to it")); } } else { SendReply(player, msg("Unable to find a valid sign")); } } return; default: break; } }