Thread: Slotmachine

Results 1 to 8 of 8
  1. #1 Slotmachine 
    Registered Member
    Join Date
    Oct 2010
    Posts
    185
    Thanks given
    10
    Thanks received
    5
    Rep Power
    1
    if (playerCommand.equals("slotmachine") || playerCommand.equals("Slotmachine")){
    int hasitem = 500000;
    int slot = (Misc.random(1000));
    int risked = (hasitem * 100);
    if (!c.getItems().playerHasItem(995, hasitem)) {
    c.sendMessage("You havent got above "+hasitem+" gp in your inventory.");
    return;
    }
    if (slot = 111,222,333,444,555,666,777,888,999) {
    c.sendMessage("You got "+slot+" and lost 500k.");
    c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem);
    } else {
    c.sendMessage("You got "+slot+" and won 100M.");
    c.getItems().addItem(995, risked);
    }
    }
    How to make this command working... Like all is okay
    if (slot = 111,222,333,444,555,666,777,888,999) {

    mistake here.. can anyone fix it.
    Reply With Quote  
     

  2. #2  
    Java Apprentice
    Cutelilbunny's Avatar
    Join Date
    Jan 2011
    Posts
    100
    Thanks given
    7
    Thanks received
    7
    Rep Power
    0
    Quote Originally Posted by Rune-Exclusion View Post
    How to make this command working... Like all is okay
    if (slot = 111,222,333,444,555,666,777,888,999) {
    mistake here.. can anyone fix it.
    Are you trying to say if 111 or 222... ?

    If so it would be

    Code:
    if (slot = 111 || 222 || 333 || 444 || 555 ||666 || 777 || 888 || 999) {
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2010
    Posts
    185
    Thanks given
    10
    Thanks received
    5
    Rep Power
    1
    Yea like slotmachine if u get 3 same pictures u win,. mine is with numbers..
    But yea errors...
    Reply With Quote  
     

  4. #4  
    Java Apprentice
    Cutelilbunny's Avatar
    Join Date
    Jan 2011
    Posts
    100
    Thanks given
    7
    Thanks received
    7
    Rep Power
    0
    What were the errors? Try changing
    This
    Code:
    if (slot = 111,222,333,444,555,666,777,888,999) {
    to this
    Code:
    if (slot = 111 || 222 || 333 || 444 || 555 ||666 || 777 || 888 || 999) {
    I also saw that you are saying that the player would loose if they got the numbers above, is this what you want?
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2010
    Posts
    185
    Thanks given
    10
    Thanks received
    5
    Rep Power
    1
    No that was another game... i want that if player gets 111,222,333,444,555,666,777,888,999 then he would get 50M... like 500k * 100. but yea it dont work... I am making a Casino to my server thats why im doing all kinds of games.
    Reply With Quote  
     

  6. #6  
    Renown Programmer

    Nikki's Avatar
    Join Date
    Aug 2008
    Posts
    3,993
    Thanks given
    553
    Thanks received
    1,077
    Rep Power
    5000
    Code:
    if (playerCommand.equalsIgnoreCase("slotmachine")){
    	int hasitem = 500000;
    	int slot = (Misc.random(1000));
    	int risked = (hasitem * 100);
    	if (!c.getItems().playerHasItem(995, hasitem)) {
    	c.sendMessage("You havent got above "+hasitem+" gp in your inventory.");
    	return;
    	}
    	if (slot == 111 || slot == 222 || slot == 333 || slot == 444 || slot == 555 || slot == 666 || slot == 777 || slot == 888 || slot == 999) {
    		c.sendMessage("You got "+slot+" and won "+(risked/1000000)+"M.");
    		c.getItems().addItem(995, risked);
    	} else {
    		c.sendMessage("You got "+slot+" and lost 500k.");
    		c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem);
    	}
    }
    Please don't add/pm me asking for RSPS help!

    Links:
    - [Only registered and activated users can see links. ]
    - [Only registered and activated users can see links. ]

    Reply With Quote  
     

  7. #7  
    damnant quod non intellegunt

    Mr Chainsaw's Avatar
    Join Date
    Sep 2006
    Age
    27
    Posts
    4,058
    Thanks given
    827
    Thanks received
    1,277
    Rep Power
    4664
    Code:
    if (playerCommand.equalsIgnoreCase("slotmachine"))
    {
    	int hasitem = 500000;
    	int slit = (Misc.random(1000));
    	int risked = (hasitem * 100);
    	if (!c.getItems().playerHasItem(995, hasitem))
    	{
    		c.sendMessage("You need at least " + hasitem + "gp to use this command.");
    		return 0;
    	}
    	if (slot%111==0)
    	{
    		c.sendMessage("You got " + slot + " and won " + (risked/1000000) + "m.");
    		c.getItems().addItem(995, risked);
    	}
    	else
    	{
    		c.sendMessage("You got " + slot + " and lost 500k.");
    		c.getItems().deleteItem(995, c.getItems().getItemSlot(995), hasitem);
    	}
    }
    are you all oblivious to modulus or doesn't that work in Java?
    [Only registered and activated users can see links. ]

    Reply With Quote  
     

  8. #8  
    Java Apprentice
    Cutelilbunny's Avatar
    Join Date
    Jan 2011
    Posts
    100
    Thanks given
    7
    Thanks received
    7
    Rep Power
    0
    I was in the middle of making an array. Thanks chainsaw

    My title is Java Apprentice for a reason.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

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


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •