Thread: Lottery Ticket/Gambler System/Java

Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1 Lottery Ticket/Gambler System/Java 
    Professional Java Developer

    Rainex's Avatar
    Join Date
    Jan 2010
    Age
    25
    Posts
    668
    Thanks given
    102
    Thanks received
    32
    Rep Power
    77
    Hey guys. Sorry for the title, but I really didn't know what to name it lol.
    You've probably seen that Eudora-World that was posted? First of all, I want to say that H 4 Z B R O and I coded most of that client (it was coded from a clean PI client). Also, there is a "gambler" at the home. Well it doesn't work ( no suprize ). Well I made some stuff to add to that. As you know, I'm mostly a java programmer, not a rsps coder so I know most about java, and I will be mastering it soon. Well I made a Random Number Generator which you can use with the gambler so that it will pick a number, and if you guess that, than you will get your prize. Here is part of what you would have to add:

    Quote Originally Posted by // Random Number Generator
    import java.util.Random;

    class commands{
    public static void main(String[
    args) {
    Random dice = new Random();
    int number;

    for(int counter=1; counter<=10;counter++){
    number = 1+dice.nextInt(6);
    System.out.println(number + " ");
    }
    }
    }
    I will be adding more if people want me to perfect it, and make it so you can add it fully to your server. So comment below if you want me to finish and perfect it, so that it could be a command.
    Thanks, -TheNewCoder A.k.A Steven
    Reply With Quote  
     

  2. Thankful user:


  3. #2  
    Registered Member
    Sanity's Avatar
    Join Date
    Dec 2008
    Posts
    2,062
    Thanks given
    22
    Thanks received
    362
    Rep Power
    762
    I'm sorry, but how is this even a snippet? Most servers have a Random object already added into one of their utility classes anyways.
    Reply With Quote  
     

  4. #3  
    Professional Java Developer

    Rainex's Avatar
    Join Date
    Jan 2010
    Age
    25
    Posts
    668
    Thanks given
    102
    Thanks received
    32
    Rep Power
    77
    Oh, sorry about that. I never saw that in a server before. Sorry.
    Nobody uses it, so I wanted to promote it I guess.
    Reply With Quote  
     

  5. #4  
    Super Donator

    Benji's Avatar
    Join Date
    Feb 2010
    Age
    26
    Posts
    1,526
    Thanks given
    920
    Thanks received
    501
    Discord
    View profile
    Rep Power
    555
    Lol nice effort, but I think its pretty obvious how to create an instance of util.Random and generate a random number.

    And like what was said before, what's wrong with

    Code:
    if (misc.Random(3) = 3){

    Reply With Quote  
     

  6. #5  
    Professional Java Developer

    Rainex's Avatar
    Join Date
    Jan 2010
    Age
    25
    Posts
    668
    Thanks given
    102
    Thanks received
    32
    Rep Power
    77
    You say 75%, when about 10% do. Trust me, they don't know how.
    Reply With Quote  
     

  7. #6  
    Registered Member

    Join Date
    Oct 2008
    Posts
    1,540
    Thanks given
    27
    Thanks received
    71
    Rep Power
    465
    Just because you don't know how doesn't mean 10% or so don't, the only people who don't are the extremely new beginners.
    Reply With Quote  
     

  8. #7  
    Professional Java Developer

    Rainex's Avatar
    Join Date
    Jan 2010
    Age
    25
    Posts
    668
    Thanks given
    102
    Thanks received
    32
    Rep Power
    77
    Well alot, and I mean ALOT of the people on Rune-Server claim that they are good coders, but they only talk, or they leech. They never release anything besides reposts shit.
    Reply With Quote  
     

  9. #8  
    Registered Member

    Join Date
    Oct 2008
    Posts
    1,540
    Thanks given
    27
    Thanks received
    71
    Rep Power
    465
    Quote Originally Posted by TheNewCoder View Post
    Well alot, and I mean ALOT of the people on Rune-Server claim that they are good coders, but they only talk, or they leech. They never release anything besides reposts shit.
    That's exactly what you're doing lol..
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Member

    Join Date
    May 2008
    Posts
    1,288
    Thanks given
    50
    Thanks received
    92
    Rep Power
    0
    "Java - Random number" would've been a suitable title.

    If you actually wanted to make a gambling system with a command, this would do:
    Code:
    if(command.equals("gamble")){
        int[][] possibleRewards = {
            {4151, 995}, // Item ids
            {1, 200000}    // Item amounts
        };
        if(!hasPlayerItem(995, 100000)){
            sendMessage("You need 100,000 gold pieces to gamble.");
            return;
        }
        deleteItem(995, 100000);
        if((Math.random() * 10) == 1){
            int idx = (Math.random() * possibleRewards[0].length);
            addItem(possibleRewards[0][idx], possibleRewards[1][idx]);
            sendMessage("Congratulations you got an item from the gamble.");
        } else {
            sendMessage("Sorry you didn't get anything from this gamble!");
        }
    }
    Reply With Quote  
     

  12. #10  
    Professional Java Developer

    Rainex's Avatar
    Join Date
    Jan 2010
    Age
    25
    Posts
    668
    Thanks given
    102
    Thanks received
    32
    Rep Power
    77
    Quote Originally Posted by Clifton View Post
    "Java - Random number" would've been a suitable title.

    If you actually wanted to make a gambling system with a command, this would do:
    Code:
    if(command.equals("gamble")){
        int[][] possibleRewards = {
            {4151, 995}, // Item ids
            {1, 200000}    // Item amounts
        };
        if(!hasPlayerItem(995, 100000)){
            sendMessage("You need 100,000 gold pieces to gamble.");
            return;
        }
        deleteItem(995, 100000);
        if((Math.random() * 10) == 1){
            int idx = (Math.random() * possibleRewards[0].length);
            addItem(possibleRewards[0][idx], possibleRewards[1][idx]);
            sendMessage("Congratulations you got an item from the gamble.");
        } else {
            sendMessage("Sorry you didn't get anything from this gamble!");
        }
    }
    Nice try, but it doesn't make sense
    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. Please delete. Put in Wrong Section
    By Rainex in forum Downloads
    Replies: 5
    Last Post: 09-26-2010, 04:43 AM
  2. [508] Support Ticket System
    By zeroeh in forum Tutorials
    Replies: 24
    Last Post: 04-03-2010, 05:04 AM
  3. My Donator ticket System
    By Neekage in forum Show-off
    Replies: 15
    Last Post: 01-01-2010, 01:21 AM
  4. [PROJECT] Lottery Ticket Generator! (Should i release source?)
    By ryannathans in forum Application Development
    Replies: 9
    Last Post: 06-12-2009, 01:32 AM
  5. Adding a simple lottery system
    By Guitars595 in forum Tutorials
    Replies: 3
    Last Post: 09-27-2008, 08:15 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •