Quick Command Request

Ore

Rune-Server Affiliate
 
 
Aug 23, 2015
430
28
0
Still a bit new to all of this, but I'm looking for the two following commands.

1.) A command where I can check a players current slayer task. :)):slayer Finn)
2.) A command where I can reset a players current task. :)):resetslay Finn)

Thank-you. I know this may be a bit of a stupid request but I am still learning.
 



Code:
if (playerCommand.startsWith("gettask") && (c.playerName.equalsIgnoreCase("Your user"))) {
				try {
					String otherPName = playerCommand.substring(8);
					int otherPIndex = PlayerHandler.getPlayerID(otherPName);

					if (otherPIndex != -1) {
						Client p = (Client) PlayerHandler.players[otherPIndex];

						[B]c.sendMessage("Username: "+p.playerName+" Task: "+p.SlayerTask+" ");[/B]
					} else {
						c.sendMessage("This player either does not exist or is OFFLINE.");
					}
				} catch (Exception e) {
					c.sendMessage("Invalid Command, Try ::gettask USERNAME.");
				}
			}

Code:
if (playerCommand.startsWith("resettask") && (c.playerName.equalsIgnoreCase("Your user"))) {
				try {
					String otherPName = playerCommand.substring(10);
					int otherPIndex = PlayerHandler.getPlayerID(otherPName);

					if (otherPIndex != -1) {
						Client p = (Client) PlayerHandler.players[otherPIndex];

						c.sendMessage("Username: "+p.playerName+" Task: Reset ");
                                               [B] p.SlayerTask = -1;[/B]
					} else {
						c.sendMessage("This player either does not exist or is OFFLINE.");
					}
				} catch (Exception e) {
					c.sendMessage("Invalid Command, Try ::resettask USERNAME.");
				}
			}

Edit the "slayerTask" to your variable
 
Code:
if (playerCommand.startsWith("gettask") && (c.playerName.equalsIgnoreCase("Your user"))) {
				try {
					String otherPName = playerCommand.substring(8);
					int otherPIndex = PlayerHandler.getPlayerID(otherPName);

					if (otherPIndex != -1) {
						Client p = (Client) PlayerHandler.players[otherPIndex];

						c.sendMessage("Username: "+p.playerName+" Task: "+p.SlayerTask+" ");
					} else {
						c.sendMessage("This player either does not exist or is OFFLINE.");
					}
				} catch (Exception e) {
					c.sendMessage("Invalid Command, Try ::gettask USERNAME.");
				}
			}

Edit the "slayerTask" to your variable

Thanks, just need a reset one now.
 

Users who are viewing this thread (total: 1, members: 0, guests: 1)

Who read this thread (total members: 1)