1. The title pretty much sums it up.

    The ability to prevent (perhaps the owner or maybe the last person to provide LGF ) a Mining Quarry from working while offline.

    kind regards, C-Block.
     
  2. Code:
      void OnPlayerDisconnected(BasePlayer player)
            {
                var quarries = GameObject.FindObjectsOfType<MiningQuarry>();
                for(int i = 0; i < quarries.Count(); i++)
                {
                    var quarry = quarries[i];
                    if (quarry == null || quarry.OwnerID == 0 || !quarry.IsEngineOn()) continue;
                    if (quarry.OwnerID == player.OwnerID)
                    {
                        quarry.EngineSwitch(false);
                    }
                }        }        void OnQuarryEnabled(MiningQuarry quarry)
            {
                if (quarry.OwnerID == 0) return;
                for(int i = 0; i < BasePlayer.sleepingPlayerList.Count; i++)
                {
                    var player = BasePlayer.sleepingPlayerList[i];
                    if (player.IsConnected()) continue;
                    if (player.userID == quarry.OwnerID)
                    {
                        NextTick(() =>
                        {
                            quarry.EngineSwitch(false);
                        });
                        break;
                    }
                }
            }
    Completely untested code, but this should make it so whenever a player disconnects, it disables all quarries it finds by them, and if someone tries to enable it while the owner is not online, it will switch back off. (unless this code doesn't work somehow, again, untested)

    The code for getting the quarries on disconnect is probably decently slow, but I didn't feel like posting a nearly full plugin using OnEntitySpawned/OnEntityDeath and a list/hashset. If someone else wants to expand on this code, go ahead.
     
  3. Thank you kidnly for the speedy reply - I shall endeavour to try do.... something... with this code. (script kiddy lol)
     
  4. Shouldn't be too hard, and I'm sure someone will probably want to do something more with it with enough time.

    Just take a base template from the docs and paste the code in there, that's about all you have to do. I'd do it for you, but I'd have to submit it as a full plugin, since last I knew they weren't allowed to be posted here in code, and I don't really wanna make a full plugin for it, lol.
     
  5. Thank you kindly. I appreciate what you and all the other developers do for the community.