Thread: [Help] In need of a little help

Results 1 to 8 of 8
  1. #1 [Help] In need of a little help 
    Registered Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    When I compile and run the code everything is fine except for the chest does the instant open/close because I didn't put some sort of stop between the two. How would I make this work so that when the interface button is pushed it opens the first time and closes on the second button press?

    Code:
                            case 0: //Chest open and close
                                    (server.chest.openChest(c, c.chest);
                                    (server.chest.closeChest(c, c.chest);
                            break;
    I comment out either the open or the closed line and it works the way it should except for the fact that I cant do the opposite action.
    Reply With Quote  
     

  2. #2  
    -- Client Developer -- Insane's Avatar
    Join Date
    Aug 2010
    Posts
    299
    Thanks given
    2
    Thanks received
    33
    Rep Power
    56
    this for barrows? i dont understand what ur tryna do
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2010
    Posts
    3
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    I'm working on a chest , that when you open it there is a random item (1 of 10 different items), The player places a bet before hand and if they guess correctly they win. the only problem is when they click the button, the chest opens and closes instantly and they don't get to see the object inside along with their winnings.
    It tells them that they won but they don't get anything.


    The original code was

    Code:
    		case 49022:
    				switch (c.chestOptions) {
    
    			case 0: //Chest open
    				(server.chest.openChest(c, c.chest)
    			break;
    
    				case 1: //Chest close
    					(server.chest.closeChest(c, c.chest)
    				break;
    			}
    		break;
    But I changed case 1: to randomize the "contents".
    Reply With Quote  
     

  4. #4  
    Icy Realm Owner
    Icy Whip's Avatar
    Join Date
    May 2007
    Posts
    1,419
    Thanks given
    30
    Thanks received
    35
    Rep Power
    213
    Quote Originally Posted by Exthero View Post
    I'm working on a chest , that when you open it there is a random item (1 of 10 different items), The player places a bet before hand and if they guess correctly they win. the only problem is when they click the button, the chest opens and closes instantly and they don't get to see the object inside along with their winnings.
    It tells them that they won but they don't get anything.


    The original code was

    Code:
    		case 49022:
    				switch (c.chestOptions) {
    
    			case 0: //Chest open
    				(server.chest.openChest(c, c.chest)
    			break;
    
    				case 1: //Chest close
    					(server.chest.closeChest(c, c.chest)
    				break;
    			}
    		break;
    But I changed case 1: to randomize the "contents".

    Try It like this
    Code:
    		case 49022:
    				switch (c.chestOptions) {
    
    			case 0: //Chest open
    				(server.chest.openChest(c, c.chest)
    			break;
    
    				case 1: //Chest close
                                            //All of your content coding here.
    					(server.chest.closeChest(c, c.chest)
    				break;
    			}
    		break;
    java reads from top to bottom, like you read a book. So you have to make it "read" content coding before it closes the chest if that is what you wish for.


    Signature made by Mr. Ervis

    Any questions, MSN me; [email protected]
    Reply With Quote  
     

  5. #5  
    -- Client Developer -- Insane's Avatar
    Join Date
    Aug 2010
    Posts
    299
    Thanks given
    2
    Thanks received
    33
    Rep Power
    56
    Nvrmind
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jul 2010
    Age
    29
    Posts
    1,143
    Thanks given
    7
    Thanks received
    48
    Rep Power
    0
    Hey im trying to add this to if anyone can help me do it please add me on msn or skype

    Msn: [email protected]

    Skype name: juggalo-pride

    P.S I'm using project insanity's base new eras server
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Aug 2010
    Posts
    3
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    This code already worked,
    Code:
    		case 49022:
    				switch (c.chestOptions) {
    
    			case 0: //Chest open
    				(server.chest.openChest(c, c.chest)
    			break;
    
    				case 1: //Chest close
    					(server.chest.closeChest(c, c.chest)
    				break;
    			}
    		break;
    however I changed case 1: from closing to randomizing (which works), the only problem is the open and close.

    I need case 0: to be the switch between open and closed so you would use the same button to do both actions. as for the "else if" I have no idea how to do that for a case.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Aug 2010
    Posts
    2
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Sorry about the two different accounts but my brother stopped by and decided to mess with me i guess.
    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
  •