Implemented kill command. UNTESTED, TEST THIS WHEN YOU CAN

This commit is contained in:
Daniel Xie
2016-12-06 12:09:23 -06:00
parent 8c58710495
commit 7a5a9ccb65
2 changed files with 24 additions and 1 deletions
+13 -1
View File
@@ -270,7 +270,19 @@ var Terminal = {
post(Player.getCurrentServer().ip);
break;
case "kill":
//TODO
if (commandArray.length != 2) {
post("Incorrect usage of kill command. Usage: kill [scriptname]"); return;
}
var scriptName = commandArray[1];
for (var i = 0; i < Player.getCurrentServer().runningScripts.length; i++) {
if (Player.getCurrentServer().runningScripts[i] == scriptName) {
Player.getCurrentServer().runningScripts.splice(i, 1);
killWorkerScript(scriptName, Player.getCurrentServer().ip);
}
}
post("No such script is running. Nothing to kill");
break;
case "ls":
if (commandArray.length != 1) {