cornetto456's Profile User Rating: -----

Reputation: 21 Tradesman
Group:
Active Members
Active Posts:
437 (0.49 per day)
Joined:
03-January 11
Profile Views:
2,959
Last Active:
User is offline Today, 12:51 AM
Currently:
Offline

Previous Fields

Country:
BE
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0

Latest Visitors

Icon   cornetto456 has not set their status

Posts I've Made

  1. In Topic: Getting error while logging in!

    Posted 16 Jun 2013

    Hey there welcome to Dreamincode.net!

    I'm running your code on my pc and i'm getting a ClassNotFoundException:
    sun,jdbc.odbc.JdbcOdbcDriver
    


    I think you want: sun.jdbc.odbc.JdbcOdbcDriver
    not the ",".
    Also, look up on prepared statements, they are much more safer against any kind of SQL hacking.
    Hope this helps!
  2. In Topic: World server best way to handle this.

    Posted 25 Feb 2012

    View Postpbl, on 23 February 2012 - 06:21 PM, said:

    Sorry, I read your post 5 times and I do not have a clue of what your question(s) might be

    Sorry for that my native languages isn't english.

    My real question is this:

    I want to create an event system when a player join's, leave's, kill's someone.

    I thought of something like this:

    public class Event {
      private Player p;
      public Event(Player p){
     this.p = p;
    }
    
    
     public void getPlayer(){
     this.p;
    }
    
     public void setPlayer(Player p){
     this.p = p;
    }
    }
    
    
    


    and then create all event classes and extend this event class.

    Is this the wright approach ?

    Thanks
  3. In Topic: Rectangle won't update(Graphics)

    Posted 23 Feb 2012

    View Postsmohd, on 23 February 2012 - 03:05 PM, said:

    The setValues() is not related to GUI part, so you will need to repaint after setting new values for your variables

    like this:
        private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
        System.out.println(username + ID + level + exp + r +g +B)/>;
        jPanel1.repaint();
        } 
    
    
  4. In Topic: Characters from database

    Posted 23 Feb 2012

    So changed a couple of things (mainly for testing.)

    I did this:
    	public void getChara(int ID) throws SQLException{
    			stmt.setInt(1, ID);
    			set = stmt.executeQuery();
    			while(set.next()){
    				System.out.println(set.getString(2));
    			}
    		}
    
    


    this is what I get:

    23-feb-2012 14:01:11 com.definem.cs.alpha.CharacterListener run
    INFO: [CLIENT]@1
    23-feb-2012 14:01:11 com.definem.cs.alpha.CharacterListener run
    INFO: [CHARAS ID:1] Character request!
    //Under this statement are the names of the character.
    admin
    tester1 
    
    


    Now I got it working did this:

    stmt.setInt(1, ID);
    			set = stmt.executeQuery();
    			while(set.next()){
    				String names = set.getString(2);
    				System.out.println(names);
    				int iD = set.getInt(1);
    				System.out.println(iD);
    				
    			}
    
    


    Thanks for evrybody that helped :)

    Arno(Cornetto456)
  5. In Topic: Characters from database

    Posted 23 Feb 2012

    View Postpbl, on 22 February 2012 - 08:28 PM, said:

    By doing

    stmt = conn.prepareStatement("select ID,name,level,exp,r,g,b FROM gs_char where cid=?");

    you retreive just one, the one for which you provide the where cid=

    if you do

    stmt = conn.prepareStatement("select ID,name,level,exp,r,g,b FROM gs_char);

    the 3 will be returned. You will just have to loop

    while(set.next()) {
    ... extract next character

    Maybe I wasn't clear cid stands for creator id, so it acctualy the player id for retrieving the character I changed my code to this:
    	DB() {
    		try{  
    			Class.forName("com.mysql.jdbc.Driver").newInstance();
    			conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1/gs", "root",""); 
    			stmt = conn.prepareStatement("select ID,name,level,exp,r,g,b FROM gs_char where cid=?");
                            //ID= auto genarted character id, name is the name, level is the level, exp=exp r=red g=green =
                            //I ask for cid= the id of the player 
    		}catch(Exception e){
    			e.printStackTrace();
    			System.exit(-10);
    		}
    	}
    
    	public Boolean getChara(int ID){
    	  //Here my paramater is the id of the player
              // and i call it cid creator id.	
    try{
    			stmt.setInt(1, ID);
    			set = stmt.executeQuery();
    			while(set.next()){
    				int cid = set.getInt("ID");
    				String name = set.getString("name");
    				int level = set.getInt("level");
    				int exp = set.getInt("exp");
    				int r = set.getInt("r");
    				int g = set.getInt("g");
    				int b = set.getInt("b");
    				
    				System.out.println(cid + name + level + exp + r + g + B)/>;
    				
    				CharacterListener.out.println("." + " " +ID + ": " + name + " " + level + " " + exp +" " + r  +" "+ " "+ g + " " + B)/>;
    				
    				CharacterServer.log.info("[CHARA ID:" + ID +"] has found characters!");
    				return true;
    			}
    				CharacterServer.log.info("[CHARA ID:" + ID + "] has no characters!");
    				return false;
    		
    		}catch(Exception e){
    	
    		}
    		return false;
    
    
    
    	}
    
    


    Hope you can help now.

    Thanks!

    Arno(Cornetto456)

My Information

Member Title:
D.I.C Regular
Age:
16 years old
Birthday:
March 14, 1997
Gender:
Location:
Belgium
Full Name:
Arno Cornette
Years Programming:
3
Programming Languages:
Java, C#, html, css, javascript

Contact Information

E-mail:
Private
MSN:
MSN  arno.cornette1@gmail.com
Website URL:
Website URL  http://None
Facebook:
http://facebook.com/arno.cornette
Xfire:
cornetto456

Friends

Comments

cornetto456 has no profile comments yet. Why not say hello?