Hey Ragezone community. I'm trying to code a command for players to transfer event points in between eachother. I want the command to be @giveep <ign> <amt>.
Here's my code so far:
I'm aware that it doesn't work. I'm kind of new to coding. But I what I am trying to do is make it check if the player has more or equal to the amount the player is trying to give away. If they do, the player would lose the amount they typed and the other player (victim) would gain the amount. The dropMessage's are pretty self explanatory.Code:} else if (splitted[0].equalsIgnoreCase("giveep")) { if (player.getEventPoints > 0 && amount <= player.getEventPoints()) { MapleCharacter victim = c.getChannelServer().getPlayerStorage().getCharacterByName(splitted[1]); victim.gainEventPoints(Integer.parseInt(splitted[2])); player.gainEventPoints(-Integer.parseInt(splitted[2])); player.dropMessage("You have given " + splitted[1] + " " + splitted[2] + " Event Points."); victim.dropMessage(6, player.getName() + " has given you " + splitted[2] + " Event Points."); } else { player.dropMessage("Make sure you have enough Event Points to give away."); }
In game, the command says "Make sure you have enough Event Points to give away." even though I do have way more than enough to give away. I believe it is skipping the checking process, probably because I coded it wrong. Any help? Thanks guys.
/ Just incase you guys need my methods to help me out
Code:public int getEventPoints() { return eventpoints; } public void gainEventPoints(int eventpoints) { this.eventpoints += eventpoints; } private int eventpoints;



Reply With Quote


