- Nov 10, 2011
- 101
- 3
- 0
Hey, Im gunna show you how to add a ::staff command and a ::commands command. This is very basic. Lets begin.
Pictures:
^ ^ The red crown would not show up, I just added that In, I have my own owner rank. If you want to know how to add your own rank see my Newcomer Tutorials.
Ok first go into CommandHandler and add this Import:
Then add these two commands:
Then go into GameVars.java and add:
If you want mroe staff Members or commands just do what I did with the commands, Just add a: , "Staff name/Command" after the last one. Thanks for reading!
Pictures:
^ ^ The red crown would not show up, I just added that In, I have my own owner rank. If you want to know how to add your own rank see my Newcomer Tutorials.
Ok first go into CommandHandler and add this Import:
Code:
import org.rscdaemon.server.GameVars;
Then add these two commands:
Code:
if(cmd.equalsIgnoreCase("staff")) {
String staff = "";
int staffCount = 0;
for(String adminNames : GameVars.ADMIN_NAMES) {
String tag = "@whi@(@red@Offline@whi@), ";
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(adminNames));
if((p != null) && (p.loggedIn()))
tag = "@whi@(@gre@Online@whi@), ";
staff += " @whi@#adm#" + adminNames + " " + tag;
staffCount++;
}
for(String modNames : GameVars.MOD_NAMES) {
String tag = "@whi@(@red@Offline@whi@), ";
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(modNames));
if((p != null) && (p.loggedIn()))
tag = "@whi@(@gre@Online@whi@), ";
staff += " @whi@#mod#" + modNames + " " + tag;
staffCount++;
}
for(String playerModNames : GameVars.PLAYER_MOD_NAMES) {
String tag = "@whi@(@red@Offline@whi@), ";
Player p = World.getWorld().getPlayer(DataConversions.usernameToHash(playerModNames));
if((p != null) && (p.loggedIn()))
tag = "@whi@(@gre@Online@whi@), ";
staff += " @whi@#pmd#" + playerModNames + " " + tag;
staffCount++;
}
player.getActionSender().sendAlert("There are currently @or1@" + staffCount + "@whi@ staff members: " + staff, true);
}
if(cmd.equalsIgnoreCase("commands")) {
String command = "";
int commandCount = 0;
for(String commandsNames : GameVars.COMMAND_NAMES) {
command += " @whi@" + commandsNames + ", ";
commandCount++;
}
player.getActionSender().sendAlert("@gre@There are currently " + commandCount + " Commands Available: " + command, true);
}
Then go into GameVars.java and add:
Code:
/**
* Staff Names
*/
public static final String[] ADMIN_NAMES = { "Legend" };
public static final String[] MOD_NAMES = { "Test" };
public static final String[] PLAYER_MOD_NAMES = { "Test 2" };
/**
* Commands
*/
public static final String[] COMMAND_NAMES = { "::home", "::staff", "::commands", "::online", "::onlinelist", ":wipebank", "::skull", "::fatigue"};
If you want mroe staff Members or commands just do what I did with the commands, Just add a: , "Staff name/Command" after the last one. Thanks for reading!