Purpose: ^ Title
Difficulty:
Assumed Knowledge: Knowing what a console is and fundamentals
Client Base: N/A
Classes Modified: client
Procedure
Step 1: Create a new class and paste this in it:
Code:
import java.util.*;
import java.io.*;
import java.net.*;
/** @(#) ConsoleCmd.java
* @author ZeroFreeze
* www.moparscape.org/smf
*/
public class ConsoleCmd {
private String author = "ZeroFreeze"; // Author - Do NOT edit
private String c = "Console Command v" + getVersion() + "by " + author; // Startup message
private String e = "Error!"; // Error message
private List allCmds = new ArrayList(); // ArrayList containing all commands
private String exitCmd = "!stop"; // Exit/Stop command
/**
* Gets the version of the ConsoleCmd class
* @return
*/
private int getVersion() {
String line = "";
boolean EndOfFile = false;
BufferedReader file = null;
try {
URL url = new URL("http://zeroxsoft.com/consoleversion.txt");
file = new BufferedReader(new BufferedReader(new InputStreamReader(url.openStream())));
line = file.readLine();
} catch(IOException ioe){
print(ioe.printStackTrace());
return 0;
} catch(Exception e0){
print(e0.printStackTrace());
return 0;
}
while (!EndOfFile && line != null){
line = line.trim();
try {
return Integer.parseInt(line);
} catch(IOException ioexception1){
EndOfFile = true;
}
}
try {
file.close();
} catch(IOException ioexception){
return 0;
}
return 0;
}
/**
* Processes the command
* @param cmd The command to proccess
*/
private void processCmd(String cmd) {
if (cmd.equalsIgnoreCase("noclip")) client.noClip();
else return;
}
/**
* Prints text in console
*/
private void print(String txt) {
System.out.println(txt);
}
public ConsoleCmd() {
allCmds.add("noclip");
Scanner s = new Scanner(System.in);
print((author.toLowerCase()).startsWith("zero") ? c : e);
for (int i = 0; i < allCmds.size(); i++) {
print("Current commands available:");
print(allCmds.get(i));
}
print("Enter a command: ");
while(!(s.nextLine()).equalsIgnoreCase(exitCmd)) {
processCmd(s.nextLine());
}
}
}
Step 2: Declare this in the client class:
Code:
public static void noClip() {
for(int k1 = 0; k1 < 4; k1++) {
for(int i2 = 1; i2 < 103; i2++) {
for(int k2 = 1; k2 < 103; k2++)
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
}
}
}
Step 3: Declare this in the main method of class client:
Code:
ConsoleCmd ccmd = new ConsoleCmd();
Credits: ZeroFreeze (Me)
A special thanks to Javac for posting that he did something like this, which got me to make this cause I'm bored at the moment =p
Oh & not tested.. I was doing maths while I was coding this (I was bored), so don't complain if there's a bug or something - Try to fix it yourself