Mobs & battleship

Results 1 to 11 of 11
  1. #1
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Mobs & battleship

    Hello!

    I'm using moopledev rev120, where all the skills should work!
    I'm not sure why but when someone uses the skill battleship he gets disconnected from the game with no error and im not even getting a log of the error so I really don't know what to do.

    In addition to that problem I there is a problem where monsters (like the blue mobs that zakum spawns)
    don't die even after reaching 0 HP.

    I will be still trying to fix thsese problems as I'm waiting for clues x;

    - update -

    and if anyone could tell me whats the problem here i'll love him forever -_- trying to make it so u dont need to log off to vote, basically adding a command that will claim it.

    PHP Code:
        public void claimVote() {
            
    MapleCharacter ty = new MapleCharacter();
            
    int claimvote 0;
            try { 
    // recieving the data
                
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT claimvote FROM accounts WHERE id = ?");
                
    ps.setInt(1ty.accountid);
                
    ResultSet rs ps.executeQuery();
                if (
    rs.next()) {
                    
    claimvote rs.getInt("claimvote");
                }
                
    rs.close();
                
    ps.close();
            } catch (
    Exception e) {
                
    System.out.print(name " has recieved an error while trying to claim a vote.");
            }
            
            
            if (
    claimvote 0) { // positive number claim rewards, negative don't do anything
                
    gainVotePoints(1);
                
    claimvote -= 1;
                
    getCashShop().getCash(5000);
                
    dropMessage("You have recieved 1 vote point and 5000 nx.");
            } else {
                
    dropMessage("You don't have vote points to be claimed.");
            }
            
    Connection con DatabaseConnection.getConnection();
            
            
            try { 
    // sending back the new data
                
    con.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
                
    con.setAutoCommit(false);
                
    PreparedStatement ps;
                
    ps con.prepareStatement("UPDATE accounts SET `claimvote` = ? WHERE id = ?");
                
    ps.setInt(1claimvote);
                
    ps.setInt(2client.getAccID());
                
    ps.executeUpdate();
                
    ps.close();
            } catch (
    SQLException se) {
                
    System.out.print(name " has recieved an error while trying to claim a vote.");
            }
        } 
    Last edited by iwtLive; 14-04-14 at 01:06 AM.


  2. #2
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Re: Mobs & battleship

    beep boop

  3. #3
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Re: Mobs & battleship

    boop beep

  4. #4
    Wut. QuietCrystal is offline
    MemberRank
    Aug 2010 Join Date
    SingaporeLocation
    346Posts

    Re: Mobs & battleship

    You need to tell us the problem with the vote function ._. Errors? Wut?

    [PHP]Also why not,
    gainVotePoints(claimvote);
    getCashShop().getCash(5000 * claimvote);[\PHP]

  5. #5
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Re: Mobs & battleship

    Quote Originally Posted by QuietCrystal View Post
    You need to tell us the problem with the vote function ._. Errors? Wut?

    [PHP]Also why not,
    gainVotePoints(claimvote);
    getCashShop().getCash(5000 * claimvote);[\PHP]
    oh opsie, the problem is that im recieving the 0 into the claimvote instead of the actual number I put there.
    so basically the value if claimvote is not changing.
    and yar I should have made it this way o-oo

  6. #6
    Everything is possible~ Diamondo25 is offline
    MemberRank
    Jan 2008 Join Date
    The NetherlandsLocation
    1,116Posts

    Re: Mobs & battleship

    MapleCharacter ty = new MapleCharacter();
    int claimvote = 0;
    try {
    // recieving the data
    PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT claimvote FROM accounts WHERE id = ?");
    ps.setInt(1, ty.accountid);


    You are getting the accountid from a new MapleCharacter, not the one you are updating...

  7. #7
    Wut. QuietCrystal is offline
    MemberRank
    Aug 2010 Join Date
    SingaporeLocation
    346Posts

    Mobs & battleship

    Quote Originally Posted by Diamondo25 View Post
    MapleCharacter ty = new MapleCharacter();
    int claimvote = 0;
    try {
    // recieving the data
    PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT claimvote FROM accounts WHERE id = ?");
    ps.setInt(1, ty.accountid);


    You are getting the accountid from a new MapleCharacter, not the one you are updating...
    Oh wow was focused on the database statements so much that I didn't see the obvious declaration there ._______. *Feels dumb*

    Edit: By the way, if it's already 0, then don't bother executing the update statement. Pretty wasteful.

  8. #8
    while(true) spam(); kevintjuh93 is offline
    MemberRank
    Jun 2008 Join Date
    The NetherlandsLocation
    4,119Posts

    Re: Mobs & battleship

    I will fix those errors in rev 121. Let me check them now, so I can post a fix here.

  9. #9
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Re: Mobs & battleship

    sorry I was on a vacation for 3 days, and I was unable to answer with my crappy phone..

    Quote Originally Posted by QuietCrystal View Post
    Oh wow was focused on the database statements so much that I didn't see the obvious declaration there ._______. *Feels dumb*

    Edit: By the way, if it's already 0, then don't bother executing the update statement. Pretty wasteful.
    so do you basically mean I should do it like this?
    PHP Code:
    int claimvote 0;
    try { 
    // recieving the data
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT claimvote FROM accounts WHERE id = ?");
    ps.setInt(1accountid); 

    Quote Originally Posted by kevintjuh93 View Post
    I will fix those errors in rev 121. Let me check them now, so I can post a fix here.
    How do I let you check them? would you like to come on the server?

  10. #10
    Everything is possible~ Diamondo25 is offline
    MemberRank
    Jan 2008 Join Date
    The NetherlandsLocation
    1,116Posts

    Re: Mobs & battleship

    Quote Originally Posted by dorkie4ever View Post
    sorry I was on a vacation for 3 days, and I was unable to answer with my crappy phone..


    so do you basically mean I should do it like this?
    PHP Code:
    int claimvote 0;
    try { 
    // recieving the data
    PreparedStatement ps DatabaseConnection.getConnection().prepareStatement("SELECT claimvote FROM accounts WHERE id = ?");
    ps.setInt(1accountid); 


    How do I let you check them? would you like to come on the server?
    use client.getAccID(), like you do in the other query

  11. #11
    .. .-- - .-.. .. ...- . iwtLive is offline
    MemberRank
    Sep 2012 Join Date
    260Posts

    Re: Mobs & battleship

    Quote Originally Posted by Diamondo25 View Post
    use client.getAccID(), like you do in the other query
    thanks that worked,
    now i only need to find solutions for my other 2 problems xD



Advertisement