Originally Posted by
xsaeedx
Hi guys i need a little help,
well basically i want to add a command like :
etbounty (playername) (amount of credits) so for example: :
etbounty test 100, so now 100 credits will be removed from your account and whoever kills the player "test" will receive the 100 credits.
Anyone? Help appreciated alot, REP+
THIS IS JUST AN EXAMPLE. THIS CODE WILL NOT WORK FOR YOU
The following code is to use a a guide to implement into your server. It isn't really coded that well, and will not work how it stands, but I'm sure you can figure out how to make it work for you.
Code:
if (playerCommand.startsWith("setbounty")){
String[] args = playerCommand.split(" ");
String bountyOn = args[1];
for (Player p2 : PlayerHandler.players){
if (p2 != null) {
if(p2.playerName.equalsIgnoreCase(bountyOn)) {
try{
int bountyCost = Integer.parseInt(args[2]);
p2.hasBounty = true;
p2.bountyAmnt = bountyCost;
p2.getPlayerAssistant().sendMessage("" + bountyOn " has had a bounty set on them.");
p2.getPlayerAssistant().sendMessage("You've set a bounty on " + bountyOn + ".");
}catch(Exception e){
e.printStackTrace();
}
}
}
}
}