Jump to content
  • 0
EvoIllusions

Making a Button Command [PI]

Question

Okay I am trying to make a button able to complete a staff command...let us test this with the command 'kick'.
Here is what I have so far:
[code] case 78034:
try {
String playerToBan = playerCommand.substring(5);
for(int i = 0; i < Config.MAX_PLAYERS; i++) {
if(Server.playerHandler.players[i] != null) {
if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
Server.playerHandler.players[i].disconnected = true;
}
}
}
} catch(Exception e) {
c.sendMessage("Player Must Be Offline.");
}
break;
[/code]

Problem with that; it has no way of knowing what player I am talking about and it cannot read 'playerCommand'.
Possible solution(s); making a interface come up in the chatbox where I can type in the player name.

Compiler Error:
[code]src\server\model\players\packets\ClickingButtons.java:469: error: cannot find symbol
String playerToBan = playerCommand.substring(5);
^
symbol: variable playerCommand
location: class ClickingButtons
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Press any key to continue . . .[/code]

Could somebody please help me with this? I don't know where to define playerCommand, and I don't know how to make it to where when I click it I have to type in the players name.

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0
[quote name='EvoIllusions']Love how nobody helps in this community..[/QUOTE]

Not that nobody helps: look by yourself, the website itself is dead.

The only thing to help you is that 'playerCommand' is a string.

Share this post


Link to post
Share on other sites
  • 0
You're trying to read the command in ClickingButtons.java, you're going to need to read it in your Commands class, and do whatever you need to from there.

Share this post


Link to post
Share on other sites

×