Thread: Dupe problem :D

Results 1 to 4 of 4
  1. #1 Dupe problem :D 
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    k so i added this feature where a person can save what their wearing and whats in their inventory so they can spawn it later.



    loadgame method
    [SPOIL]
    Code:
    	public static int loadGame(Client p) {
    		String line = "";
    		String token = "";
    		String token2 = "";
    		String[] token3 = new String[3];
    		boolean EndOfFile = false;
    		int ReadMode = 0;
    		BufferedReader characterfile = null;
    		boolean File1 = false;
    		
    		try {
    			characterfile = new BufferedReader(new FileReader("./Data/pksets/pkset1/"+p.playerName+".txt"));
    			File1 = true;
    		} catch(FileNotFoundException fileex1) {
    		}
    		
    		if (File1) {
    			//new File ("./characters/"+playerName+".txt");
    		} else {
    			Misc.println(p.playerName+": character file not found.");
    			p.newPlayer = false;
    			return 0;
    		}
    		try {
    			line = characterfile.readLine();
    		} catch(IOException ioexception) {
    			Misc.println(p.playerName+": error loading file.");
    			return 3;
    		}
    		while(EndOfFile == false && line != null) {
    			line = line.trim();
    			int spot = line.indexOf("=");
    			if (spot > -1) {
    				token = line.substring(0, spot);
    				token = token.trim();
    				token2 = line.substring(spot + 1);
    				token2 = token2.trim();
    				token3 = token2.split("\t");
    				switch (ReadMode) {
    				case 1:
    					if (token.equals("pkset-item")) {
    					p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
    					p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
    					}
    					break;
    				case 2:
    					if (token.equals("pkset-equip")) {
    					p.playerEquipment[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
    					p.playerEquipmentN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
    					}
    					break;
    				}
    			} else {
    				if (line.equals("[PKSET-ITEMS]")) {		ReadMode = 1;
    				} else if (line.equals("[PK-SET-EQUIPT]")) {		ReadMode = 2;
    				} else if (line.equals("[EOF]")) {		try { characterfile.close(); } catch(IOException ioexception) { } return 1;
    				}
    			}
    			try {
    				line = characterfile.readLine();
    			} catch(IOException ioexception1) { EndOfFile = true; }
    		}
    		try { characterfile.close(); } catch(IOException ioexception) { }
    		return 13;
    	}
    [/SPOIL]

    heres the part i edited:
    Code:
    				case 1:
    					if (token.equals("pkset-item")) {
    					for (int i : Config.PKP_ITEMS) {
    					if (i == Integer.parseInt(token3[1]) || i == Integer.parseInt(token3[1])-1) {
    					p.sendMessage("You can't save pkp items to your pk set.");
    					} else {
    					p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
    					p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
    					}
    					}
    					}
    					break;
    my problem:
    it says you can't have pkp items saved to ur pk set but it stills loads it...

    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  2. #2  
    Registered Member Aintaro.'s Avatar
    Join Date
    Sep 2010
    Posts
    998
    Thanks given
    188
    Thanks received
    213
    Rep Power
    37
    Where is the code that sends the message "you can't save pkp items to your pk set." ?
    Reply With Quote  
     

  3. #3  
    Registered Member
    vovik ukr's Avatar
    Join Date
    Aug 2010
    Posts
    1,240
    Thanks given
    136
    Thanks received
    187
    Rep Power
    278
    ummm... there

    Quote Originally Posted by Aintaro. View Post
    Where is the code that sends the message "you can't save pkp items to your pk set." ?
    heres the part i edited:
    Code:
    				case 1:
    					if (token.equals("pkset-item")) {
    					for (int i : Config.PKP_ITEMS) {
    					if (i == Integer.parseInt(token3[1]) || i == Integer.parseInt(token3[1])-1) {
    					p.sendMessage("You can't save pkp items to your pk set.");
    					} else {
    					p.playerItems[Integer.parseInt(token3[0])] = Integer.parseInt(token3[1]);
    					p.playerItemsN[Integer.parseInt(token3[0])] = Integer.parseInt(token3[2]);
    					}
    					}
    					}
    					break;
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  4. #4  
    Registered Member Aintaro.'s Avatar
    Join Date
    Sep 2010
    Posts
    998
    Thanks given
    188
    Thanks received
    213
    Rep Power
    37
    put a break; under the message, that should fix it.
    Reply With Quote  
     

  5. Thankful user:



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. Dupe problem
    By Mostwantedruels in forum Help
    Replies: 6
    Last Post: 08-16-2012, 12:17 AM
  2. Replies: 0
    Last Post: 09-23-2011, 09:04 AM
  3. [PI]Bad Dupe Problem
    By Glenn in forum Help
    Replies: 1
    Last Post: 06-12-2011, 06:07 AM
  4. bank dupe fix problem
    By Arithium in forum Help
    Replies: 2
    Last Post: 07-26-2010, 04:58 PM
  5. Help its a dupe problem again!
    By `NICK in forum Help
    Replies: 1
    Last Post: 06-06-2010, 01:03 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •