I'm making this a snippet because I really don't feel the need to explain how things work besides the JOptionPane and thats it. There is also a little anti-leech so if you don't have common sense please leave (Anti-Leech is in Step4)
TIP: You can change the text of the buttons so you don't need to have all the same commands I do in this.
TIP: If you do not move after logging in and you have not clicked the button to open the interface yet the JOptionPane, it will usually appear behind the client, so if you don't see it after clicking dont freak out and just look behind the client.
TIP: You wont have the new scroll bar because thats custom added thanks to the help of
[Only registered and activated users can see links. Click Here To Register...]
Base: Project Insanity
Difficulty: 3.5/10 - need a brain -.-
Credits:
93% Myself
5% Sanity - ideas
1% I'm a Jerk (help on idea when working with Zepsity)
1% Jagex for the sprites
How JOptionPane works: It opens a interface :),
[Only registered and activated users can see links. Click Here To Register...]
Step 1, Download the sprites
[Only registered and activated users can see links. Click Here To Register...];Extract the folder into your sprites folder (Client side you derps)
Step 2, RSInterface.java, client sided.
Code:
staffControls(rsFonts);
and
Code:
public static void staffControls(RSFont[] TDA) {
RSInterface tab = addTabInterface(37000);
RSInterface scroll = addTabInterface(37002, 2);
addSprite(37001, 0, "staffControl/backdrop");
//information box and title
addText(37080, "Enter Title", 0xFF981F, false, true, 52, TDA, 2); //Title
addText(37081, "Information, enter here", 0xFF981F, false, true, 52, TDA, 2); //Information
addText(37082, "Information, enter here", 0xFF981F, false, true, 52, TDA, 2); //Information
addText(37083, "Information, enter here", 0xFF981F, false, true, 52, TDA, 2); //Information
tab.totalChildren(6);
//Interface
tab.child(0, 37001, 0, 0);
tab.child(1, 37002, -147, 80);
tab.child(2, 37080, 23, 20);
tab.child(3, 37081, 243, 157);
tab.child(4, 37082, 243, 187);
tab.child(5, 37083, 243, 217);
//information box and title start
//information box and title end
scroll.width = 312;//312
scroll.height = 248;//248
scroll.scrollMax = 785;//735
//buttons themself, in order
addButton(37011, 0, "staffControl/mod", 116, 26, "Lock Account", 1);
addButton(37012, 0, "staffControl/mod", 116, 26, "Kick Player", 1);
addButton(37013, 0, "staffControl/mod", 116, 26, "Mute Player", 1);
addButton(37014, 0, "staffControl/mod", 116, 26, "Jail Player", 1);
addButton(37015, 0, "staffControl/mod", 116, 26, "IpMute Player", 1);
addButton(37016, 0, "staffControl/mod", 116, 26, "Un-Mute Player", 1);
addButton(37017, 0, "staffControl/mod", 116, 26, "Un-Jail Player", 1);
addButton(37018, 0, "staffControl/mod", 116, 26, "Check Bank", 1);
addButton(37019, 0, "staffControl/mod", 116, 26, "Check Inventory", 1);
addButton(37020, 0, "staffControl/admin", 116, 26, "Announcement", 1);
addButton(37021, 0, "staffControl/admin", 116, 26, "Ban Player", 1);
addButton(37022, 0, "staffControl/admin", 116, 26, "Ip-Ban Player", 1);
addButton(37023, 0, "staffControl/admin", 116, 26, "Teleport to", 1);
addButton(37024, 0, "staffControl/admin", 116, 26, "Teleport to me", 1);
addButton(37025, 0, "staffControl/admin", 116, 26, "Un-Ban Player", 1);
addButton(37026, 0, "staffControl/admin", 116, 26, "Un-IpBan Player", 1);
addButton(37027, 0, "staffControl/admin", 116, 26, "Un-IpMute Player", 1);
addButton(37028, 0, "staffControl/admin", 116, 26, "Coming Soon!", 1);
addButton(37029, 0, "staffControl/admin", 116, 26, "Coming Soon!", 1);
addButton(37030, 0, "staffControl/admin", 116, 26, "Coming Soon!", 1);
//buttons text, in order
addText(37050, "Lock", 0xFF981F, false, true, 52, TDA, 2);
addText(37051, "Kick", 0xFF981F, false, true, 52, TDA, 2);
addText(37052, "Mute", 0xFF981F, false, true, 52, TDA, 2);
addText(37053, "Jail", 0xFF981F, false, true, 52, TDA, 2);
addText(37054, "Ip-Mute", 0xFF981F, false, true, 52, TDA, 2);
addText(37055, "Un-Mute", 0xFF981F, false, true, 52, TDA, 2);
addText(37056, "Un-Jail", 0xFF981F, false, true, 52, TDA, 2);
addText(37057, "Check Bank", 0xFF981F, false, true, 52, TDA, 2);
addText(37058, "Check Inv", 0xFF981F, false, true, 52, TDA, 2);
addText(37059, "Announce", 0xFF981F, false, true, 52, TDA, 2);
addText(37060, "Ban", 0xFF981F, false, true, 52, TDA, 2);
addText(37061, "Ip-Ban", 0xFF981F, false, true, 52, TDA, 2);
addText(37062, "Teleport To", 0xFF981F, false, true, 52, TDA, 2);
addText(37063, "Tele To Me", 0xFF981F, false, true, 52, TDA, 2);
addText(37064, "Un-Ban", 0xFF981F, false, true, 52, TDA, 2);
addText(37065, "Un-IpBan", 0xFF981F, false, true, 52, TDA, 2);
addText(37066, "Un-IpMute", 0xFF981F, false, true, 52, TDA, 2);
scroll.totalChildren(37);
//buttons and text start
scroll.child(0, 37011, 177, 8);
scroll.child(1, 37012, 177, 47);
scroll.child(2, 37013, 177, 85);
scroll.child(3, 37014, 177, 123);
scroll.child(4, 37015, 177, 161);
scroll.child(5, 37016, 177, 199);
scroll.child(6, 37017, 177, 237);
scroll.child(7, 37018, 177, 275);
scroll.child(8, 37019, 177, 313);
scroll.child(9, 37020, 177, 351);
scroll.child(10, 37021, 177, 389);
scroll.child(11, 37022, 177, 427);
scroll.child(12, 37023, 177, 465);
scroll.child(13, 37024, 177, 503);
scroll.child(14, 37025, 177, 541);
scroll.child(15, 37026, 177, 579);
scroll.child(16, 37027, 177, 617);
scroll.child(17, 37028, 177, 655);
scroll.child(18, 37029, 177, 693);
scroll.child(19, 37030, 177, 731);
scroll.child(20, 37050, 203, 15);
scroll.child(21, 37051, 203, 54);
scroll.child(22, 37052, 203, 92);
scroll.child(23, 37053, 203, 130);
scroll.child(24, 37054, 203, 168);
scroll.child(25, 37055, 203, 207);
scroll.child(26, 37056, 203, 245);
scroll.child(27, 37057, 203, 282);
scroll.child(28, 37058, 203, 321);
scroll.child(29, 37059, 203, 359);
scroll.child(30, 37060, 203, 397);
scroll.child(31, 37061, 203, 435);
scroll.child(32, 37062, 203, 473);
scroll.child(33, 37063, 203, 511);
scroll.child(34, 37064, 203, 550);
scroll.child(35, 37065, 203, 588);
scroll.child(36, 37066, 203, 625);
//buttons and text end
}
Step 3, Open up your source folder to "\Source\src\server\model\players"
Step 4, Create a new .java file called CommandControl.java and put this in it
Anti-Leech: I'm only giving you one command, get your lazy butt to work and do the rest, 1 reason is because your commands could be different than mine etc...
Code:
package server.model.players;
import java.util.Arrays;
import server.core.config.*;
import server.Server;
import server.model.players.packets.Commands;
import server.model.players.*;
import server.util.Misc;
import server.net.Connection;
import javax.swing.*;
/**
* Made By: Artesia/Nathan
* 5/14/2012
**/
public class CommandControl {
public CommandControl(Client c) {
this.c = c;
}
private Client c;
public long clickDelay = 0;
public boolean clickButtons(int id) {
if(System.currentTimeMillis() - clickDelay < 1000) {
return false;
}
clickDelay = System.currentTimeMillis();
//This is a warning/information message letting you know that you have opened the interface
if (id == #####)
{
JOptionPane.showMessageDialog(null,
"You have opened up the staff control panel.\n " + "Clicking a commmand will open up a dialouge\n " + "box for you to enter the name of a victom",
"Control Information", JOptionPane.INFORMATION_MESSAGE);
c.getPA().showInterface(37000);
}
//Command start
if (id == 144148)
{
c.getPA().closeAllWindows();
if(c.playerRights > 0)
{
String kick = " ";
kick = JOptionPane.showInputDialog(null, "Enter the name of the player \n" + "that you wish to kick.", "Kick Player", JOptionPane.WARNING_MESSAGE);
try {
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(kick)) {
Server.playerHandler.players[i].disconnected = true;
}
}
}
} catch(Exception e) {
c.sendMessage("Incorrect name or invalid player.");
}
}
return true;
}
}
Step 5, In client.java add this
Code:
public CommandControl commandControl = new CommandControl(this);
Step 6, In clickingbuttons.java add this
Code:
if(c.commandControl.clickButtons(actionButtonId))
return;
Step 7, Congratulations you have just added this interface:
[Only registered and activated users can see links. Click Here To Register...]
Step 8, Get your lazy-ness to work and attempt to create the other commands
Step 9, Enjoy and if your feeling sexy drop a thanks and maybe ill help you with some commands if your a newb ;)