|
i was bored so i made an coinflip command for an money skin so people who has cash can make or lose some
i know its 30-70Code:if (playerCommand.equalsIgnoreCase("coinflip")){ if(c.getItems().playerHasItem(995, 2500000)) { c.getItems().deleteItem2(995, 2500000); if (Math.random() < 0.30) { c.getItems().addItem(995, 5000000); c.sendMessage("You Win."); } else { c.sendMessage("You Lost."); } }else { c.sendMessage("You need 2.5m to do this command"); } }
Thank for contributed. It give some new people to use this command
Every beginner programmer can make this in 5 minutes lol.
@Bart, really? You want some cookie?
@OT, keep improving!
Nice one, thanks.
- Perfect formatting.
- Magnificent method naming.
- Perfect use of else-if to reduce processing.
- Proper returning of the code to reduce processing.
- Beautiful use of equalsIgnoreCase(), the most efficient way there is to parse commands.
- Fair win chance.
- Superb use of English language and word capitalization.
9/11.
Renamed Version
Code:if (command[0].equalsIgnoreCase("coinflip")){ if (player.getInventory().delete(995, 2500000) != null) { player.getInventory().delete(995, 2500000); if (Math.random() < 0.30) { player.getInventory().add(995, 5000000); player.sendMessage("You Win."); } else { player.sendMessage("You Lost."); } }else { player.sendMessage("You need 2.5m to do this command"); } }
Have anyone done coinflip with interface on rsps? o_O
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |