Thread: Need help with leaderboards.

Results 1 to 10 of 10
  1. #1 Need help with leaderboards. 
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Hi,

    I've tried to follow the tut of King Fox - the tut about setting up your highscores. I did everything i should do but it still wont work. It worked before (my co made them work) but i haven't heard from hin in a while, so i'm kinda stuck now. Note: I'm using eclipse (duh)

    Code:
    			PreparedStatement stmt2 = db.prepare(generateQuery());
    			stmt2.setString(1, name);
    			stmt2.setInt(2, player.getRank().ordinal());
    			stmt2.setLong(3, player.getSkills().getTotalXp());
    It gives me an error;
    Code:
     the method ordinal() is undefined for the type String.
    I tried everything possible, yet nothing. Probably some dumb method i'm overseeing.

    The console gives me this error:
    Code:
    java.sql.SQLException: Incorrect integer value: '' for column 'rights' at row 1
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
    	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)
    	at com.rs.database.impl.Highscores.run(Highscores.java:41)
    	at java.lang.Thread.run(Unknown Source)
    Thanks in advance

    Nassim
    Reply With Quote  
     

  2. #2  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    getRank is returning a String
    Reply With Quote  
     

  3. #3  
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Quote Originally Posted by Stuart View Post
    getRank is returning a String
    Yea but i get an error if i change it to a String too.
    Reply With Quote  
     

  4. #4  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by Nassim View Post
    Yea but i get an error if i change it to a String too.
    stmt2.setString(2, player.getRank());
    Reply With Quote  
     

  5. #5  
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Quote Originally Posted by Stuart View Post
    stmt2.setString(2, player.getRank());
    As i said, i tried everything. Here's the next error:
    Code:
     java.sql.SQLException: Incorrect integer value: 'Player' for column 'rights' at row 1
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
    	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)
    	at com.rs.database.impl.Highscores.run(Highscores.java:41)
    	at java.lang.Thread.run(Unknown Source)
    Reply With Quote  
     

  6. #6  
    Respected Member


    Join Date
    Jan 2009
    Posts
    5,743
    Thanks given
    1,162
    Thanks received
    3,603
    Rep Power
    5000
    Quote Originally Posted by Nassim View Post
    As i said, i tried everything. Here's the next error:
    Code:
     java.sql.SQLException: Incorrect integer value: 'Player' for column 'rights' at row 1
    	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3609)
    	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3541)
    	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2002)
    	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2163)
    	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2624)
    	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2127)
    	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1362)
    	at com.rs.database.impl.Highscores.run(Highscores.java:41)
    	at java.lang.Thread.run(Unknown Source)
    Provide database table structure.
    Reply With Quote  
     

  7. #7  
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Quote Originally Posted by Stuart View Post
    Provide database table structure.
    Code:
    CREATE TABLE IF NOT EXISTS `hs_users` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `username` varchar(40) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
      `rights` int(1) NOT NULL DEFAULT '0',
      `overall_xp` bigint(20) NOT NULL,
      `attack_xp` int(11) NOT NULL,
      `defence_xp` int(11) NOT NULL,
      `strength_xp` int(11) NOT NULL,
      `constitution_xp` int(11) NOT NULL,
      `ranged_xp` int(11) NOT NULL,
      `prayer_xp` int(11) NOT NULL,
      `magic_xp` int(11) NOT NULL,
      `cooking_xp` int(11) NOT NULL,
      `woodcutting_xp` int(11) NOT NULL,
      `fletching_xp` int(11) NOT NULL,
      `fishing_xp` int(11) NOT NULL,
      `firemaking_xp` int(11) NOT NULL,
      `crafting_xp` int(11) NOT NULL,
      `smithing_xp` int(11) NOT NULL,
      `mining_xp` int(11) NOT NULL,
      `herblore_xp` int(11) NOT NULL,
      `agility_xp` int(11) NOT NULL,
      `thieving_xp` int(11) NOT NULL,
      `slayer_xp` int(11) NOT NULL,
      `farming_xp` int(11) NOT NULL,
      `runecrafting_xp` int(11) NOT NULL,
      `hunter_xp` int(11) NOT NULL,
      `construction_xp` int(11) NOT NULL,
      `summoning_xp` int(11) NOT NULL,
      `dungeoneering_xp` int(11) NOT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;
    Reply With Quote  
     

  8. #8  
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Yea, as i said i tried everything I would think of. That includes using eclipse suggestions. I'll get there, somehow.
    Reply With Quote  
     

  9. #9  
    Member Need help with leaderboards. Market Banned

    Join Date
    May 2011
    Age
    29
    Posts
    414
    Thanks given
    16
    Thanks received
    44
    Rep Power
    56
    Try this

    Go to player.java and add this

    Code:
    public int getDBRank(){
      if (getRights() == 0 && !isDicer())
       return 0; 
      if (getRights() == 0 && isDicer())
       return 0; 
      if (getRights() == 1)
       return 1;
      if (getRights() == 2 && !isOwner())
       return 2;
      if (getRights() == 4)
       return 4;
      if (getRights() == 5)
       return 5;
      if (getRights() == 6)
       return 6; 
      if (getRights() == 10)
       return 10; 
      if (getRights() == 3)
       return 3;
      return 0;
     }
    and then change

    Code:
     stmt2.setInt(2, player.getRank().ordinal());
    into

    Code:
     stmt2.setInt(2, player.getRank());
    Reply With Quote  
     

  10. Thankful user:


  11. #10  
    Donator
    Black Widow's Avatar
    Join Date
    Oct 2014
    Posts
    74
    Thanks given
    2
    Thanks received
    2
    Rep Power
    0
    Fixed - thanks to Chris.
    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

Similar Threads

  1. I need help with pen tool
    By Joe in forum General
    Replies: 6
    Last Post: 01-19-2008, 07:05 PM
  2. Need help with turning something back
    By ftmaster in forum RS2 Server
    Replies: 0
    Last Post: 12-20-2007, 03:11 PM
  3. Need help with DomScape
    By thegreatblob in forum Requests
    Replies: 4
    Last Post: 11-30-2007, 04:25 AM
  4. need help with making a client with new stuff
    By yahoo112 in forum RS2 Client
    Replies: 1
    Last Post: 09-19-2007, 08:06 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
  •