Thread: 1 error only!! urgent help ::jail

Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1 1 error only!! urgent help ::jail 
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    ok i did this small litle tut..


    Quote Originally Posted by Chip Munk View Post
    To make it so if they log and come back Add these in FileManager to make them stay in jail
    Code:
            stream.writeString("jailed:" + p.jailed);
    under

    Code:
            stream.writeString("runenergy:" + p.runEnergy);
    then add

    Code:
                     } else if (line.startsWith("jailed:")) {
                        p.jailed = Integer.parseInt(line.substring(9));
    under
    Code:
     } else if (line.startsWith("runenergy:")) {
                        p.runEnergy = Integer.parseInt(line.substring(10));
    after doing it i get this error:

    Code:
    .\net\com\codeusa\io\FileManager.java:222: incompatible types
    found   : int
    required: boolean
                        p.jailed = Integer.parseInt(line.substring(9));
                                                   ^
    Note: .\net\com\codeusa\clanchat\Room.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .

    this is how the code looks like:


    Code:
    		}
                    else if (line.startsWith("absx:"))
                        p.teleportToX = Integer.parseInt(line.substring(5));
                    else if (line.startsWith("absy:"))
                        p.teleportToY = Integer.parseInt(line.substring(5));
                    else if (line.startsWith("height:"))
                        p.heightLevel = 0; //Any height level different than 0 crashes the client upon login
                    else if (line.startsWith("runenergy:"))
                        p.runEnergy = Integer.parseInt(line.substring(10));
                    else if (line.startsWith("jailed:"))
                        p.jailed = Integer.parseInt(line.substring(9));
                    else if (line.startsWith("gender:"))
                        p.gender = Integer.parseInt(line.substring(7));
    i will defently rep+ even if you have any seggestion.
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  2. #2  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    found : int
    required: boolean
    read pl0x
    Reply With Quote  
     

  3. #3  
    Registered Member
    X Mercy X's Avatar
    Join Date
    May 2009
    Age
    31
    Posts
    1,336
    Thanks given
    3
    Thanks received
    41
    Rep Power
    301
    your parsing an int when you actually are needing a boolean
    else if (line.startsWith("jailed:"))
    p.jailed = Integer.parseBoolean(line.substring(9));
    Read the error

    Reply With Quote  
     

  4. #4  
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    but i did already declare this in player.java

    Code:
        public boolean jailed = false;
    what do i have to do to overcome that problem.
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  5. #5  
    Member
    Join Date
    Jul 2008
    Posts
    221
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    } else if (line.startsWith("jailed:")) {
    p.jailed = Integer.parseInt(line.substring(9));
    Change 9 to 7.. might work

    Reply With Quote  
     

  6. #6  
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    nop, it still wont work.
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  7. #7  
    Номер 1


    Leanbow's Avatar
    Join Date
    Feb 2008
    Posts
    5,895
    Thanks given
    1,564
    Thanks received
    2,624
    Rep Power
    5000
    u need other codes to safe boolen can't remember
    Reply With Quote  
     

  8. #8  
    Typical Swede


    Join Date
    Jul 2008
    Posts
    1,162
    Thanks given
    204
    Thanks received
    154
    Rep Power
    217
    Replace your 'jailed' boolean in player class and use int

    Code:
    public int jailed = 0;

    'Strange things did happen here no stranger would it be'
    ______________________________________________
    Reply With Quote  
     

  9. #9  
    Registered Member
    Ninja assassin's Avatar
    Join Date
    Oct 2008
    Posts
    1,961
    Thanks given
    217
    Thanks received
    115
    Rep Power
    77
    Quote Originally Posted by IjavaI View Post
    Replace your 'jailed' boolean in player class and use int

    Code:
    public int jailed = 0;
    ok now i dont get no error, but i have to remove "&& p.jailed != true" from my command because i get error, so what do i change that to?
    Code:
    } else if(cmd[0].equals("home") && p.jailed != true) {
                         p.teleportTo(3087, 3499, 0, 0, 0, 8939, 8941, 1576, 0, 1577, 0);
    Btc: 1tpWTbAznzWYh6YpoUJeQ3MDVK56GGJ
    Reply With Quote  
     

  10. #10  
    ¯̿ ̿|̿ ̿ |̶ ̶ ̶ ̶| |̶͇̿ ̶͇̿ ͇̿ Haskelle

    Join Date
    Nov 2007
    Age
    29
    Posts
    1,227
    Thanks given
    329
    Thanks received
    517
    Rep Power
    1133
    Quote Originally Posted by hitman View Post
    Change 9 to 7.. might work
    don't say dumb things lol.
    Monads are just Monoids in the category of Endofunctors. What is the problem?
    Costate Comonad Coalgebra is equivalent of Java's member variable update technology for haskell. Problem?
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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
  •