ClientLock plugin

Posted by Cage_fire_2000 on Fri 25 May 2007 05:11 AM — 1 posts, 9,570 views.

USA #0
OK, I saw this in the suggestion section, and also my friend expressed an interest in this back when he had problems with his brother getting on his character and doing nasty things with it when he stepped out of the room.

In response to this, and since I needed something to do, I have created this plugin, that will allow you to lock your command window when you step away from the computer.

If I update this in the future, you should be able to find the latest version at:
http://www.geocities.com/cage_fire_2000/ClientLock.xml

Let me know if you find any bugs, I haven't tested it all that thoroughly. It all seems to work right. Also, I didn't know what version to put under requires, but I figured 3.70 would be a safe bet.

but here it is:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Thursday, May 24, 2007, 11:06 PM -->
<!-- MuClient version 4.01 -->

<!-- Plugin "ClientLock" generated by Plugin Wizard -->

<muclient>
<plugin
   name="ClientLock"
   author="Malix@8bit"
   id="78c224f899e7f4d174f017b6"
   language="JScript"
   purpose="Lets you lock the command window while you're AFK"
   date_written="2007-05-24 23:05:12"
   requires="3.70"
   version="1.0"
   >
<description trim="y">
<![CDATA[
This plugin will lock the command window, so you can step away from the computer without worrying about somebody messing with your character. If this plugin is removed while the client is locked it'll disconnect the world.

**** Commands ****
clientlock <password>
clientlock

  The first form of this command locks the command window with the given <password>. The second form will relock the client with the same password you used before. The password is not saved between sessions so you must enter one each time you reopen the world file. This command is not output, logged, or saved to command history to protect your password.

clientunlock <password>

  This will unlock the command window if <password> matched the password you specified in clientlock.

]]>
</description>

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="ClientLock"
   match="^clientlock(?: (.+))?$"
   enabled="y"
   omit_from_command_history="y"
   omit_from_log="y"
   regexp="y"
   omit_from_output="y"
   sequence="1"
  >
  </alias>
  <alias
   script="ClientUnlock"
   match="clientunlock *"
   enabled="y"
   omit_from_command_history="y"
   omit_from_log="y"
   omit_from_output="y"
   sequence="1"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
var bClientLocked = false;
var sClientPass = "";

function OnPluginClose() {
	if (bClientLocked && world.IsConnected()) {
		world.note("Attempt to uninstall plugin while locked. Closing connection.");
		world.Disconnect();
	}
}

function OnPluginCommand(sText) {
	if (bClientLocked) {
		if (sText.length >= 12 && sText.slice(0,12) == "clientunlock") {
			return true;
		}
		else {
			world.note("Client is locked. Enter \"clientunlock <password>\" to unlock.");
			return false;
		}
	}
	else {
		return true;
	}
}


function ClientUnlock(thename, theoutput, wildcardsVB) {
	var wildcards = VBArray(wildcardsVB).toArray();
	if (bClientLocked) {
		if (wildcards[0] == sClientPass) {
			world.note("Client unlocked.");
			bClientLocked = false;
		}
		else {
			world.note("Incorrect password.");
		}
	}
	else {
		world.note("The client is not currently locked.");
	}
}

function ClientLock(thename, theoutput, wildcardsVB) {
	var wildcards = VBArray(wildcardsVB).toArray();
	if (bClientLocked) {
		world.note("Client is already locked.");
	}
	else {
		if (wildcards[0] == "") {
			if (sClientPass == "") {
				world.note("Initial password has not been set.");
			}
			else {
				bClientLocked = true;
				world.note("Client locked.");
			}
		}
		else {
			sClientPass = wildcards[0];
			bClientLocked = true;
			world.note("Client locked.");
		}
	}
}

]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="ClientLock:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
function OnHelp (sName, sLine, wildcards)
  {
  world.Note (world.GetPluginInfo (world.GetPluginID, 3));
  }
]]>
</script> 

</muclient>
[/code]
Amended on Fri 25 May 2007 05:12 AM by Nick Gammon