Thread: pi fun coinflip command

Page 1 of 3 123 LastLast
Results 1 to 10 of 27
  1. #1 pi fun coinflip command 
    Owner of Ghreborn new and old.


    Join Date
    Nov 2009
    Posts
    916
    Thanks given
    47
    Thanks received
    155
    Rep Power
    273
    i was bored so i made an coinflip command for an money skin so people who has cash can make or lose some
    Code:
    		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");
    			}
    		}
    i know its 30-70
    Im back and working on reborn,
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Officially Retired


    Join Date
    Oct 2007
    Age
    30
    Posts
    5,454
    Thanks given
    558
    Thanks received
    122
    Rep Power
    1364
    Thank for contributed. It give some new people to use this command
    Reply With Quote  
     

  4. #3  
    Renown Programmer
    Bartvh's Avatar
    Join Date
    May 2017
    Posts
    370
    Thanks given
    89
    Thanks received
    208
    Rep Power
    497
    Every beginner programmer can make this in 5 minutes lol.
    Reply With Quote  
     

  5. Thankful users:


  6. #4  
    Registered Member
    Join Date
    Nov 2017
    Posts
    304
    Thanks given
    36
    Thanks received
    75
    Rep Power
    3
    @Bart, really? You want some cookie?


    @OT, keep improving!
    Reply With Quote  
     

  7. #5  
    Extreme Donator

    Kiana's Avatar
    Join Date
    May 2015
    Posts
    1,050
    Thanks given
    147
    Thanks received
    187
    Rep Power
    223
    Nice one, thanks.
    Reply With Quote  
     

  8. #6  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    • 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.
    Attached image
    Reply With Quote  
     


  9. #7  
    Banned
    Join Date
    Sep 2013
    Posts
    146
    Thanks given
    72
    Thanks received
    25
    Rep Power
    0
    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");
    			}
    		}
    Reply With Quote  
     

  10. #8  
    Registered Member

    Join Date
    Dec 2012
    Posts
    2,999
    Thanks given
    894
    Thanks received
    921
    Rep Power
    2555
    Quote Originally Posted by BobWise View Post
    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");
    			}
    		}
    != null
    Attached image
    Reply With Quote  
     


  11. #9  
    Renown Programmer & Respected Member

    Ryley's Avatar
    Join Date
    Aug 2011
    Posts
    596
    Thanks given
    254
    Thanks received
    521
    Rep Power
    1332
    such coin much fun so flip
    Reply With Quote  
     

  12. Thankful users:


  13. #10  
    Donator

    LionLF's Avatar
    Join Date
    Aug 2017
    Posts
    234
    Thanks given
    76
    Thanks received
    76
    Rep Power
    115
    Have anyone done coinflip with interface on rsps? o_O
    Reply With Quote  
     

Page 1 of 3 123 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 3
    Last Post: 01-20-2011, 03:02 AM
  2. [PI] Add item commands?
    By Tyluur in forum Help
    Replies: 9
    Last Post: 07-17-2010, 11:29 PM
  3. Replies: 6
    Last Post: 07-14-2010, 04:05 AM
  4. [PI] Another small commands error.. REP++
    By Alexander in forum Help
    Replies: 11
    Last Post: 07-10-2010, 01:22 AM
  5. PI lunar hometeleport & command
    By zecerew in forum Help
    Replies: 2
    Last Post: 07-08-2010, 10:32 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •